emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch to enable Quartz font smoothing on MACOSX


From: Niv Drory
Subject: Patch to enable Quartz font smoothing on MACOSX
Date: Tue, 12 Aug 2003 12:10:44 -0500 (CDT)

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 ();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]