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

Peter Baker psb6m at virginia.edu
Fri Jan 29 20:18:12 CET 2010


R (Chandra) Chandrasekhar wrote:
>
>
> 1. How might I find out if a chosen font does indeed provide this 
> symbol? I am on Kubuntu 9.10 and have kcharselect and gucharmap, but 
> do not know of an efficient way of finding this out. Are there any 
> utilities to do this efficiently?
>
This kind of question seems to me to come up pretty regularly on this 
list. I don't know about kcharselect, but gucharmap is a poor tool for 
this purpose, since you can't tell it to look *only* in a particular 
font; it just silently substitutes whatever it can find in the system.

I thought I'd try to come up with a rough-and-ready script that would 
search a directory tree for fonts containing a particular glyph. To use 
this you need FontForge (with its python bindings): on Mac, Ubuntu and 
most other Linuxes I believe the standard FontForge package should give 
you what you need. You need to have the "find" utility on the system, so 
Linux and Mac should both work fine.

Just copy this script to some place convenient (maybe /usr/local/bin), 
make it executable, and invoke it like this

fontswith [path] glyph

[path] is the place to start looking: default is /usr/share/fonts. glyph 
is either a glyphname (e.g. A, Edieresis) or a Unicode value in the form 
U+2605. Fonts containing the glyph should be printed on stdout.

To keep from being distracted by warning messages from FontForge, stderr 
is captured and errors are printed on stdout. Kludgy! But as I said, the 
script is rough-and-ready.

In case attachments aren't allowed on this list, I've also posted the 
script here: http://faculty.virginia.edu/OldEnglish/fontswith/fontswith.zip.

Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fontswith.zip
Type: application/zip
Size: 1074 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20100129/c0929cfa/attachment.zip>


More information about the XeTeX mailing list