[Top][All Lists]

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

Re: Patch for Mac OS X Text Drawing

From: Kenichi Handa
Subject: Re: Patch for Mac OS X Text Drawing
Date: Sat, 22 Jan 2005 13:55:46 +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)

In article <address@hidden>, YAMAMOTO Mitsuharu <address@hidden> 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

reply via email to

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