# Xskak and xetex: alternative font

Good day. It's a second week I can't solve the problem. I have a font ChessSanPin, installed in my system (Ubuntu). Xetex uses it well itself (using fontspec). For example:

But if I try to use it with Xskak package, I've get a warning

LaTeX Font Warning: Font shape LSB/ChessSanPin/m/n' undefined (Font) usingLSB/skaknew/m/n' instead on input line 19.

1 (./chess.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

and default font skaknew is used.

Document source:

\documentclass{book}
\usepackage{xskak}

\begin{document}

\setboardfontfamily{ChessSanPin}

\newcommand\testboard{{%
\boardfont
\noindent
rmblkans\\
opopopop\\
0Z0Z0Z0Z\\
Z0Zqj0Z0\\
0Z0LKZ0Z\\
Z0Z0Z0Z0\\
POPOPOPO\\
SNAQJBMR\par}}
\testboard

\end{document}


And I can't understand, is there a problem of a font, of a document or some other.

Could you help me, please, to make it work?

• If it is a type1 font it should be possible, but it involves some work. Is the font freely available somewhere? – Ulrike Fischer Oct 19 '16 at 12:08
• It is a postcsript commercial font, so I can't upload it anywhere. – Mike Oct 19 '16 at 12:15
• You can find in the chessfss documentation some explanations about the steps to use such a font. – Ulrike Fischer Oct 19 '16 at 12:17
• I've found it, but it doesnt help. I hope, there is someone, who has an experience in using alternative fonts in xskak and xetex. – Mike Oct 19 '16 at 12:24
• Well I do have experience. After all I wrote chessfss, and I created the enpassant package but to create the needed installation files one needs at least the name of the font and the .afm (for the encoding vector and the tfm-file) and if possible also the pfb for the tests. – Ulrike Fischer Oct 19 '16 at 12:33

Try this:

Put the afm and the pfb of your font in some empty test folder. Open a command line there and run

  afm2tfm ChessSanPin


this should create a tfm. (You could also create the tfm with fontforge).

Then create a test document in the same folder with the tfm with this content:

\documentclass{article}

\usepackage{xskak}
\usepackage{filecontents}
\begin{filecontents}{lsbchesssanpin.fd}
\ProvidesFile{lsbchesssanpin.fd}
[2016/10/20 v1.0 Chess font definitions]

\DeclareFontFamily{LSB}{chesssanpin}{}
\DeclareFontShape{LSB}{chesssanpin}{m}{n}{<-> ChessSanPin}{}
\end{filecontents}

\pdfmapline{=ChessSanPin ChessSanPin <ChessSanPin.pfb}
\setboardfontfamily{chesssanpin}

\begin{document}
\newchessgame
\chessboard

\end{document}


Compile it with pdflatex (not xelatex). If it works come back and I will tell you how to create the correct map entry for xelatex.

If you are on linux be carefull with the uppercase/lowercase in the file names.

• Yes, it works! s008.radikal.ru/i303/1610/be/20243de3441b.png – Mike Oct 20 '16 at 10:32
• Which texsystem are you using? miktex or texlive? – Ulrike Fischer Oct 20 '16 at 10:38
• Texlive on ubuntu 15.04 – Mike Oct 20 '16 at 10:39
• Change the pdfmapfile line to \pdfmapline{chesssanpin default ChessSanPin}. Does this work for you with xelatex? – Ulrike Fischer Oct 20 '16 at 10:46
• PDF generated well – Mike Oct 20 '16 at 10:50