From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Niv Drory Newsgroups: gmane.emacs.devel Subject: Patch to enable Quartz font smoothing on MACOSX Date: Tue, 12 Aug 2003 12:10:44 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: sea.gmane.org 1060708385 22158 80.91.224.253 (12 Aug 2003 17:13:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 12 Aug 2003 17:13:05 +0000 (UTC) Cc: akochoi-emacs@shaw.ca Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Aug 12 19:13:03 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19mchj-0000mi-00 for ; Tue, 12 Aug 2003 19:13:03 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19mcpW-0007DU-00 for ; Tue, 12 Aug 2003 19:21:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19mcgK-0004fl-VR for emacs-devel@quimby.gnus.org; Tue, 12 Aug 2003 13:11:36 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19mcg8-0004dD-3A for emacs-devel@gnu.org; Tue, 12 Aug 2003 13:11:24 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19mcfb-0004LO-7Z for emacs-devel@gnu.org; Tue, 12 Aug 2003 13:11:23 -0400 Original-Received: from [128.83.129.40] (helo=astro.as.utexas.edu) by monty-python.gnu.org with esmtp (Exim 4.20) id 19mcfa-0004LG-UT for emacs-devel@gnu.org; Tue, 12 Aug 2003 13:10:51 -0400 Original-Received: from astro.as.utexas.edu (localhost [127.0.0.1]) by astro.as.utexas.edu (8.12.9/8.12.9) with ESMTP id h7CHAn1V014228; Tue, 12 Aug 2003 12:10:49 -0500 (CDT) Original-Received: from localhost (drory@localhost) by astro.as.utexas.edu (8.12.9/8.12.9/Submit) with ESMTP id h7CHAi5n014225; Tue, 12 Aug 2003 12:10:45 -0500 (CDT) Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:15907 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15907 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 ();