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. Use the package parameter ‘ShowFont’, in \usepackage or \Preamble, and produce a character map with a script similar to

   \font\x=ectt1000 \ShowFont\x

   Example
   \documentclass{article}
   \usepackage[T1]{fontenc}
   \usepackage[html,ShowFont,3]{tex4ht}
   \begin{document}
   \def\z{\HAssign\n=0 \y}
   \def\y{\ifnum \n<256 \HCode{<br />}\n{} {\x\char\n}
   \HAdvance\n by 1 \expandafter\y\fi}
   \section{eccc} \font\x=eccc1000 \ShowFont\x \z
   \section{ecss} \font\x=ecss1000 \ShowFont\x \z
   \section{ecsx} \font\x=ecsx1200 \ShowFont\x \z
   \section{ecti} \font\x=ecti1000 \ShowFont\x \z
   \section{ectt} \font\x=ectt1000 \ShowFont\x \z
   \end{document}

   Compiling the above file will provide some garbage, besides the character maps, as long as the htf fonts are missing.

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.

Example
cmmi 0 127
'G' '1'Gamma 0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'D' '1'Delta 1 % cmmi.htf 2 Nov 1997%
'Q' '1'Theta 2 % by Eitan M. Gurari %
'/\\' '1'Lambda 3 % gurari@cis.ohio-state.edu %
'E' '1'Xi 4 % http://www.cis.ohio-state.edu/~gurari%
'TT' '1'Pi 5 % %
'S' '1'Sigma 6 % Please remove this comment if you %
'U' '1'Upsilon 7 % modify the file. %
'P' '1'Phi 8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'Y' '1'Psi 9
'_O_' '1'Omega 10
'a' '1'alpha 11
'b' '3'beta 12
'g' '1'gamma 13
'd' '1'delta' 14
'e' '1'epsilon' 15
'z' '3'zeta 16
'j' '3'eta 17
'h' '1'theta 18
'i' '1'iota 19
'k' '1'kappa 20
'c' '1'lambda 21
'm' '3'mu 22
'n' '1'nu 23
'q' '3'xi 24
'p' '1'pi 25
'r' '3'rho 26
's' '1'sigma 27
't' '1'tau 28
'v' '1'upsilon 29
'f' '1'phi 30
'x' '1'chi 31
'y' '1'psi 32
'w' '1'omega 33
'e' '1'varepsilon 34
'h' '1'vartheta 35
'p' '1'varpi 36
'r' '3'varrho 37
'z' '3'varzeta 38
'f' '3'varphi 39
*'_* *1*leftharpoonup 40
',_' '1'leftharpoondown 41
*_'* *1*righttharpoonup 42
'-,' '1'rightharpoondown 43
'' '' 44
'' '' 45
'|\\' '1'triangleright 46
'/|' '1'triangleleft 47
'0' '' 48
'1' '' 49
'2' '' 50
'3' '' 51
'4' '' 52
'5' '' 53
'6' '' 54
'7' '' 55
'8' '' 56
'9' '' 57
'.' '' 58
',' '' 59
'&lt;' '' 60
'/' '' 61
'&gt;' '' 62
'*' '' 63
'@' '1'partial 64
'A' '' 65
'B' '' 66
'C' '' 67
'D' '' 68
'E' '' 69
'F' '' 70
'G' '' 71
'H' '' 72
'I' '' 73
'J' '' 74
'K' '' 75
'L' '' 76
'M' '' 77
'N' '' 78
'O' '' 79
'P' '' 80
'Q' '' 81
'R' '' 82
'S' '' 83
'T' '' 84
'U' '' 85
'V' '' 86
'W' '' 87
'X' '' 88
'Y' '' 89
'Z' '' 90
'b' '1'flat 91
'H' '3'natural 92
'#' '1'sharp 93
'~' '1'smile 94
'^' '1'frown 95
'l' '1'el 96
'a' '' 97
'b' '' 98
'c' '' 99
'd' '' 100
'e' '' 101
'f' '' 102
'g' '' 103
'h' '' 104
'i' '' 105
'j' '' 106
'k' '' 107
'l' '' 108
'm' '' 109
'n' '' 110
'o' '' 111
'p' '' 112
'q' '' 113
'r' '' 114
's' '' 115
't' '' 116
'u' '' 117
'v' '' 118
'w' '' 119
'x' '' 120
'y' '' 121
'z' '' 122
'i' '' 123
'j' '' 124
'p' '3'wp 125
'' '' 126
'' '' 127
cmmi 0 127
htfcss: cmmi color: green;
htfcss: font-family: cursive;

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