[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] is it possible to retrieve whole kerning table?
From: |
mpsuzuki |
Subject: |
Re: [ft-devel] is it possible to retrieve whole kerning table? |
Date: |
Sat, 14 Jan 2006 21:09:38 +0900 |
Hi,
>I am trying to figure out how to implement WIN32 GetKerningPairs[1] function
>in Wine. Unfortunately, I can't find a similar function in freetype API.
>There is FT_Get_Kerning, but in order to build a whole table I would need to
>know all the kerning pairs in a font, or brute-force check all
>combinations :)
Yes, current FreeType2 does not provide the functions
like Win32 GetKerningPairs(). I think, such functions
require large memory allocation to load whole of kern
subtable. Due to memory alignment and byte order (Win32
struct KERNINGPAIR looks native byte order - the size
and byte order is exactly same among all platforms?),
passing the pointer to the memory image of kern subtable
is not enough. We have to rewrite all entries explicitly.
My propose is writing a simple function to: pickup file
stream or memory image from font object loaded by FreeType,
allocate memory to store converted kern subtable, and
convert the entries internally (without kern table handler
of FreeType2). By conversion without FreeType, the conversion
time can be minimized. BTW, if kern table has multiple
subtables, how WIN32 API choose the "best" subtable?
The device context is used?
There are a "cross-platform" issue to discuss. Microsoft
supports kern subtable format 0 only, but there are two
dialects in format 0: Microsoft and Apple. For detail,
please check freetype2/src/gxvalid/README in latest CVS
version of freetype2, or viewCVS:
http://cvs.savannah.nongnu.org/viewcvs/freetype2/src/gxvalid/README?rev=1.2&root=freetype&view=markup
In the rendering procedure, FreeType2 supports horizontal
kerning in Microsoft dialect only. For example, FreeType2
does not count the number of entries in vertical kerning
table, even in Microsoft dialect. Other formats (Apple
dialect, new formats 1, 2, 3) are not used at all. It it
expected behaviour? I think some people want WINE to run
on MacOS X, with TrueType fonts bundled to MacOS X.
Regards,
mpsuzuki