News on the text rendering front



The last couple of weeks, I have been working on secret text rendering
stuff, trying out various things I had hoped would work to improve the
quality and speed.  To that end, I have introduced a new object, called
TextLine, which comprises a single line of text with its font and height
and possibly some cached information.

This allowed me to fiddle enough with rendering to finally find what
appears to be the root cause of the font rendering problems:  Pango
seems to round the width of glyphs in its layout to pixels.  Thus
rendering the same text at different font sizes is almost guaranteed to
give different relative widths.  Our current kludge of trying to find a
proper height was not only very slow, potentially creating many layouts
per rendering, but also could not possibly work in all cases.

In the TextLine rendering function for the GDK FT2 rendering, I make use
of cached values for the sizes of the glyphs at 100% to "manually"
adjust the sizes at other zoom levels to match.  This has allowed me to
sidestep the whole ugly kludge and render directly with the desired
size.

The outcome:

    Text rendering is now up to 30 times (not just 30%, 30 times!)
    faster than before, text width is actually accurate, and we can
    toss out our ugly kludge.  Three very annoying birds with one
    stone.  I am very happy.

There's still some amount of work for this to be used throughout the
renderers, and the objects should use TextLine instead of ever calling
draw_string.  I expect to be working on this in the upcoming weeks, and
any help would be appreciated, especially from those who know the ins
and outs of the various renderers.  I will try to be on #dia on
irc.gnome.org when possible, the greatest chance of finding me would be
Thursday evenings and weekends.

-Lars




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