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

Jonathan Kew jfkthame at googlemail.com
Fri Jan 29 08:19:44 CET 2010


On 29 Jan 2010, at 06:42, R (Chandra) Chandrasekhar wrote:

> Dear Folks,
> 
> Pardon me please if this question is naive.
> 
> I would like to use the Unicode character U+2605 Black Star in the Miscellaneous Symbols block, or lternatively, the character U+272A Circled White Star in the Dingbats block in a .tex file.
> 
> I have two questions:
> 
> 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?

I'll leave this for someone familiar with utilities available on Kubuntu. (To examine an individual font, you could open it with FontForge, or you could write a small xetex file using the \iffontchar primitive to check for the existence of the character. But I wouldn't consider that an efficient approach to finding suitable fonts, that's just checking them at random until you find one that works.)

> 
> 2. Once I have found a font supporting the desired symbol, how might I invoke this symbol in a .tex file to be processed by XeLaTeX? I am thinking along the lines of:
> 
> \newfontfamily{\myfont}[Script=????]{Font????}

No need for [Script=....]; this doesn't require a script-specific shaping engine.

> \newcommand{\pentagram}{\myfont ★}

You'll want to add braces for grouping, as in

    \newcommand{\pentagram}{{\myfont ★}}

so that the font change doesn't stay in effect for the following text.

JK




More information about the XeTeX mailing list