[texhax] tex4ht .htf font files?

Nina Mazumdar nina.mazumdar at gmail.com
Mon Jul 14 07:00:44 CEST 2008


On Mon, Jul 14, 2008 at 2:02 AM, Henrik Frisk <frisk.h at gmail.com> wrote:

[...]

> For a fairly large project I need to produce both HTML and
> PostScript/PDF output. After much experimenting I finally decided to
> go with tex4ht for the LaTeX to HTML transformation. The problem I

That is the right way of making HTML from TeX sources. TeX4ht is a
highly configurable system than any other for this purpose.

> have is that I'm using Adobe Garamond and Adobe Frutiger as fonts and,
> with Garamond in particular, this creates issues with the translation
> (the ligatures don't get translated correctly). Watching the debug
> from tex4ht I can see it complains about not finding the .htf
> equivalents for these fonts. Unfortunately I can't seem to find
> information about what .htf is and how/if I can transform the font
> metrics files I have of Garamond and Frutiger.

.htf stands for hypertext font.  It is an ascii font table file in
which character codes are provided for a given font in ascending
order.  Each line of a htf file will have one character.  If you open
cmr.htf, you can easily understand what I meant. Eiten Gurari has
devised a poetic character substitution system with these *.htf files
while post-processing the *.dvi output with t4ht program which is also
part of TeX4ht bundle.

Although it is not difficult to create .htf fonts for garamond or
frutiger, it will be a non-trivial task for a newbie.

Your problem can be solved by removing the font loading commands from
your document.  You may use the default cmr fonts during translation
to HTML.  After all, html can easily be controlled by a .css and using
garamond in the LaTeX sources do not provide any particular advantage
except problems as above.

> The other, probably simpler option would be to have some kind of
> conditional inclusion of the two Adobe fonts - or rather conditional
> exclusion of the font directive. Something like (pseudo code):
>
> \iftex4ht
> \renewcommand{\rmdefault}{pad}
> \else
> \fi
>
> Though, this too will soon get quite complex. I define many style
> commands that I use that include these fonts. Any hints or suggestions
> would be most welcome.

If you are familiar with  gnu tools like make, makefile, things can
easily be done.  If you are in windows you can seek the help of
cygwin.  The procedure goes like this.

1. create a file namely, variable.tex, contents of which will look
like (or adjust as you might want):

-------------------- variable.tex --------------------------
\makeatletter
\@ifundefined{Status}{\gdef\Status{0}}{}
\makeatletter
\ifcase\Status %{0}
  \typeout{HTML output}
  \documentclass[<options>]{article} % or whatever
  %%% add any other packages or commands relevant to
  %%% html generation
%
 \or % Status = 1
   \typeout{PDF output}
   \documentclass[<options]{article}
   \usepackage{garamond}
   \usepackage{frutiger}
  %%% add any other packages or commands relevant to
  %%% PDF generation
\fi

------------------- End of variable.tex -------------------------

2. Your source document will not have the preamble part, instead it will have:

 \input variable.tex
 \begin[document}

3. Create makefile in the following fashion:

-------------------- makefile ---------------------

FILE=<your filename>
## do not use any extension, just provide the basefile name


html:
        htlatex $(FILE)

pdf:
        pdflatex '\def\Status{1}\input $(FILE)'

------------------ end of makefile ----------------


Now happily execute the following commands at the prompt:

for html:

    make html

for PDF

    make pdf

Hope this helps, if you have any doubts or problems, please get back to me.

Happy TeXing and best regards

-- 
Nina


More information about the texhax mailing list