all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Patch to enable Quartz font smoothing on MACOSX
@ 2003-08-12 17:10 Niv Drory
  2003-08-13  6:34 ` Andrew Choi
  0 siblings, 1 reply; 3+ messages in thread
From: Niv Drory @ 2003-08-12 17:10 UTC (permalink / raw)
  Cc: akochoi-emacs


Hi everybody,

Here is a patch to src/macterm.c which enables Quartz font smoothing on
Mac OS X using Carbon. This works on Mac OS X version 10.1.5 and later.

I've enclosed the changes in #ifdef ENABLE_QUARTZ_FONT_SMOOTHING which
could be set by a new option to configure (--enable-quartz-font or
something like that). If Quartz font smoothing is welcome, I'll be happy
to provide this as well. The patch is against cvs as of Aug 12 2003 17:00
CEST.

I cannot test the patch on Mac OS X prior to 10.2 nor in classic/Mac OS
7-9 since I have no access to such machines.

Thanks to everybody for their great work on EMACS,

Cheers,

	Niv

---------------------------------------------------------------------
Niv Drory                             |
Department of Astronomy               | phone:     (512) 471 7426
The University of Texas at Austin     | drory at astro as utexas edu
---------------------------------------------------------------------

--- macterm.c	Tue Aug 12 11:53:06 2003
+++ macterm.c.new	Tue Aug 12 11:52:09 2003
@@ -670,7 +670,22 @@
   TextFont (gc->font->mac_fontnum);
   TextSize (gc->font->mac_fontsize);
   TextFace (gc->font->mac_fontface);
-  TextMode (mode);
+
+#ifdef ENABLE_QUARTZ_FONT_SMOOTHING
+  if( mode != srcOr )
+    {
+      Rect rc;
+      rc.left = x;
+      rc.bottom = y+FONT_DESCENT(gc->font);
+      rc.top = rc.bottom - FONT_HEIGHT(gc->font);
+      rc.right = x+nchars*FONT_WIDTH(gc->font);
+      TextMode(mode);
+      EraseRect(&rc);
+    }
+  TextMode (srcOr);
+#else
+  TextMode(mode);
+#endif

   MoveTo (x, y);
   DrawText (buf, 0, nchars * bytes_per_char);
@@ -8725,6 +8740,11 @@
   init_required_apple_events ();

   init_mac_drag_n_drop ();
+
+#ifdef ENABLE_QUARTZ_FONT_SMOOTHING
+  /* if possible, enable Quartz font smoothing in QuickDraw */
+  SwapQDTextFlags (kQDUseCGTextRendering | kQDUseCGTextMetrics);
+#endif

 #if USE_CARBON_EVENTS
   init_service_handler ();

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch to enable Quartz font smoothing on MACOSX
  2003-08-12 17:10 Patch to enable Quartz font smoothing on MACOSX Niv Drory
@ 2003-08-13  6:34 ` Andrew Choi
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Choi @ 2003-08-13  6:34 UTC (permalink / raw)


Niv Drory <drory@astro.as.utexas.edu> writes:

> Here is a patch to src/macterm.c which enables Quartz font smoothing on
> Mac OS X using Carbon. This works on Mac OS X version 10.1.5 and later.
> 
> I've enclosed the changes in #ifdef ENABLE_QUARTZ_FONT_SMOOTHING which
> could be set by a new option to configure (--enable-quartz-font or
> something like that).  [...]

I can only be in favor of adding this patch if `./configure' is made to
automatically determine whether the function SwapQDTextFlags is
available.  An option to `./configure' is not a good solution.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Patch to enable Quartz font smoothing on MACOSX
  2003-08-13 12:59 Niv Drory
@ 2003-08-13 13:10 ` Andreas Schwab
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2003-08-13 13:10 UTC (permalink / raw)
  Cc: akochoi-emacs, emacs-devel

Niv Drory <drory@astro.as.utexas.edu> writes:

|> > I can only be in favor of adding this patch if `./configure' is made
|> > to automatically determine whether the function SwapQDTextFlags is
|> > available.  An option to `./configure' is not a good solution.
|> 
|> Some people prefer QuickDraw font smoothing, that's why I'd prefer a
|> user setable switch. Anyway, here's a patch to configure.in
|> 
|> --- configure.in	Wed Aug 13 07:40:21 2003
|> +++ configure.in.new	Wed Aug 13 07:42:08 2003
|> @@ -2218,6 +2218,7 @@
|> 
|>  ### Use Mac OS X Carbon API to implement GUI.
|>  HAVE_CARBON=no
|> +ENABLE_QUARTZ_FONT_SMOOTHING=no
|>  if test "${with_carbon}" != "no"; then
|>    AC_CHECK_HEADER(Carbon/Carbon.h, HAVE_CARBON=yes)
|>  fi
|> @@ -2235,6 +2236,12 @@
|>    fi
|>    # We also have mouse menus.
|>    HAVE_MENUS=yes
|> +  # check for Mac OS X Version >= 10.1.5 for Quartz font-smoothing
|> +  # (this corresponds to Darwin 5.5)
|> +  darwin_55=$(expr $(uname -r) ">=" 5.5)

This will fail when `uname -r' return "5.10".  Why can't you just check
for the existence of a particular function in the library?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-08-13 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-12 17:10 Patch to enable Quartz font smoothing on MACOSX Niv Drory
2003-08-13  6:34 ` Andrew Choi
  -- strict thread matches above, loose matches on Subject: below --
2003-08-13 12:59 Niv Drory
2003-08-13 13:10 ` Andreas Schwab

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.