psb1558 / Cerne-font

A font based on the script of the ninth-century Book of Cerne
SIL Open Font License 1.1
30 stars 0 forks source link

Discussion option? #1

Open jsbien opened 3 years ago

jsbien commented 3 years ago

Hi! What about switching on the discussion option? I have some questions about using the font in XeLaTeX (the color doesn't work out of the box).

psb1558 commented 3 years ago

Sorry I've been a bit out of touch. I'd rather not turn on discussion, since traffic there would be almost nonexistent. I think it would be appropriate to discuss it here.

A preliminary remark: I haven't been able to find any indication that TeX supports color fonts at all. (The issue is difficult to search because search engines can't easily distinguish between "color fonts in TeX" and (say) "changing the color of fonts in TeX.") One could ask an expert, I suppose. Someone may have something in progress, but you know about the pace of development in the TeX world.

Probably the solution for TeX would be to create a layered font. That's actually a small set of fonts, one for each color. You have to double-print, positioning one exactly on top of the other(s) and set the colors manually. Obviously more difficult to use than a COLR/CPAL or SVG font, but you get a little more flexibility (you can choose your own colors).

Years ago I created a (sort of) layer font to accompany my Eadui font. Once the font was done, it turned out to be not terribly difficult to use in LaTeX, by creating a command that used \llap (with three parameters, one for the text and two for colors):

\newcommand{\filltext}[3]{{\fontspec{EaduiFill}\color{#1}#3}%
\llap{\fontspec{Eadui}\color{#2}#3}}

At any rate, if there's any interest in layer fonts for Cerne, I'll be glad to create them.

jsbien commented 3 years ago

I wanted to use it just for fun, so it is not an important question for me. I found a quite recent (March) thread about BabelStone Xiangqi Colour font on the XeTeX list. If I understand correctly, LuaTeX should be able to handle it. I will try to adapt the Xiangqi Colour example and let you know.

jsbien commented 3 years ago

Do you see the colors in the enclosed PDF? I do not not. Update: just a stupid mistake of mine.

psb1558 commented 3 years ago

I don't either. Was it supposed to be Cerne? The only font in it is Computer Modern. Programs that don't know about color fonts are supposed to treat it like a conventional font, but who knows? It looks like LuaTeX is substituting a default font for one that confuses it.

Lua is generally out front. If any TeX flavor supports color fonts, it will.

jsbien commented 3 years ago

It works! However at the moment luahbtex is available only in Debian testing. luahbtex.zip

psb1558 commented 3 years ago

Excellent! Wha's in testing now will be in release a little way down the road—and the good thing about the slow TeX development pipeline is that things tend to actually work.