[XeTeX] Coloured fonts

David Carlisle d.p.carlisle at gmail.com
Thu Mar 18 21:17:59 CET 2021


Not sure if xetex can do colour fonts currently, You can always experiment
with luatex which gets this if using harfbuzz

[image: image.png]

\documentclass{article}

\usepackage{fontspec}

\newfontfamily\chess[Renderer=HarfBuzz]{BabelStoneXiangqiColour.ttf}
\begin{document}

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

\end{document}



On Thu, 18 Mar 2021 at 18:39, Philip Taylor <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
> \pieces
> \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}
> \end
>
> --
> *Philip Taylor*
>
> This email, its contents and any attachments are intended solely for the
> addressee and may contain confidential information. In certain
> circumstances, it may also be subject to legal privilege. Any unauthorised
> use, disclosure, or copying is not permitted. If you have received this
> email in error, please notify us and immediately and permanently delete it.
> Any views or opinions expressed in personal emails are solely those of the
> author and do not necessarily represent those of Royal Holloway, University
> of London. It is your responsibility to ensure that this email and any
> attachments are virus free.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/xetex/attachments/20210318/f933ab66/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 3690 bytes
Desc: not available
URL: <https://tug.org/pipermail/xetex/attachments/20210318/f933ab66/attachment-0001.png>


More information about the XeTeX mailing list.