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

Michiel Kamermans pomax at nihongoresources.com
Sat Jan 30 18:15:46 CET 2010


> Little enhancements this morning: On OS X it defaults to searching in 
> /Library/Fonts; it sorts the output by font name. Anyone want it to do 
> anything else?
>

Be careful though: os.uname() is a *nix only function, so it's probably 
a good idea to try/except AttributeError for when this is run on 
windows, and falling back to os.environ['OS'] instead for the operating 
system check.

If it's run on windows with python natively installed, then 
os.environ['OS'].startswith('Windows')==true and the default path can 
fairly safely be set to "C:\Windows\Fonts". When run through a cygwin 
installation of python, os.uname won't throw an error and 
os.uname()[0].startswith('CYGWIN')==true, with the default font path 
being "cygdrive/c/windows/fonts".

Of course this won't work for people who install Windows on another 
drive, but I think we can safely assume that is the vast minority of 
windows users.

- Mike "Pomax" Kamermans
nihongoresources.com


More information about the XeTeX mailing list