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

Philipp Stephani st_philipp at yahoo.de
Thu Feb 4 22:15:57 CET 2010

Am 04.02.2010 um 17:57 schrieb Philip TAYLOR:

> François Charette wrote:
>> The terminal in Windows does not support Unicode. You can thus change
>> line 67-68 to:
>> print "The glyph $uni is available in the following fonts:\n";
>> to avoid the incorrect display of the glyph. Then you can also delete
>> line 23 with the binmode setting.
> Thank you : a definite improvement.  I tried to add SimHei
> as a CMD console font, but with zero success (I suspect
> CMD in XP is not Unicode-compatible), so I will just have
> to make do with hex values for now.

The Windows console is based on Unicode just like every other component of Windows. But you have to use WriteConsoleW to actually write UTF-16 strings to the console, and the console font must be an outline font that contains the character in question. Probably changing the legacy output codepage to UTF-8 (with SetConsoleCodepage) and then writing with WriteConsoleA or WriteFile will also work, but this is more complicated and several tools like "more" are known to fail if the codepage is set to UTF-8.

More information about the XeTeX mailing list