[XeTeX] Finding out if a font supports a particular Unicode character and using it

Peter Baker psb6m at virginia.edu
Tue Feb 2 14:00:13 CET 2010


Taco Hoekwater wrote:
>
> In fact, now that I think about it: you may have better luck building
> a tool based on texlua. For a simple (non-cid) font, you can get a list
> of unicode characters like so:
>
>   f = fontloader.open(arg[1])
>   l = fontloader.to_table(f)
>   for _,v in pairs(l.glyphs) do
>     print (v.name .. ' ' .. v.unicode)
>   end
>
> just save in a file (fontcharinfo.lua) and run
>
>   $ texlua fontcharinfo.lua <fontfilename>
>
Perhaps so. There are probably several ways to index a collection of 
fonts. FontForge is a tool I know well, so it's what I've used, and I've 
got to say it's worked out pretty well, though Chris has obviously run 
into a problem (which I can't reproduce) indexing a very large font on a 
rather old (PIII) system.

It took me a few hours to write 334 lines of Python code that will 
reliably tell you what fonts on your system contain a particular glyph. 
I'm just an English professor, not a programmer: many people could do 
this better, and perhaps someone ought to do it.

Peter



More information about the XeTeX mailing list