Re: supporting antialiased text in gdk



Alexander Larsson <alla lysator liu se> writes:

> The linux-fb port uses anitialiased text rendered by freetype, and since
> other ports may start using antialiased text rendering in the future i
> think we need to discuss some issues that has appeared due to this.
> 
> There are two ways to do antialiased rendering, both with their own
> problems:
> A) Render each pixel as gc_foreground*alpha + drawable_content*(1-alpha)
> B) Render each pixel as gc_foreground*alpha + gc_background*(1-alpha)
> 
> (GtkFB currently uses A, but that might change)
> 
> Now, what are the problems with these to with respect to the
> semantics of gdk/gtk? 
> 
> The problem with A is that rendering the same text multiple time at
> the same place produces different results, since the output from the
> previously drawn text is used in the AA calculation. This is easily
> visible by i.e. scrolling a GtkCList horizontally. Some text is repainted
> twice, producing very bad looking "fat" AA text.
> 
> The problem with B is that you must specify a correct background color for
> every GC that is used to draw text. This is not currently done.
> 
> Which, if any, methods do we want to support in gtk? What does other
> systems use (win32, beos)?
> 
> Supporting either method in gdk needs changes in gtk. Method A is clearly
> more powerful, as you can draw AA text over any pixmap, but method B is
> much more efficient to implement, since the AA calculations between fg and
> bg can be done in advance, rendering only becomes a table lookup. Also,
> most text in real apps is rendered over clean widget backgrounds.

a) is correct, any code that draws text muliple time in the same
place without clearing the background is buggy.

[ This is the basic method of the xrender extension, which we will
  be supporting in GTK+ soon, though there some subtleties with
  joined scripts where just using a) causes problems ]

Regards,
                                        Owen 




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