FontStructure

Webs: Faemalia -:- Greatprawn -:- Playground -:- Technical -:- Tweak
Technical Web Sections: Register -:- Users -:- Changes -:- Index -:- Search -:- Statistics

The design of the font handling in Dia right now (Sep 2003) is essentially a relic from the time where GDK font rendering was the only rendering method that mattered. lib/font.c actually does font layout to find the exact height of the font to render, no matter what renderer is used. This is not only slow, it's also silly for non-GDK renderers.

A better setup would be to have lib/font.c only handle figuring out the in-diagram width of a text, that is render it with GDK font renderer at 100% zoom at (probably) 75 DPI. It should then store that value, and pass it to whichever renderer is in effect. The renderers are then responsible for correcting for differences in string width according to font rendering.

The first thing to do for this is to make all text use Dia Text objects. That will allow lib/font.c to store the width in there. The Text objects should be fully encapsulated, so that any change can be detected and the width correctly updated.

Next the renderers must be able to take a Text object and render that, instead of the messy botch of arguments passed right now. With all text being in Text objects, there's no need to allow other rendering.

Then, lib/font.c must operate on Text objects and figure out their widths correctly.

Renderers should be free to cache rendered text.

-- LarsClausen - 14 Sep 2003


Edit -:- Attach -:- Ref-By -:- Printable -:- More