Re: [Render] OpenType support in Pango



Keith Packard <keithp keithp com> writes:

> How is this stuff handling font encodings?  Does Xft need more support for
> that kind of stuff?  The output is certainly impressive.

The way OpenType layout works is that the driver level (Pango, here)
first converts the incoming Unicode text into glyphs using the
character map of the font in a 1-1 fashion. 

Then, it applies transformations from the OpenType layout tables
to some or all glyphs - e.g.:

 - Convert glyphs 1,4,11,13 into the medial form using the 'medi'
   feature
 - Convert glyphs 2,6,12,12 into the initial form using the 'init'
   feature.
 - Apply the ligatures in the 'liga' feature to all glyphs.
 - Adjust mark-to-base positioning using the 'mark' feature.

The result is then a set of modified glyph codes with modified
positions.


So, the only "encoding" that is used is a Unicode encoding, but
after you do the transformation from char => glyph using this, 
there are further transformations on the glyphs. 

So, I needed both the charmap table set and the ability to
render using raw glyph codes. What I did was load up the
font using Xft unencoded by the "glyphs-unencoded" encoding,
and then called FT_Set_Charmap myself. 

Which is a bit of a hack, and there is a potential problem if
the font that is loaded doesn't have a Unicode character map.

An alternate method would have been to load the font with
the "iso10646-1" encoding via Xft and then do:

 font->u.ft.font.encoded = 0;

Which is a bigger hack, but might be the cleaner/better way
to achieve the effect if there was an API call to do this.
(XftFreetypeSetEncoded or something.)

Regards,
                                        Owen




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