up

Designing Virtual Hypertext Fonts

  1. If you are creating a new htf font, scan the information TeX4ht issues in the log file of the compilation regarding the missing htf font. For instance,

    --- warning --- Couldn’t find font ‘ectt1000.htf’ (char codes: 0--255)

  2. Produce a document showing the character maps. Employ a script similar to the following one, using a standard compilation, say, for an output in PDF or PostScript.
    Example
             \documentclass{article} 
               \input showfonts.4ht 
             \begin{document} 
               \showfonts 
                  {eccc1000} 
                  {ecss1000} 
                  {ecsx1200} 
                  {ecti1000} 
                  {ectt1000} 
                  {} 
             \end{document} 
  3. Create htf fonts of the form
           first line:    prefix_of_font_name  first_index  last_index 
                          ............... 
                          ............... 
                          ............... 
                          ............... 
           last line:     prefix_of_font_name  first_index  last_index 

    where

    1. The first and last lines must agree on their content, with first_index and last_index being equal to the character codes mentioned in the message

      --- warning --- Couldn’t find font ‘....’ (char codes: first_index--last_index)

    2. The number of intermediate lines should equal

      (last_index) - (first_index) + 1.

      Each of these intermediate lines provides a representation for a corresponding character code.

      Example
                  ectt 0 255 
                  ’`’    ’’        0 
                  ’´’    ’’        1 
                  ’ˆ’    ’’        2 
                  ’~’           ’’        3 
                  .................. 
                  ’i’          ’1’       25 dotless i 
                  .................. 
                  ’’           ’’        255 
                  ectt 0 255 

    3. Each intermediate line consists of three fields

      string class comment

      The first two fields must be enclosed by a delimiter, determined by the first character in the line. The comment may be empty.

      A ‘class’ specified by an odd integer value asks for a pictorial character. An even integer number asks for a non-pictorial character, specified in the ‘string’ field. An empty class field is treated as a zero value.

      The manner the characters of the different classes are packaged, is determined by commands of the form ‘\Configure{htf}{class-number}...’. For instance,

         \Configure{htf}{0}{+}{<span\Hnewline 
            class="}{\%s}{-\%s}{x-x-\%d}{}{">}{</span>} 
         \Configure{htf}{1}{+}{<img\Hnewline 
            src="}{" alt="}{" class="}{\%s}{-\%d}{x-x-\%x}{" />} 
         \Configure{htf}{4}{+}{<small\Hnewline 
            class="}{}{}{}{}{small-caps">}{</small>} 
         \Configure{htf}{6}{+}{<u\Hnewline 
            class="}{}{}{}{}{underline">}{</u>} 

      When no special requirements are in place, it is advisable to use just the classes of 0 and 1.

    4. The ‘string’ field may include any sequence of characters, except for its delimiters. The backslash character ‘\’ acts there as an escaped character. It may act as a delimiter for a character code, or be followed by another backslash (that is, ‘\\’ represents the character ‘\’ ).
    5. In the string part, use ‘&lt;’ for the character ‘<’, ‘&gt;’ for ‘>’, and ‘&amp;’ for ‘&’;

  4. If you want specific information for a font, to be included in the .css file, add to the end of the file an entry consisting of the font name and the information in discourse. The two fields must be separated by space. The second field may span over more than one line; the extra lines must start with space. The lines of the entries must be prefixed with ‘htfcss: ’.

    If more than one entry applies for a given font, the first one is the only one that counts.

Note. It is highly recommended to set up fonts just of Unicode entries, and let TeX4ht automatically map the symbols to the appropriate character encodings (using unicode.4hf mapping files).

Instead of explicitly specifying the encodings for the characters, an htf font can be declared an alias to another htf font by specifying in the first line the aliased font name prepended by a period.

Example

cmss.htf

.cmti 
htfcss: cmss   font-family: sans-serif; 
htfcss: cmssbx font-weight: bold; 
htfcss: cmssi  font-style: italic; font-family: sans-serif; 

up


Generated August 24, 2020 - tex4ht home page