gnome font RFC quickie



Hello!

Many thanks to Liam Quin for insightful suggestions. Follows quick
structure proposal of font-related objects:

1. GnomeFontGroup
2. GnomeFontFamily
3. GnomeFontFace
4. GnomeFont
5. GnomeFontTransformed

1. Serves for user grouping and managing fonts

2. Is collection of related typefaces, mainly for easy managing

3. Should be mostly hidden from user - it is raw font data holder - such
   data, that can be embedded in object or sent to printer

4. Is visually unscaled, but metrically scaled font. I.e. it has assigned
   certain output resolution (in points). This is the most visible object
   to user - and it is user responsibility to set correct output
   resolution.

I.e. if you want to layout page, it is best to scale font to desired
resolution. All metric information will be adjusted to that resolution and
although on-screen display may not be as nice as possible, output is
guaranteed to be best.
If you plan to do some abrakadabra with font, such as nontrivial
transforms, best scale it to some very big value. Then font uses
internally metrics adjusted to infinity.
If interested solely in onscreen display, simply scale font to desired
screen size (in pixels)

NB! metrics still look out unscaled to user (given for 1000 unit
font). But these are adjusted to scale to integers in given size.

Probably there should be some convenience functions, trying to discover
required output resolution.

5. Is mostly needed by canvas item and print context implementations. This
   manages glyph cache. From it you can also extract final metrics.

The font using process is roughly following:
- user gets handle to font via browsing/finding/etc.
- user sets desired font output resolution
There should be something like GNOME_FONT_SCALE_AUTOMATIC,
GNOME_FONT_SCALE_EXACT, GNOME_FONT_SCALE_INFINITY global parameter in
library, so if once set to automatic or infinity, you do not need to
bother about output resolution. Still for exact layouting purposes there
is always a way set set this manually.
AUTOMATIC - output library always uses metric adjusted to real output
resolution. This gives best possible glyph/word lookout, but may distort
lines/layout.
INFINITY - output library uses sub-pixel positioning. Usable for
antialiased display, either reduce readability of glyph shapes or
distort inter-character distances. Layout stays always the same.
EXACT - user sets font desired output resolution. Lookout is degraded for
most other resolutions, but guaranteed to be best on desired one. Layout
stays always the same.
(maybe there should be 3 rules - EXACT_PER_CHAR, EXACT_PER_WORD,
EXACT_PER_LINE - distorting inter-character or inter-word distances, or
leaving these intact, so line lengths depend on resolution)
- Font handle is used to output text
Output context (canvas, print...) finds CTM and request
GnomeFontTransformed. Depending of metric (automatic, exact, infinite) and
rendering (exact aa, clear aa, bitmap) it then rendrs separate glyphs to
context.

I hope this will minimize user headache, still preserving possibility to
do high-quality layout.

Comments? Suggestions? Flames?

Lauris






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