# [lltx] Reencode chessfonts with luaoftload

Ulrike Fischer news3 at nililand.de
Mon Oct 25 11:51:45 CEST 2010

Hello,

I'm currently a bit playing around with the idea to add some support
in the chessfss package for system fonts.

Chess fonts are highly unstandard. The different authors of the
fonts did put the chars quite randomly in the character table and
also used various glyphs name. So in the psfonts.map almost every
font has its own encoding vector:

chess-pirat-lsf ChessFigurinePirat " ChessPiratFigEncoding
ReEncodeFont " <chess-pirat-fig.enc <chess-pirat-fig-raw.pfb

So to be able to use ttf-fonts etc directly I must reencode the
fonts (without changing the original fonts).

I was able to substitute glyphs with a .fea-file:

feature renc {
substitute K by c140;
} renc;

and use this in this way:

\documentclass{article}

\begin{document}
\font\test={name:Chess Figurine Pirat}
\test \fbox{K}

\font\test={name:Chess Figurine
Pirat:featurefile=testsubs.fea;+renc}
\test \fbox{K}
\end{document}

Before continuing on this way I have some questions:

1. Is using a .fea-file to reencode a font the right idea?

2. Which name should I use for the feature? Is "renc" ok or can this
give trouble somewhere?

3. The pirat font (http://www.enpassant.dk/chess/downl/pirat.zip)
used above shows already some on the problems of the project: The
font seems to have a text font as base. To get slots for the chess
symbols it has moved some of the chars backward. Now the king (glyph
name c140) is on position 140, the position of å, the å is on
position 229 (Å), luaotfload seems to haved realized this, the
temp-lua-file of the font contains  c140={ 229, 140 } and my
substituation rule gets me an "å" instead of the King I want. How
can I correct to rule?

4. Can I somehow tell luaotfload to always regenerate the
temp-font.lua files during my tests?

5. Is there some code around which generates like (nfssfont.tex) a
neat font table of a ttf-font?

6. The font Alfonso
(http://www.enpassant.dk/chess/downl/alfonso.zip) gives an error
message. Probably the font is faulty somehow (I wouldn't be
surprised) but perhaps it also indicates a hidden bug, so I'm
mentioning it:

\documentclass{article}

\begin{document}
\font\test={name:Chess Alfonso-X}
\test \fbox{K}
\end{document}

! LuaTeX error