Question about unicode ranges in X fonts (TrueType)

Alan Coopersmith Alan.Coopersmith at Sun.COM
Thu Jan 21 13:12:34 PST 2010


Shaun Lippy wrote:
> I am working on an application that requires knowledge of the precise
> ranges of Unicode characters supported by a font, specifically a
> TrueType font.  This information is stored in the OS/2 table of the
> TrueType font.  Is there any way, through X, to get access to this
> information?  For our Windows product, I simply call GetFontData to
> return me the OS/2 table, which I can then parse to get the required
> information.  It looks like the min_char_or_byte2 and max_char_or_byte2
> fields tell me the first and last character of a range, but what if I
> have, for example, an Arabic font which has many characters in a "lower"
> range (0x0600-0x06FF) and several in a much "higher" range (the Arabic
> Presentation Forms, 0xFB50-0xFDFF); this font doesn't, of course, have
> all the characters between 0x0600 and 0xFDFF, so the min and max fields
> won't help.
> 
> Thanks for any tips.  In lieu of help from X, if such help doesn't
> exist, can anybody suggest ideas for gaining access to the physical font
> that X is using so that I can parse the font myself?  That is, if I have
> an XLFD returned from XListFonts, is there a call I can make to tell me
> exactly where the font described by the XLFD exists on the system?

I believe this is the sort of thing fontconfig is designed to do
(see http://www.fontconfig.org/ for details) - it's what most modern X
GUI's use to find fonts that they then draw via libXft/pango/cairo/gtk/qt/etc.

XLFD's and the old X font system have fallen out of use in most modern
software, since it doesn't have all the features of the modern replacements,
such as anti-aliased text support, or support for all the complex layout
operations performed by libraries such as pango that are needed for some
languages.

-- 
	-Alan Coopersmith-           alan.coopersmith at sun.com
	 Sun Microsystems, Inc. - X Window System Engineering




More information about the xorg mailing list