[XeTeX] Coloured fonts

Adam Twardoch (Lists) list.adam at twardoch.com
Fri Mar 19 17:47:23 CET 2021


I'll add something:

The new OpenType extensions (variable CFF2, variable TTF, color SVG, color
COLR, color sbix, color CBDT) are not supported natively in PDF or
PostScript.

So when a printer driver creates the PDF/PS, it needs to convert the font
to something.

Generally there are two scenarios for SVG, sbix and CBDT color fonts:

1. A printer driver may convert the color font to Type 3, a PostScript
technology that allows using bitmaps and arbitrary vector drawings
(actually arbitrary PostScript code). However, this may be challenging as
most PDF renderers don't support all of Type 3.

2. A printer driver may convert the color font into a traditional Type 1 or
CFF font that has blank glyphs (so the glyphs have the right width but they
have no outlines), and then place the glyph content "underneath" the text,
as graphics.

For color COLR fonts, it's possible too represent them natively in PDF/PS,
because those fonts are layered fonts — traditional PS/TT glyphs are
stacked over each other, and each layer is colored/filled separately.

In any case, apps that create PS or PDF need to be extended to specifically
support the color OpenType font formats.

A.

On Fri, 19 Mar 2021 at 13:34, Paul A Norman <paul.a.norman at gmail.com> wrote:

> Thanks Jonathan,
>
> Absolutely correct.
> Ross's link covers the previously competing technologies for this (which
> are still around), and much the same can apply to any of them depending on
> how things are processed right through to end product.
>
> Paul
>
> On Fri, 19 Mar 2021 at 13:57, Jonathan Kew <jfkthame at gmail.com> wrote:
>
>> On 18/03/2021 23:50, Paul A. Norman wrote:
>> > If a pdf (pre)viewer component is not coded to do it by itself, the
>> > underlying operating system may be called to do the rendering.
>> >
>> > As per link in Ross More's posting, that may mean sometimes that a
>> > minimum of:
>> > macOS 10.14+, iOS 12+, Windows 10+
>> > – is required.
>> >
>> > It's one thing to get it showing in a pdf, it's quite another sometimes
>> > to get it into print ...
>> >
>> > "OpenType SVG Fonts in Print: Known Issues and Recommendations
>> > by Laura Baker
>> >
>> > "OpenType SVG (scalable vector graphics) fonts are nothing new.
>> > Initially intended for web-based design, OpenType SVG fonts are
>> > beginning to appear in printed works and are causing concern in the
>> > printing industry among designers, publishers, printers, and software
>> > companies alike.
>> > ..."
>>
>> It's perhaps worth pointing out, though, that the colour font Philip is
>> trying to use is *not* an OpenType-SVG font; it's a layered colour font
>> using the Microsoft-originated COLR and CPAL tables. This is a quite
>> different technology, and tools/documentation regarding the SVG table
>> are not relevant to it.
>>
>> JK
>>
>> >
>> > Here's a workout for anyone interested, as it also has tools for
>> > outputting the SVG table and so for inspection of the colour 'glyphs'
>> > directly if necessary for some fonts ...
>> >
>> > "Tools and sample files for making OpenType-SVG fonts"
>> >
>> > MIT License
>> >
>> > addsvg – adds an SVG table to a font, using SVG files provided. The
>> > font's format can be either OpenType or TrueType.
>> >
>> > dumpsvg – saves the contents of a font's SVG table as individual SVG
>> > files. The font's format can be either OpenType, TrueType, WOFF, or
>> WOFF2.
>> >
>> > fonts2svg – generates a set of SVG glyph files from one or more fonts
>> > and hex colors for each of them. The fonts' format can be either
>> > OpenType, TrueType, WOFF, or WOFF2.
>> >
>> > With process instructions under —
>> >
>> > "How to make OpenType-SVG fonts?"
>> >
>> > https://github.com/adobe-type-tools/opentype-svg
>> > <https://github.com/adobe-type-tools/opentype-svg>
>> > ------------------------------------------------------------------------
>> > http://PaulANorman.info <http://PaulANorman.info>
>> >
>> >
>> > On March 19, 2021 10:44:57 AM GMT+13:00, Philip Taylor
>> > <P.Taylor at Hellenic-Institute.Uk> wrote:
>> >
>> >     David Carlisle wrote:
>> >
>> >>     I see colour here in windows firefox, widows chrome  and xpdf
>> >>     using cygwin X
>> >>
>> >>     attached luahbtex file and result
>> >>
>> >>     in Chrome it looks like this
>> >>
>> >>     image.png
>> >>
>> >>
>> >
>> >     OK, so it could be the TeXworks previewer that is failing to shew
>> >     the colour.  But to get your plain LuaTeX code to work, and not
>> >     report a missing font, I had to remove the ".ttf" extension :
>> >
>> >     % !TeX Program=LuaTeX
>> >
>> >     \magnification 900
>> >
>> >     \input luaotfload.sty
>> >
>> >     \font \bodyfont = "Minion Pro"
>> >     \font \tenit = "MinionPro-IT"
>> >     \font \smallcaps = "Minion Pro/ICU:+smcp"
>> >     \font \oldstyle = "Minion Pro/ICU:+onum"
>> >     \relax
>> >     \font \pieces = "BabelStoneXiangqiColour:mode=harf"
>> >     \relax
>> >     \pagewidth = 35 true pc
>> >     \pageheight = 59 true pc
>> >     \hsize = 25 true pc
>> >     \advance \hoffset by -1 true in
>> >     \advance \voffset by -1 true in
>> >     \advance \hoffset by 5 pc
>> >     \advance \voffset by 13 true pc
>> >     \pretolerance = 9999
>> >     \spaceskip = 0,333 em plus 0,3 em minus 0,1 em
>> >     \xspaceskip = 1 em plus 0,3 em minus 0,1 em
>> >     \def \lineturn {\unskip {\parfillskip = 0 pt \endgraf
>> >     \noindent}\ignorespaces}
>> >     \def \ignore #1{}
>> >     \catcode `\“ = \active
>> >     \catcode `\” = \active
>> >     \catcode `\; = \active
>> >     \catcode `\: = \active
>> >     \def \Prespace #1{\def #1{$\;$\char `#1\relax}}
>> >     \def \prespace #1{\def #1{$\,$\char `#1\relax}}
>> >     \def \postspace #1{\def #1{\char `#1\relax $\,$}}
>> >     \prespace ”
>> >     \Prespace ;
>> >     \Prespace :
>> >     \postspace “
>> >     \bodyfont
>> >     \parskip = 0 pt
>> >
>> >     % snip
>> >
>> >     \pieces
>> >     \centerline {\char "1FA60\relax}
>> >     \centerline {🩠}
>> >
>> >     \end
>> >
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/xetex/attachments/20210319/810186c6/attachment.html>


More information about the XeTeX mailing list.