[XeTeX] Coloured fonts

Ross Moore ross.moore at mq.edu.au
Thu Mar 18 21:34:25 CET 2021

Hi David, Philip.

On 19 Mar 2021, at 7:17 am, David Carlisle <d.p.carlisle at gmail.com<mailto:d.p.carlisle at gmail.com>> wrote:

Not sure if xetex can do colour fonts currently,

According to here:


there’s not many applications that do support this new technology.

The colour doesn’t show in Phil’s example PDF, neither in Adobe’s  Illustrator, nor Acrobat Pro,
despite Adobe being one of the instigators of this font format.
So presumably the font isn’t installed correctly into the PDF.

Presumably the  /Style  dictionary here:

9 0 obj
/Descent -173
/StemV 87
/Ascent 631
/FontName /THVNSG+BabelStoneXiangqiColour
/ItalicAngle 0
/Panose <080002020604010101010101>
/AvgWidth 734
/FontBBox [-14 -232 1014 795]
/Type /FontDescriptor
/CIDSet 16 0 R
/CapHeight 631
/Flags 4
/FontFile2 17 0 R

is where the colour is specified, by that /Panose  entry.
But there must be something else that is missing.

Unfortunately the link to get the font doesn’t work for me.

[cid:4B73A63B-0EAF-4379-91AC-6674DBBF5B27 at modem]

So David, could you possibly send the PDF of the example you posted below, please?

You can always experiment with luatex which gets this if using harfbuzz





testing {\chess ^^^^^^01fa64}


On Thu, 18 Mar 2021 at 18:39, Philip Taylor <P.Taylor at rhul.ac.uk<mailto:P.Taylor at rhul.ac.uk>> wrote:
Seeking to re-typeset a long out-of-print classic on Xiang-Qi ("Chinese Chess"), but with the pieces shewn as they really are rather than as upper-case Latin letters requiring a gloss (the presentation chosen by the original author), I downloaded and installed Andrew West's BabelStone Xiangqi Colour font<https://www.babelstone.co.uk/Fonts/Xiangqi.html>.  I then wrote a short piece of XeTeX code to check that the glyphs/pieces appear in the PDF as they should, and very sadly they do not, coming out as monochrome rather than in colour (see attached PDF).

The red pieces are described by Andrew as red Chinese characters on a sandy yellow background, and the black pieces as black Chinese characters on a sandy yellow background.  In the resulting PDF, however, they appear as white Hanzi on a black ground and black Hanzi on a white ground.  Does XeTeX support coloured fonts, and if so, how do I persuade it to render these glyphs as intended rather than in monochrome ?

I can, of course, load \font \redpieces = "BabelStone Xiangqi Colour":color=FF0000 scaled \magstep 5 (see code below), but that still does not give me the sandy yellow ground that each glyph was designed to have.

'opentype-info.tex', when run against BabelStone Xiangqi Colour, tells me that the font does not provide any Opentype layout features, so it does not look as if XeTeX's "/ICU:+abcd" convention would allow me to indicate that I require colour support.

% !TeX Program=XeTeX

\font \pieces = "BabelStone Xiangqi Colour" scaled \magstep 5
\font \redpieces = "BabelStone Xiangqi Colour":color=FF0000 scaled \magstep 5
\font \blackpieces = "BabelStone Xiangqi Colour" scaled \magstep 5
\centerline {\char "1FA60\relax \ \char "1FA61\relax \ \char "1FA62\relax \ \char "1FA63\relax \ \char "1FA64\relax \ \char "1FA65\relax \ \char "1FA66\relax}
\centerline {\strut}
\centerline {\char "1FA67\relax \ \char "1FA68\relax \ \char "1FA69\relax \ \char "1FA6A\relax \ \char "1FA6B\relax \ \char "1FA6C\relax \ \char "1FA6D\relax}
\centerline {\strut}
\centerline {\strut}
\centerline {\redpieces \char "1FA60\relax \ \char "1FA61\relax \ \char "1FA62\relax \ \char "1FA63\relax \ \char "1FA64\relax \ \char "1FA65\relax \ \char "1FA66\relax}
\centerline {\strut}
\centerline {\blackpieces \char "1FA67\relax \ \char "1FA68\relax \ \char "1FA69\relax \ \char "1FA6A\relax \ \char "1FA6B\relax \ \char "1FA6C\relax \ \char "1FA6D\relax}
Philip Taylor



Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>
[cid:image001.png at 01D030BE.D37A46F0]
CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. <http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/xetex/attachments/20210318/3f360a95/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2021-03-19 at 7.28.37 am.png
Type: image/png
Size: 47293 bytes
Desc: Screen Shot 2021-03-19 at 7.28.37 am.png
URL: <https://tug.org/pipermail/xetex/attachments/20210318/3f360a95/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <https://tug.org/pipermail/xetex/attachments/20210318/3f360a95/attachment-0003.png>

More information about the XeTeX mailing list.