Re: Latest Font RFC?

> Yes, the proposed design of the library.

OK. I've hold back more RFC-s to write my ideas into code and test these
in real code flow. What I have now:

There are 3 typeface objects, with slightly different meanings:

GnomeFontFace - unsized font. Its metrics and glyph outlines are given for
1000 unit em square font.

GnomeFont - typeface whose size is specified, and (facultatively) certain
"master" output resolution set. Its metrics and glyph outlines are given
in point coordinates, snapped to "master" resolution grid, if applicable.

GnomeRFont - typeface adjusted to real output raster (canvas pixel
coordinates etc.). Its metrics and glyph outlines are given in output

The division is hierarchical - from face you get font(s), from font
rfont(s). GnomeFont is designed to be basic user-visible object, rfonts
appear mostly in library implementations.

Logic behind this structure is following:
* Face is mostly technical object. It is useful for browsing and it
implements connection with real font file, being it TrueType, Type1 or
something different. From single face you can request unlimited number of
fonts, differing on point size and output resolution.
* Font belongs to abstract display canvas. It is logical unit - given
12pt Helvetica you know exactly, how your work should look like in given
situation - but still it can look different in different situations. Page
can be zoomed or transformed as whole - so actual output is still not
determined by font solely.
* RFont is font transfomed to real output resolution. If you create canvas
text item, you specify only its GnomeFont. During ::update(), it then
itself requests appropriate GnomeRFont, and during ::render() draws its
glyphs to canvas buffer.

All 3 are derived from common ancestor GnomeVFont, which implements
glyph-font relationship. So all 3 have class method ::get_glyph()

GnomeFontGlyph exact interpretation depends whether it belongs to Face,
Font or RFont. Only RFont glyphs possibly can render to real raster
objects, other can give you outlines. Still the basic accessor
functions are the same (get metrics, get outline, get bitmap, render)

Existing code:
All previous objects have basic object skeleton.
GnomeFontFaceFT - Face class, interpreting TrueType font file
All have most basic methods present, so actual output is sometimes seen
by me :)

This is long and difficult to understand, of course. While writing lib, I
am also creating a little, commented program, to illustrate (and test
:)) its use.
There is preliminary canvas item implementation, doing behind-the-scenes
RFont chemistry.


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