Menu

#2350 tex4ht doesn't find fonts in some folders

6050
fixed
tex4ht (3)
2016-09-07
2015-02-04
U_Fischer
No

tex4ht.env declares search pathes for font files (.htf, .4hf) and uses an exclamation symbol to denote subfolders. E.g.

 i/tex4ht/ht-fonts/unicode/!

It seems that the binary tex4ht.exe has problems to find the fonts if there are exactly one subfolder down.

As an example create a minimal hello world latex document:

\documentclass{article}
\begin{document}
Hallo Welt
\end{document}

and then run

 htlatex mtest "html"  " -cunihtf"

The tex4ht run will end with an "illegal storage address" error

tex4ht.c (2012-07-25-19:36 Windows MiKTeX)
tex4ht mtest
  -i/tex4ht/ht-fonts/
  -cunihtf
  -ewin32/tex4ht.env
(D:/MiKTeX2.9/tex4ht/base/win32/tex4ht.env)
(D:/MiKTeX2.9/fonts/tfm/public/cm/cmr10.tfm)
(D:/MiKTeX2.9/tex4ht/ht-fonts/alias/lm/lm-rep-cmrm/cmr.htf)
Searching `lm-rep-cmrm.htf' for `cmr10.htf'
(D:/MiKTeX2.9/tex4ht/ht-fonts/unicode/lm/lm-rep-cmrm.htf)
--- error --- Illegal storage address

Now move (or copy) the file ..\MiKTeX2.9\tex4ht\ht-fonts\unicode\charset\unicode.4hf one folder up to ..\MiKTeX2.9\tex4ht\ht-fonts\unicode\unicode.4hf or one folder down to ..\MiKTeX2.9\tex4ht\ht-fonts\unicode\charset\uni\unicode.4hf

then tex4ht finds the file and compiles successfully:

tex4ht.c (2012-07-25-19:36 Windows MiKTeX)
tex4ht mtest
  -i/tex4ht/ht-fonts/
  -cunihtf
  -ewin32/tex4ht.env
(D:/MiKTeX2.9/tex4ht/base/win32/tex4ht.env)
(D:/MiKTeX2.9/tex4ht/ht-fonts/unicode/charset/uni/unicode.4hf) <--- there
(D:/MiKTeX2.9/fonts/tfm/public/cm/cmr10.tfm)
(D:/MiKTeX2.9/tex4ht/ht-fonts/alias/lm/lm-rep-cmrm/cmr.htf)
Searching `lm-rep-cmrm.htf' for `cmr10.htf'
(D:/MiKTeX2.9/tex4ht/ht-fonts/unicode/lm/lm-rep-cmrm.htf)
[1 file mtest.html
 file mtest.css
 file mtest.tmp
]
Execute script `mtest.lg'

Adding the "charset" folder to the search path either in tex4ht.env or in the htlatex call works too:

 htlatex mtest "html"  "unicode/charset -cunihtf"

TeXLive uses the same locations to store the files but there everything compiles fine.

Discussion

  • Christian Schenk

    • labels: --> tex4ht
    • status: open --> in-the-works
    • assigned_to: Christian Schenk
     
  • Christian Schenk

    Thanks, this has been resolved in the next tex4ht version which will be released in May.

     
  • Christian Schenk

    • status: in-the-works --> fixed
     
  • Mike

    Mike - 2016-08-03

    Unfortunately the problem seems still to persist. A simple file with umlauts compiled using
    make4ht test "xhtml,charset=utf-8" " -cunihtf -utf8"
    shows question marks instead of German umlauts.

    My current workaround was to copy the file
    unicode.4hf
    from
    C:\Program Files\MiKTeX 2.9\tex4ht\ht-fonts\unicode\charset
    to
    C:\Program Files\MiKTeX 2.9\tex4ht\ht-fonts\unicode\charset\uni
    which solved the problem.

    Here the MWE test.tex:

    \documentclass{article}
    \usepackage[utf8]{inputenc} %Files are encoded using UTF-8
    \usepackage[T1]{fontenc} %The text uses German umlauts
    \begin{document}
    A text with some „ÜÖÄüöäß“.
    \end{document}
    

    Output:
    A text with some „�������“.

     

    Last edit: Mike 2016-08-04
  • U_Fischer

    U_Fischer - 2016-08-03

    I can confirm that the problem persists.

    Remark: there exists a second unicode.4ht in /tex4ht/ht-fonts/iso8859/1/charset/uni/unicode.4hf. In my tests this is currently found but it leads to 8-bit encoded umlauts and so to the question marks in Mike's report. If one remove this unicode.4hf or moves it up one folder then one get again Illegal storage address error from the original bug report. If both unicode.4hf are in /charset/uni/ the correct one in unicode/charset/uni is found and everything is fine.

     
  • Christian Schenk

    • status: fixed --> open
    • Milestone: --> None
     
  • Mike

    Mike - 2016-08-04

    BTW: As mentioned by Michal Hoftich on Stack Exchange if using make4ht with the -u option it calls tex4ht with the -cmozhtf option. Then tex4ht is actually supposed to look for unicode.4hf in ht-fonts/mozilla/charset/ directory but fails to find it there too. So it is a general problem.

     
  • Christian Schenk

    • status: open --> in-the-works
    • Milestone: None --> 6050
     
  • Christian Schenk

    The file tex4ht.ini (in directory miktex/config) contains wrong path definitions. I think it is safe to remove this file.

     
  • U_Fischer

    U_Fischer - 2016-08-04

    texmf.cnf from texlive contains similar settings:

    ~~~~
    T4HTINPUTS = .;$TEXMF/tex4ht//

    %% t4ht utility, sharing files with TeX4ht
    TEX4HTFONTSET=alias,iso8859,unicode
    TEX4HTINPUTS = .;$TEXMF/tex4ht/base//;$TEXMF/tex4ht/ht-fonts/{$TEX4HTFONTSET}//
    ~~~~

    so imho they can't be completly wrong.

     
  • Christian Schenk

    Maybe TL TEX4HTINPUTS is a fallback, if tex4ht.env does not exist or if it does not contain a <xxx> section (where xxx is the -c switch value).

     
  • U_Fischer

    U_Fischer - 2016-08-07

    Hm. I did run some tests, and really looks as if the search path in tex4ht.ini are sometimes used as fallback and so lead to the wrong unicode.4ht. But I can't understand why some combinations of file locations and .env entries fails. There is no obvious pattern

    E.g. this combination of location and env-entry fails

     ..tex4ht/ht-fonts/unicode/charset/unicode.4ht
    
     i/tex4ht/ht-fonts/unicode/!
    

    but this all works

      ..tex4ht/ht-fonts/unicode/charset/unicode.4ht
    
     i/tex4ht/ht-fonts/unicode/charset!
    
      ..tex4ht/ht-fonts/unicode/charset/uni/unicode.4ht
    
     i/tex4ht/ht-fonts/unicode/!
    

    So it is not a simple "! doesn't search subfolders".

     
  • Christian Schenk

    • Status: in-the-works --> fixed