[Cairo] Text APIs round 2
keithp at keithp.com
Fri Aug 15 10:11:55 PDT 2003
Around 11 o'clock on Aug 15, Owen Taylor wrote:
> The way postscript handles this is that fonts start off with a default
> size of 1 unit... sort of useless, but at least gives *some* meaning
> to the situation.
But, PostScript doesn't have to deal with bitmap fonts. I need to know
the pixel size before I can select anything in that case. I guess
I just need to keep the font parameters around and reselect a font if the
transformation changes. Hmm. How about I resolve the font the first time
it's used and never re-resolve it; that way I can have 'squishy' fonts that
are 'solidified' as late as possible, but then never again. Change the
transformation a second time and you get garbage for bitmap fonts. I can
certainly live with that.
> How about _width()?
Is that width of the glyph bounding box or the distance along the baseline?
If we use 'width', then we'd better be pretty careful about the names we
stick in the extents structure.
> Well, the Pango API's basic drawing call is "draw this string of glyphs
> in this font"...
Yeah, but a 'font' consists of many underlying TrueType fonts as needed to
cover the text being set; for Mozilla, it was easy to ignore which font a
glyph came from, but for Pango that's not true.
However, you can't get 'correct' output unless you provide an API that
specifies the font for each glyph as the compositing will be broken when
switching fonts. You don't get to choose the XDrawText style API either
(yuck), so the choice is between having a single API which takes a font
for each glyph or having two APIs, one of which takes a font for each
glyph and one which doesn't. The underlying code for either is pretty
simple, so I guess I can be persueded to include two versions, but it's
not going to make me happy :-)
More information about the cairo