# tex4ht: what to do if a font is missing

I have just started to learn the features of the tex4ht tool. It is working with one exception: Compiling

\documentclass{scrartcl}
\usepackage{igo}
\usepackage[T1]{fontenc}
%%
\begin{document}
%%
\begin{minipage}[c][1.0\height][r]{0.5\textwidth}
\cleargoban\gobansize{19}\igofontsize{8}
\black{e3,e4,b4,a3,a4,d4,g3,g2,c4,d2}
\white{b1,b3,f2,e2,d3,c3,a2}
\copytogoban{1111}
\shortstack{\showgoban[a1,t11]}\par
\texttt{P-001 (C): Black plays}\par
\end{minipage}
\end{document}


with tex4ht I get the error message

[37m[STATUS]  [0mmake4ht: Conversion started
[37m[STATUS]  [0mmake4ht: Input file: mwe-igo.tex
--- warning --- Couldn't find font igowhitei8.htf' (char codes: 0--127)


Later the compiler tries to generate the font, but failed with e.g.

kpathsea: Running mktexpk --mfmode cx --bdpi 300 --mag 1+276/300 --dpi 576 igowhitei8
mktexpk: don't know how to create bitmap font for igowhitei8.
mktexpk: perhaps igowhitei8 is missing from the map file.


I have everything correctly installed and pdflatex is working without any error message. What also pop-up after the warning is the following (longer) message:

----------------------------------------------------
environment file
----------------------------------------------------
% unix/tex4ht.env (2019-03-07), generated from tex4ht-env.tex, and
% modified by hand for TeX Live (unix).
% Copyright 2009-2019 TeX Users Group
% Copyright 1997-2009 Eitan M. Gurari
..
%
tpath/tex/texmf/fonts/tfm/!


I have no /tex/texmf/fonts/tfm directory everything is installed in the usual ~/Library/texmf on my iMac. Looking around I found a discussion 1, which indicates that I have to change somewhere the directory remark. But how, if my guess is correct?

Finale remark: the igo is not part of TL, but can be found on CTAN 2. The Type1-Files one can get from 3

TeX4ht needs font mapping tables for all fonts that it encounters. They map characters from the font to Unicode characters. When such mapping is missing, it will show the error message you see.

For text fonts, we have helper tool for the creation of these mapping files, htfgen. But for more complicated fonts, like math or various picture based fonts, that don't have corresponding Unicode characters, the situation is more difficult, and the mapping needs to be done by hand.

In your example, the font provided by the igo package seems to be used only in pictures of the game board. This game board must be converted to a picture to keep its appearance. This conversion to picture is done by a DVI to picture converters, such as Dvipng or Dvisvgm. In that case, you don't need the mapping, you can just use a dummy .htf file that suppresses the error message.

You can create dummy .htf files with the following command:

for i in *.tfm; do echo ".lm-ec" > \${i%.*}.htf; done


If you want them to be available on your system, place these files to your local TEXMF tree, for example this path works on my system:

 ~/texmf/tex4ht/ht-fonts/unicode/igo/


I guess, that this path:

 ~/Library/texmf/tex4ht/ht-fonts/unicode/igo/


should work for you.

And to create a picture for the game board, use the following file, igo.4ht:

\NewConfigure{showgoban}{2}
\def\:tempa#1#2#3#4{\a:showgoban\o:igo@showgoban:{#1}{#2}{#3}{#4}\b:showgoban}
\HLet\igo@showgoban\:tempa

\Configure{showgoban}{\Picture*{}}{\EndPicture}

\Hinput{igo}


You can place this file to

~/Library/texmf/tex/generic/tex4ht/igo.4ht


It redefines the command used to print the board and calls the \Picture and \EndPicture commands to request conversion of the contained code to a picture. See TeX4ht documentation for more information about .4ht files. Place this file in the same directory as your document.

 make4ht -m draft mwe-igo.tex


This is the result:

• @michael.h21 OK, I will work on it. Aug 31, 2022 at 15:18
• Still a question: Where do I have to store the generated htf-files? And the calling steps are the following: name of the file igo.tex, latex igo,tex4ht igo.dvi? Aug 31, 2022 at 15:38
• The following message pops up: (igoblacki8.htf) Searching lm-ec.htf' for igoblacki8.htf' (/usr/local/texlive/2022/texmf-dist/tex4ht/ht-fonts/unicode/lm/lm-ec.htf) --- warning --- File lm-ec.htf' starts/ends with character code 255 (instead of 127) --- warning --- File lm-ec.htf' starts/ends with character code 255 (instead of 127)} Aug 31, 2022 at 15:49
• @Ulrich I've updated my answer with more details. You can ignore the warning about start/end character, it just means that the mapping file expects a different number of characters than what the font uses. Aug 31, 2022 at 18:22
• @michael.h21 Yes, everything is working. Great tool, great support. Sep 1, 2022 at 12:48

What I have done based on the last suggestion:

1. Creating igobl10.mf and igowh10.mf using the original mf-files from the igo package and generated the tfm etc. files.

2. Creating mwe-mf.tex :

    \documentclass{article}
\font\mybl=igobl10
\font\mywh=igowh10
\begin{document}
{\mybl \char0 \char10}
{\mywh \char1 \char10}
\end{document}


which is working properly.

1. Next step was the testing:
    \documentclass{article}
\input showfonts.4ht
\begin{document}
\showfonts
{igobl10}
{igowh10}
{}
\end{document}


The PDF-File showed the right glyphs. There has been error messages, that some characters are missing, e.g. Missing character: There is no ¡ in font igobl10!. But this is as expected. Here part of the PDF file

1. Then I run make4ht -m draft mwe-mf.tex and I got the error message (e.g.)
    --- warning --- Couldn't find font igowh10.htf (char codes: 0--127)

1. I generated the htf files igobl10.htf and igowh10.htf entering
    igobl10 0 127    <-- line 1
’’  ’1’          <-- line 2
’’  ’1’
’’  ’1’
...
’’  ’1’         <-- line 129
igobl10 0 127   <-- line 130


where line 2 until line 129 (= 127 - 0 + 1) contains the '' '1' and stored them in the same directory as the TeX-file

1. Now running make4htI get the error message
    --- warning --- Improper signature at start of file .htf'
--- warning --- File igowh10.htf' starts/ends with character code 0 (instead of 127)
igowh10 0 127
0:  ’’    ’1’
1:  ’’    ’1’
2:  ’’    ’1’
...
127:  ’’    ’1’
128:  igowh10  0 127--- error --- Improper file igowh10.htf'


If I commenting out the line {\mywh \char1 \char10} in my TeX-file I get

    [STATUS]  make4ht: Input file: mwe-mf.tex
--- warning --- Improper entry (line 0)
--- warning --- Improper entry (line 1)
....
--- warning --- Improper entry (line 125)
--- warning --- Improper entry (line 126)
igobl10 0 127
0:   ’’  ’1’
1:   ’’  ’1’
2:   ’’  ’1’
...
126:   ’’  ’1’
127:   ’’  ’1’
128:  igobl10 0 127--- error --- Improper file igobl10.htf'


Can you give me a hint what I am doing wrong?