From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: Patch for Mac OS X Text Drawing Date: Sat, 22 Jan 2005 13:55:46 +0900 (JST) Message-ID: <200501220455.NAA26886@etlken.m17n.org> References: <20050122.124732.63490425.mituharu@math.s.chiba-u.ac.jp> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1106370969 18178 80.91.229.6 (22 Jan 2005 05:16:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 22 Jan 2005 05:16:09 +0000 (UTC) Cc: piet@cs.uu.nl, rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 22 06:16:01 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CsDcv-0001Li-00 for ; Sat, 22 Jan 2005 06:16:01 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CsDp1-0008Al-49 for ged-emacs-devel@m.gmane.org; Sat, 22 Jan 2005 00:28:31 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CsDnU-0007BC-09 for emacs-devel@gnu.org; Sat, 22 Jan 2005 00:26:56 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CsDnF-000749-Pu for emacs-devel@gnu.org; Sat, 22 Jan 2005 00:26:42 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CsDnF-00070A-Mx for emacs-devel@gnu.org; Sat, 22 Jan 2005 00:26:41 -0500 Original-Received: from [192.47.44.130] (helo=tsukuba.m17n.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CsDJY-0004aT-N7; Fri, 21 Jan 2005 23:56:01 -0500 Original-Received: from fs.m17n.org (fs.m17n.org [192.47.44.2]) by tsukuba.m17n.org (8.12.3/8.12.3/Debian-7.1) with ESMTP id j0M4tlwM001360; Sat, 22 Jan 2005 13:55:47 +0900 Original-Received: from etlken.m17n.org (etlken.m17n.org [192.47.44.125]) by fs.m17n.org (8.11.6p2/8.11.6) with ESMTP id j0M4tki23446; Sat, 22 Jan 2005 13:55:46 +0900 (JST) Original-Received: (from handa@localhost) by etlken.m17n.org (8.8.8+Sun/3.7W-2001040620) id NAA26886; Sat, 22 Jan 2005 13:55:46 +0900 (JST) Original-To: YAMAMOTO Mitsuharu In-reply-to: <20050122.124732.63490425.mituharu@math.s.chiba-u.ac.jp> (message from YAMAMOTO Mitsuharu on Sat, 22 Jan 2005 12:47:32 +0900 (JST)) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3.50 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:32479 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:32479 In article <20050122.124732.63490425.mituharu@math.s.chiba-u.ac.jp>, YAMAMOTO Mitsuharu writes: > Because the current (system-independent) code assumes that drawing the > same character over the existing one does not change its appearance, > but that's not true on Mac OS X with text anti-aliasing. > Quote from http://developer.apple.com/qa/qa2001/qa1193.html: > Avoid double-drawing the same text because anti-aliased areas darken > with repeated over-drawing. > I'm not sure about other environments with anti-aliasing such as Xft > and ClearType. Does anyone know about how over-drawing is treated > there? The tutorial of Xft says to clear or fill an area before drawing a text there as below: ------------------------------------------------------------ 5.3 Text Drawing Xft doesn't support "image text" at all; rather the application must explicitly fill the background rectangle before drawing the string. With AA text, there's no other way to make it work. XDrawString -> XftDrawString8 XDrawImageString -> XftDrawRect + XftDrawString8 Note that drawing the same string multiple times in the same place will generate the wrong result with AA text. This can be especially hard to fix in applications that avoid setting clipping when redrawing parts of windows. An easy fix here is to simply clear the entire window before redrawing it. This does cause extensive flashing on the screen, the alternative is to use clipping and make sure that any areas within the clip region get cleared to the background before text is drawn on top. ------------------------------------------------------------ --- Ken'ichi HANDA handa@m17n.org