| 1 |
% \CheckSum{2502} |
| 2 |
% \iffalse meta-comment |
| 3 |
% |
| 4 |
% Copyright 1993, 1994, 1995, 1996 Alan Jeffrey, |
| 5 |
% hacked and maintained 1997, 1998 Sebastian Rahtz, |
| 6 |
% copyright 1998, 1999, 2000 the fontinst maintenance team and any |
| 7 |
% individual authors listed elsewhere in this file. All rights reserved. |
| 8 |
% |
| 9 |
% This file is part of the fontinst system version 1.9. |
| 10 |
% ----------------------------------------------------- |
| 11 |
% |
| 12 |
% It may be distributed under the terms of the LaTeX Project Public |
| 13 |
% License, as described in lppl.txt in the base LaTeX distribution. |
| 14 |
% Either version 1.1 or, at your option, any later version. |
| 15 |
% |
| 16 |
%%% From file: ficonv.dtx |
| 17 |
% |
| 18 |
%<*driver> |
| 19 |
\documentclass{ltxdoc} |
| 20 |
\usepackage{fisource} |
| 21 |
\title{The \package{fontinst} utility} |
| 22 |
\author{Alan Jeffrey, Sebastian Rahtz, Ulrik Vieth, Lars Hellstr\"om} |
| 23 |
\begin{document} |
| 24 |
\maketitle |
| 25 |
\tableofcontents |
| 26 |
\DocInput{ficonv.dtx} |
| 27 |
\end{document} |
| 28 |
%</driver> |
| 29 |
% \fi |
| 30 |
% |
| 31 |
% \StopEventually{} |
| 32 |
% |
| 33 |
% \section{Basic file format conversions} |
| 34 |
% \label{Sec:Conv. input} |
| 35 |
% \changes{1.902}{1999/05/01}{Collected the material in Section |
| 36 |
% \thesection\space and moved it to \texttt{ficonv.dtx}. (LH)} |
| 37 |
% \changes{1.926}{2003/07/12}{Added some missing \textasciitilde's |
| 38 |
% at ends of lines. (LH)} |
| 39 |
% |
| 40 |
% \subsection{Converting an ENC file to an ETX file} |
| 41 |
% |
| 42 |
% \DescribeMacro{\enctoetx} |
| 43 |
% The macro |
| 44 |
% \begin{quote} |
| 45 |
% |\enctoetx|\marg{encfile}\marg{etxfile} |
| 46 |
% \end{quote} |
| 47 |
% reads \meta{encfile}|.enc| and writes the same information to |
| 48 |
% \meta{etxfile}|.etx|, in a format \TeX{} can read more easily. |
| 49 |
% |
| 50 |
% |
| 51 |
% \begin{macrocode} |
| 52 |
%<*misc> |
| 53 |
\newif\ifmissingslots |
| 54 |
\x_cs\def{o-.notdef}#1{\global\missingslotstrue} |
| 55 |
% \end{macrocode} |
| 56 |
% |
| 57 |
% \begin{macro}{\enctoetx} |
| 58 |
% For every |/|\meta{glyph} command, the command |\o-|\meta{glyph} |
| 59 |
% gets passed code which writes the corresponding |
| 60 |
% |\setslot|\marg{glyph} \textellipsis\ |\endslot| statement. |
| 61 |
% Normally that constrol sequence is undefined, hence equivalent to |
| 62 |
% |\relax|, and thus the code gets executed. However |\o-.notdef| will |
| 63 |
% instead gobble this argument and set |missingslots| to true. |
| 64 |
% \begin{macrocode} |
| 65 |
{ |
| 66 |
\catcode`\/=\active |
| 67 |
\catcode`\]=\active |
| 68 |
\gdef\enctoetx#1#2{{ |
| 69 |
\catcode`\/=\active |
| 70 |
\catcode`\]=\active |
| 71 |
\def/##1[{ |
| 72 |
\encname_to_etx ##1~{#1}{#2} |
| 73 |
\a_count=0 |
| 74 |
\global\missingslotsfalse |
| 75 |
\let/=\encslot_to_etx |
| 76 |
} |
| 77 |
\def]~def{} |
| 78 |
\make_etx{#1}{#2} |
| 79 |
}} |
| 80 |
} |
| 81 |
% \end{macrocode} |
| 82 |
% \end{macro} |
| 83 |
% |
| 84 |
% \begin{macro}{\encname_to_etx} |
| 85 |
% This macro recieves the encoding vector name, the ENC file name, |
| 86 |
% and the ETX file name when converting an ENC file to an ETX file. |
| 87 |
% The call syntax is |
| 88 |
% \begin{quote} |
| 89 |
% |\encname_to_etx|\meta{vectorname}\textvisiblespace |
| 90 |
% \marg{enc}\marg{etx} |
| 91 |
% \end{quote} |
| 92 |
% (making the first argument space-delimited but the second |
| 93 |
% undelimited is a trick to gobble any space that may be present at |
| 94 |
% the end of that which the caller thinks is the vector name). |
| 95 |
% |
| 96 |
% The command outputs a |\declarepsencoding| command to the |
| 97 |
% generated ETX file. |
| 98 |
% \changes{1.931}{2005/05/13}{Macro added, to support caching |
| 99 |
% original ENC names in autogenerated ETX files. (LH) |
| 100 |
% Thanks to Alexej Kryukov for the inspiration for this.} |
| 101 |
% \begin{macrocode} |
| 102 |
\def\encname_to_etx#1~#2#3{ |
| 103 |
\out_line{\percent_char\space REMOVE~THE~FOLLOWING~LINE~IF~ |
| 104 |
THIS~FILE~IS~MODIFIED~OR~RENAMED.} |
| 105 |
\out_line{\string\declarepsencoding{#3}{#1}{\string\download{#2.enc}}} |
| 106 |
\out_line{} |
| 107 |
} |
| 108 |
% \end{macrocode} |
| 109 |
% \end{macro} |
| 110 |
% |
| 111 |
% \begin{macro}{\encslot_to_etx} |
| 112 |
% This macro grabs everything up to the next space and writes a |
| 113 |
% |\setslot| entry with the grabbed material as glyph name. It is |
| 114 |
% used as the definition of |/| (active character) when parsing |
| 115 |
% elements of an encoding vector. |
| 116 |
% \changes{1.931}{2005/05/13}{Macro added (separated from |
| 117 |
% \cs{enctoetx}). (LH)} |
| 118 |
% \begin{macrocode} |
| 119 |
\def\encslot_to_etx#1~{ |
| 120 |
\csname o-#1\endcsname{ |
| 121 |
\ifmissingslots |
| 122 |
\out_line{\string\nextslot{\the\a_count}} |
| 123 |
\fi |
| 124 |
\global\missingslotsfalse |
| 125 |
\out_line{\string\setslot{#1}} |
| 126 |
\out_line{\string\endsetslot} |
| 127 |
\out_line{} |
| 128 |
} |
| 129 |
\advance\a_count by 1 |
| 130 |
} |
| 131 |
% \end{macrocode} |
| 132 |
% \end{macro} |
| 133 |
% |
| 134 |
% \begin{macro}{\make_etx} |
| 135 |
% |\make_etx| does the stuff that |\enctoetx| does not; it handles |
| 136 |
% writing the preamble and postamble of the ETX file, but also does |
| 137 |
% the actual |\input| of the ENC file to convert. |
| 138 |
% \changes{1.931}{2005/05/13}{Now requiring a particular |
| 139 |
% \package{fontdoc} version. (LH)} |
| 140 |
% \begin{macrocode} |
| 141 |
\def\make_etx#1#2{ |
| 142 |
\open_out{\temp_prefix#2.etx} |
| 143 |
\out_line{\percent_char~Filename:~#2.etx} |
| 144 |
\out_line{\percent_char~Created~by:~tex~\jobname} |
| 145 |
\out_line{\percent_char~Created~using:~\string\enctoetx{#1}{#2}} |
| 146 |
\out_line{} |
| 147 |
\out_line{\percent_char~This~file~contains~the~ |
| 148 |
information~of~#1.enc~in~a~form} |
| 149 |
\out_line{\percent_char~more~easily~read~by~TeX.~ |
| 150 |
It~is~used~by~the~fontinst~package.} |
| 151 |
\out_line{} |
| 152 |
\out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.} |
| 153 |
\out_line{} |
| 154 |
\out_line{\string\relax} |
| 155 |
\out_line{} |
| 156 |
\out_line{\string\documentclass[twocolumn]{article}} |
| 157 |
\out_line{\string\usepackage{fontdoc}[2005/05/13]} |
| 158 |
\out_line{} |
| 159 |
\out_line{\string\begin{document}} |
| 160 |
\out_line{} |
| 161 |
\out_line{This~document~describes~the~#1~encoding.} |
| 162 |
\out_line{It~was~automatically~generated~by~the} |
| 163 |
\out_line{\string\texttt{fontinst}~package.} |
| 164 |
\out_line{} |
| 165 |
\out_line{\string\encoding} |
| 166 |
\out_line{} |
| 167 |
\out_line{\string\needsfontinstversion{\fontinstversion}} |
| 168 |
\out_line{} |
| 169 |
\primitiveinput #1.enc\x_relax |
| 170 |
\out_line{} |
| 171 |
\out_line{\string\end encoding} |
| 172 |
\out_line{} |
| 173 |
\out_line{\string\end{document}} |
| 174 |
\close_out{Encoding} |
| 175 |
} |
| 176 |
% \end{macrocode} |
| 177 |
% \end{macro} |
| 178 |
% |
| 179 |
% |
| 180 |
% \subsection{Converting an ETX file to an ENC file} |
| 181 |
% \changes{1.911}{1999/11/21}{ETX to ENC converter added. (LH)} |
| 182 |
% |
| 183 |
% \DescribeMacro{\etxtoenc} |
| 184 |
% The command |
| 185 |
% \begin{quote} |
| 186 |
% |\etxtoenc|\marg{etxfile}\marg{encfile} |
| 187 |
% \end{quote} |
| 188 |
% reads \meta{etxfile}|.etx| and generates a postscript encoding file |
| 189 |
% \meta{encfile}|.enc| that specifies the same encoding vector. |
| 190 |
% |
| 191 |
% |
| 192 |
% \begin{macro}{\notdef_name} |
| 193 |
% This macro holds the name of the \texttt{.notdef} glyph, which must |
| 194 |
% be put in all encoding positions where there is no other glyph. |
| 195 |
% \begin{macrocode} |
| 196 |
\def\notdef_name{.notdef} |
| 197 |
% \end{macrocode} |
| 198 |
% \end{macro} |
| 199 |
% |
| 200 |
% |
| 201 |
% \begin{macro}{\etxtoenc} |
| 202 |
% The conversion has three steps. First the \texttt{.notdef} glyph is |
| 203 |
% assigned to every slot in the encoding, then the ETX file is read |
| 204 |
% and the assignments are changed for the slots which are not |
| 205 |
% unassigned in the encoding, and finally the ENC file is written. |
| 206 |
% The first two steps are carried out by |\etxtoenc|, but the final |
| 207 |
% step is handled by |\make_enc|. |
| 208 |
% \changes{1.927}{2004/07/12}{Made the \meta{etxfile} argument a |
| 209 |
% comma-separated list of ETX files. Changed \cs{do_slot} definition |
| 210 |
% to get set rather than reset semantics. (LH) Feature requested |
| 211 |
% by Werner Lemberg.} |
| 212 |
% \begin{macrocode} |
| 213 |
\def\etxtoenc#1#2{\begingroup |
| 214 |
\a_count=\z@ |
| 215 |
\loop |
| 216 |
\x_cs\let{name-\the\a_count}=\notdef_name |
| 217 |
\ifnum \@cclv>\a_count |
| 218 |
\advance \a_count \@ne |
| 219 |
\repeat |
| 220 |
\def\do_slot{ |
| 221 |
\x_cs\ifx{name-\the\slot_number}\notdef_name |
| 222 |
\x_cs\edef{name-\the\slot_number}{\slot_name} |
| 223 |
\fi |
| 224 |
} |
| 225 |
\process_csep_list\inputetx #1,\process_csep_list, |
| 226 |
\make_enc{#1}{#2} |
| 227 |
\endgroup} |
| 228 |
% \end{macrocode} |
| 229 |
% \end{macro} |
| 230 |
% |
| 231 |
% |
| 232 |
% \begin{macro}{\make_enc} |
| 233 |
% The command |
| 234 |
% \begin{quote} |
| 235 |
% |\make_enc|\marg{etxfiles}\marg{encfile} |
| 236 |
% \end{quote} |
| 237 |
% creates the file \meta{encfile}|.enc| and writes to that file the |
| 238 |
% definition of the postscript encoding vector which corresponds to |
| 239 |
% the encoding currently stored in the |\name-|\meta{slot} family of |
| 240 |
% macros. That encoding is assumed to be defined by the files listed |
| 241 |
% in the \meta{etxfiles}. |
| 242 |
% |
| 243 |
% \changes{1.911}{1999/12/02}{Storing encoding name in string |
| 244 |
% \texttt{encodingname}, thus allowing the ETX file to override |
| 245 |
% the default. (LH)} |
| 246 |
% \changes{1.912}{2000/02/12}{Also calling \cs{declarepsencoding} |
| 247 |
% once the encoding file has been written. (LH)} |
| 248 |
% \changes{1.914}{2000/05/14}{Not writing an \texttt{address} entry |
| 249 |
% if that string isn't set. (LH)} |
| 250 |
% \changes{1.919}{2001/08/02}{Added DSC comments. (LH)} |
| 251 |
% \changes{1.927}{2004/07/12}{Modified to handle a comma-separated |
| 252 |
% list of ETX files. (LH)} |
| 253 |
% \begin{macrocode} |
| 254 |
\def\make_enc#1#2{ |
| 255 |
\setstr{encodingname}{fontinst-autoenc-#1} |
| 256 |
\def\a_macro##1{ |
| 257 |
\add_to\b_macro{##1.etx} |
| 258 |
\def\a_macro####1{ |
| 259 |
\add_to\b_macro{,~####1.etx} |
| 260 |
} |
| 261 |
} |
| 262 |
\let\b_macro\empty_command |
| 263 |
\process_csep_list\a_macro #1,\process_csep_list, |
| 264 |
\open_out{#2.enc} |
| 265 |
\out_line{\percent_char !PS-Adobe-3.0~Resource-Encoding} |
| 266 |
\out_line{\percent_char\space @psencodingfile\left_brace_char} |
| 267 |
\ref_to_sourcefile{author}\b_macro |
| 268 |
\ref_to_sourcefile{version}\b_macro |
| 269 |
\out_line{\percent_char\four_spaces date~=~"generated~ |
| 270 |
\the\year/ |
| 271 |
\ifnum10>\month0\fi\the\month/ |
| 272 |
\ifnum10>\day0\fi\the\day",} |
| 273 |
\out_line{\percent_char\four_spaces filename~=~"\out_filename",} |
| 274 |
\ref_to_sourcefile{email}\b_macro |
| 275 |
\ifisstr{address}\then |
| 276 |
\out_line{\percent_char\four_spaces address~=~\str{address}} |
| 277 |
\fi |
| 278 |
\out_line{\percent_char\four_spaces codetable~=~"ISO/ASCII",} |
| 279 |
\out_line{\percent_char\four_spaces checksum~=~"",} |
| 280 |
\out_line{\percent_char\four_spaces abstract~=~" |
| 281 |
This~is~a~postscript~encoding~file,~automatically~ |
| 282 |
generated~by~fontinst~from~\b_macro."} |
| 283 |
\out_line{\percent_char\space\right_brace_char} |
| 284 |
\out_line{} |
| 285 |
\out_line{\percent_char\space Created~by:~tex~\jobname} |
| 286 |
\out_line{\percent_char\space Created~using:~ |
| 287 |
\string\etxtoenc{#1}{#2}} |
| 288 |
\out_line{} |
| 289 |
\out_line{\percent_char\space This~file~should~be~installed~ |
| 290 |
somewhere~that~your~DVI} |
| 291 |
\out_line{\percent_char\space to~postscript~driver~looks~for~files.~ |
| 292 |
It~is~needed~for} |
| 293 |
\out_line{\percent_char\space reencoding~some~font~you~have~ |
| 294 |
transformed.} |
| 295 |
\out_line{} |
| 296 |
\out_line{\percent_char\space After~installing~this~file,~you~ |
| 297 |
should~add~the~following} |
| 298 |
\out_line{\percent_char\space line~(minus~\percent_char)~ |
| 299 |
to~your~finstmsc.rc~file:} |
| 300 |
\out_line{\percent_char\space\string\declarepsencoding |
| 301 |
{#1}{\str{encodingname}}{\string\download{\out_filename}}} |
| 302 |
\edef\a_macro{ |
| 303 |
\noexpand\declarepsencoding{#1}{\str{encodingname}} |
| 304 |
{\noexpand\download{\out_filename}} |
| 305 |
} |
| 306 |
\a_macro |
| 307 |
\out_line{} |
| 308 |
\out_line{\percent_char\percent_char BeginResource:~ |
| 309 |
encoding~\str{encodingname}} |
| 310 |
\out_line{/\str{encodingname}\space[} |
| 311 |
\b_count=8 |
| 312 |
\a_count=\z@ |
| 313 |
\loop |
| 314 |
\ifnum 8=\b_count |
| 315 |
\b_count=\z@ |
| 316 |
\out_line{\percent_char\space\the\a_count} |
| 317 |
\fi |
| 318 |
\out_line{/\csname name-\the\a_count \endcsname} |
| 319 |
\ifnum \@cclv>\a_count |
| 320 |
\advance \a_count \@ne |
| 321 |
\advance \b_count \@ne |
| 322 |
\repeat |
| 323 |
\out_line{]~def} |
| 324 |
\out_line{\percent_char\percent_char EndResource} |
| 325 |
\out_line{} |
| 326 |
\out_line{\percent_char\space End~of~file~\out_filename.} |
| 327 |
\close_out{Encoding~vector} |
| 328 |
} |
| 329 |
% \end{macrocode} |
| 330 |
% \end{macro} |
| 331 |
% |
| 332 |
% \begin{macro}{\ref_to_sourcefile} |
| 333 |
% The command |
| 334 |
% \begin{quote} |
| 335 |
% |\ref_to_sourcefile|\marg{field}\marg{sourcefile} |
| 336 |
% \end{quote} |
| 337 |
% writes a \meta{field} field of a \BibTeX-style header to the |
| 338 |
% current main output file. If the string named \meta{field} is set |
| 339 |
% then the value for this field will be that string, and if it isn't |
| 340 |
% set then the value will be the string \texttt{"See file }^^A |
| 341 |
% \meta{sourcefile}\texttt{"}. Note that the string \#1 is not |
| 342 |
% quoted, so it must contain the quotes if it isn't simply an integer. |
| 343 |
% \begin{macrocode} |
| 344 |
\def\ref_to_sourcefile#1#2{ |
| 345 |
\ifisstr{#1}\then |
| 346 |
\out_line{\percent_char\four_spaces #1~=~\str{#1},} |
| 347 |
\else |
| 348 |
\out_line{\percent_char\four_spaces #1~=~"See~file~#2",} |
| 349 |
\fi |
| 350 |
} |
| 351 |
% \end{macrocode} |
| 352 |
% \end{macro} |
| 353 |
% |
| 354 |
% |
| 355 |
% \subsection{Converting an ETX file to CMAP file} |
| 356 |
% \changes{1.928}{2004/11/28}{ETX to CMAP converter added. (LH)} |
| 357 |
% |
| 358 |
% \DescribeMacro{\etxtocmap} |
| 359 |
% The command |
| 360 |
% \begin{quote} |
| 361 |
% |\etxtocmap|\marg{etxfile}\marg{cmapfile} |
| 362 |
% \end{quote} |
| 363 |
% reads \meta{etxfile}|.etx| and generates a ToUnicode CMap file |
| 364 |
% \meta{cmapfile}|.cmap| that maps slots to Unicode strings as |
| 365 |
% specified by the \meta{etxfile}. |
| 366 |
% |
| 367 |
% \begin{macro}{\write_cmap_body} |
| 368 |
% The |\write_cmap_body| command writes the actual CMap |
| 369 |
% data\footnote{As opposed to silly stuff that is requested by the |
| 370 |
% file format specification but probably isn't of any use for |
| 371 |
% anything, which is written by \cs{ref_to_sourcefile}.} to the |
| 372 |
% current output file. The syntax is |
| 373 |
% \begin{quote} |
| 374 |
% |\write_cmap_body|\marg{etxfile} |
| 375 |
% \end{quote} |
| 376 |
% |
| 377 |
% More precisely, what this command writes is the codespace range |
| 378 |
% specification and the mappings. The latter are all encoded using |
| 379 |
% \texttt{bfchar} operators. |
| 380 |
% \begin{macrocode} |
| 381 |
\def\write_cmap_body#1{ |
| 382 |
\out_line{1~begincodespacerange~<00>~<FF>~endcodespacerange} |
| 383 |
\let\do_slot=\_a_true |
| 384 |
\def\Unicode##1##2{\cmap_charseq{\cmap_codepoint{##1}{##2}}} |
| 385 |
\let\charseq=\cmap_charseq |
| 386 |
\inputetx{#1} |
| 387 |
} |
| 388 |
% \end{macrocode} |
| 389 |
% \end{macro} |
| 390 |
% |
| 391 |
% |
| 392 |
% \begin{macro}{\cmap_codepoint} |
| 393 |
% This is what |\Unicode| is inside a |\charseq|. It appends a |
| 394 |
% UTF-16BE character in hexadecimal notation (either four hex |
| 395 |
% digits for a character in the BMP, or eight hex digits for |
| 396 |
% a surrogate pair) to |\a_macro|, and also appends a space for |
| 397 |
% grouping the digits for easier reading. |
| 398 |
% \changes{1.928}{2004/12/05}{Added \cs{uppercase} to ensure case |
| 399 |
% independence. (LH)} |
| 400 |
% \begin{macrocode} |
| 401 |
\def\cmap_codepoint#1#2{ |
| 402 |
\uppercase{\a_count="#1\x_relax} |
| 403 |
\ifnum "10000>\a_count |
| 404 |
\format_hex\b_macro{\a_count}{4} |
| 405 |
\edef\a_macro{\a_macro \b_macro \space} |
| 406 |
\else |
| 407 |
\advance \a_count -"10000 |
| 408 |
\d_count=\a_count |
| 409 |
\divide \a_count "400 |
| 410 |
\b_count=\a_count |
| 411 |
\multiply \b_count "400 |
| 412 |
\advance \d_count -\b_count |
| 413 |
\advance \a_count "D800 |
| 414 |
\advance \d_count "DC00~ |
| 415 |
\format_hex\b_macro{\a_count}{4} |
| 416 |
\format_hex\c_macro{\d_count}{4} |
| 417 |
\edef\a_macro{\a_macro \b_macro \c_macro \space} |
| 418 |
\fi |
| 419 |
} |
| 420 |
% \end{macrocode} |
| 421 |
% \end{macro} |
| 422 |
% |
| 423 |
% \begin{macro}{\cmap_charseq} |
| 424 |
% This macro is what |\charseq| is when generating a CMap; all |
| 425 |
% writing of CMap entries is routed through it. Only the first |
| 426 |
% character equivalent of each slot should get written to file, so |
| 427 |
% the |_a_| switch is used for keeping track of whether this would be |
| 428 |
% the first. |
| 429 |
% |
| 430 |
% \begin{macrocode} |
| 431 |
\def\cmap_charseq#1{% |
| 432 |
\if_a_ |
| 433 |
\bgroup |
| 434 |
\let\Unicode=\cmap_codepoint |
| 435 |
\let\a_macro=\empty_command |
| 436 |
#1 |
| 437 |
\format_hex\b_macro{\slot_number}{2} |
| 438 |
\out_line{1~beginbfchar~<\b_macro>~<~\a_macro>~endbfchar} |
| 439 |
\egroup |
| 440 |
\_a_false |
| 441 |
\fi |
| 442 |
} |
| 443 |
% \end{macrocode} |
| 444 |
% \end{macro} |
| 445 |
% |
| 446 |
% |
| 447 |
% |
| 448 |
% |
| 449 |
% \begin{macro}{\etxtocmap} |
| 450 |
% As usual for macros with this kind of name, this is the user |
| 451 |
% level command to call to generate a CMAP from an ETX. The |
| 452 |
% arguments are file names (not including extensions). |
| 453 |
% \begin{macrocode} |
| 454 |
\def\etxtocmap#1#2{\begingroup |
| 455 |
\inputetx{#1} |
| 456 |
\open_out{#2.cmap} |
| 457 |
\out_line{\percent_char !PS-Adobe-3.0~Resource-CMap} |
| 458 |
\out_line{\percent_char\percent_char |
| 459 |
DocumentNeededResources:~procset~CIDInit} |
| 460 |
\out_line{\percent_char\percent_char |
| 461 |
IncludeResource:~procset~CIDInit} |
| 462 |
% \end{macrocode} |
| 463 |
% Here comes the first problem: the CMap must have a name. If the ETX |
| 464 |
% file sets the string variable \texttt{cmapname} then that is used |
| 465 |
% as name, but otherwise |fontinst-|\meta{cmapfile} is used as name. |
| 466 |
% Note that this is different from the pattern in |\etxtoenc|, which |
| 467 |
% instead uses the \meta{etxname}. |
| 468 |
% \begin{macrocode} |
| 469 |
\setstr{cmapname}{fontinst-#2} |
| 470 |
\out_line{\percent_char\percent_char |
| 471 |
BeginResource:~CMap~\str{cmapname}} |
| 472 |
% \end{macrocode} |
| 473 |
% The next problem is whether one should bother with the quite |
| 474 |
% extensive version control junk that Adobe has specified. I prefer |
| 475 |
% not to, because it is very much geared towards using CMaps with |
| 476 |
% CIDFonts, which is not the case here. |
| 477 |
% |
| 478 |
% Thus it is time for the actual PS code. |
| 479 |
% \begin{macrocode} |
| 480 |
\out_line{/CIDInit~/ProcSet~findresource~begin} |
| 481 |
\out_line{7~dict~begin} |
| 482 |
\out_line{begincmap} |
| 483 |
\out_line{/CMapName~/\str{cmapname}~def} |
| 484 |
\out_line{/CMapType~2~def} |
| 485 |
\write_cmap_body{#1} |
| 486 |
\out_line{endcmap} |
| 487 |
\out_line{CMapName~currentdict~/CMap~defineresource~pop} |
| 488 |
\out_line{end} |
| 489 |
\out_line{end} |
| 490 |
\out_line{\percent_char\percent_char EndResource} |
| 491 |
\out_line{\percent_char\percent_char EOF} |
| 492 |
\close_out{ToUnicode~CMap} |
| 493 |
\endgroup} |
| 494 |
%</misc> |
| 495 |
% \end{macrocode} |
| 496 |
% \end{macro} |
| 497 |
% |
| 498 |
% |
| 499 |
% |
| 500 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 501 |
% |
| 502 |
% \subsection{Converting an AFM file to an MTX file} |
| 503 |
% |
| 504 |
% \DescribeMacro{\afmtomtx} |
| 505 |
% The macro |
| 506 |
% \begin{quote} |
| 507 |
% |\afmtomtx|\marg{afmfile}\marg{mtxfile} |
| 508 |
% \end{quote} |
| 509 |
% reads \meta{afmfile}|.afm|, and writes the same information out to |
| 510 |
% \meta{mtxfile}|.mtx|. |
| 511 |
% |
| 512 |
% \begin{macro}{\afmtomtx} |
| 513 |
% \changes{1.911}{1999/11/18}{Changed setting of \cs{raw_font_name} |
| 514 |
% to \cs{edef} and added setting of \cs{source_font_name}. (LH)} |
| 515 |
% \changes{1.917}{2001/03/13}{Added resetting of |
| 516 |
% \cs{setsomething_global}---assignments made here must be |
| 517 |
% local. (LH)} |
| 518 |
% \begin{macrocode} |
| 519 |
%<*pkg> |
| 520 |
\def\afmtomtx#1#2{{ |
| 521 |
\let\setsomething_global=\x_relax |
| 522 |
\open_out{\temp_prefix#2.mtx} |
| 523 |
\edef\raw_font_name{#2} |
| 524 |
\edef\source_font_name{#1} |
| 525 |
\x_resetint{italicslant}{0} |
| 526 |
\let\italcorr_expression=\uprightitalcorr |
| 527 |
\x_setint{minimumkern}{0} |
| 528 |
\minimum_kern=\int{minimumkern} |
| 529 |
\out_line{\percent_char~Filename:~#2.mtx} |
| 530 |
\out_line{\percent_char~Created~by:~tex~\jobname} |
| 531 |
\out_line{\percent_char~Created~using:~\string\afmtomtx{#1}{#2}} |
| 532 |
\out_line{} |
| 533 |
\out_line{\percent_char~This~file~contains~the~ |
| 534 |
information~of~#1.afm~in~a~form} |
| 535 |
\out_line{\percent_char~more~easily~read~by~TeX.~ |
| 536 |
It~is~used~by~the~fontinst~package.} |
| 537 |
\out_line{} |
| 538 |
\out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.} |
| 539 |
\out_line{} |
| 540 |
\out_line{\string\relax} |
| 541 |
\out_line{\string\metrics} |
| 542 |
\out_line{} |
| 543 |
\out_line{\string\needsfontinstversion{\fontinstversion}} |
| 544 |
\out_line{} |
| 545 |
\catcode`\^^M=12 |
| 546 |
\catcode`\ =10 |
| 547 |
\expandafter\afm_line\primitiveinput #1.afm\x_relax |
| 548 |
\out_line{} |
| 549 |
\out_line{\endmetrics_text} |
| 550 |
\close_out{Metrics} |
| 551 |
}} |
| 552 |
% \end{macrocode} |
| 553 |
% \end{macro} |
| 554 |
% |
| 555 |
% Kerns below this value are ignored. |
| 556 |
% |
| 557 |
% \begin{macrocode} |
| 558 |
\newcount\minimum_kern |
| 559 |
% \end{macrocode} |
| 560 |
% |
| 561 |
% |
| 562 |
% \begin{macro}{\afm_length} |
| 563 |
% \changes{1.900}{1998/12/28}{Macro added, other macros modified to |
| 564 |
% use it. (LH)} |
| 565 |
% \begin{macro}{\afm_unit_dimen} |
| 566 |
% The call |\afm_length|\meta{count}\marg{real} |
| 567 |
% interprets the \meta{real} as a real number, rounds it to the |
| 568 |
% nearest integer, and sets the \meta{count} (a |\count| register) |
| 569 |
% to that integer. In this process, |\a_dimen| is used as a temporary |
| 570 |
% storage. |
| 571 |
% \begin{macrocode} |
| 572 |
\def\afm_length#1#2{ |
| 573 |
\a_dimen=#2\afm_unit_dimen |
| 574 |
#1=\a_dimen |
| 575 |
\divide #1 by \afm_unit_dimen |
| 576 |
\advance \a_dimen by -#1\afm_unit_dimen |
| 577 |
\ifdim \a_dimen>0.5\afm_unit_dimen |
| 578 |
\advance #1 by 1 |
| 579 |
\else \ifdim \a_dimen<-0.5\afm_unit_dimen |
| 580 |
\advance #1 by -1 |
| 581 |
\fi\fi |
| 582 |
\x_relax |
| 583 |
} |
| 584 |
% \end{macrocode} |
| 585 |
% The dimen |\afm_unit_dimen| is used to keep track of how long an AFM |
| 586 |
% unit is interpreted as being in this routine. Lowering its value |
| 587 |
% makes |\afm_length| capable of handling greater lengths but looses |
| 588 |
% some very slight precision in the rounding, increasing the value |
| 589 |
% has the opposite effects. The current value of 1000\thinspace sp |
| 590 |
% means it reads lengths with three decimals accuracy (not very much |
| 591 |
% use for them though as the number is rounded to zero decimals |
| 592 |
% accuracy anyway, but it does make a difference when deciding how |
| 593 |
% a \meta{real} like |0.502| should be rounded) and can handle lengths |
| 594 |
% of an absolute value of a good million AFM units. This should be |
| 595 |
% adequate in most cases. It is, by the way, probably wisest to keep |
| 596 |
% it a power of ten scaled points in all cases, as this should reduce |
| 597 |
% the rounding errors caused by various base conversions. |
| 598 |
% \begin{macrocode} |
| 599 |
\newdimen\afm_unit_dimen |
| 600 |
\afm_unit_dimen=1000sp |
| 601 |
% \end{macrocode} |
| 602 |
% \end{macro}\end{macro} |
| 603 |
% |
| 604 |
% |
| 605 |
% The command |\afm_line| reads to the end of the line, calls |
| 606 |
% |\afm_command| on that line, then calls |\afm_line| again. |
| 607 |
% |
| 608 |
% \begin{macrocode} |
| 609 |
{\catcode`\^^M=12 \gdef\afm_line#1 |
| 610 |
{\afm_command#1~\end_of_line\afm_line}} |
| 611 |
% \end{macrocode} |
| 612 |
% |
| 613 |
% The command |\afm_command| reads the first word \meta{FOO}, and |
| 614 |
% calls |\afm-|\meta{FOO}\describecsfamily{afm-\meta{key}}. If this |
| 615 |
% does not exist, then |\gobble_one_line| will |
| 616 |
% eat up the rest of the line. |
| 617 |
% |
| 618 |
% \begin{macrocode} |
| 619 |
\def\afm_command#1~{\csname~afm-#1\endcsname\gobble_one_line} |
| 620 |
\def\gobble_one_line#1\end_of_line{} |
| 621 |
% \end{macrocode} |
| 622 |
% |
| 623 |
% This all stops when we reach the command |EndFontMetrics|. |
| 624 |
% |
| 625 |
% \begin{macrocode} |
| 626 |
\x_cs\def{afm-EndFontMetrics}#1\afm_line{\endinput} |
| 627 |
% \end{macrocode} |
| 628 |
% |
| 629 |
% \begin{macro}{\afm_def} |
| 630 |
% To define an AFM command, you say |\afm_def|\marg{command}^^A |
| 631 |
% \parg{pattern}\marg{result} |
| 632 |
% \begin{macrocode} |
| 633 |
\def\afm_def#1(#2)#3{ |
| 634 |
\x_cs\def{afm-#1}\gobble_one_line#2\end_of_line{#3} |
| 635 |
} |
| 636 |
% \end{macrocode} |
| 637 |
% \end{macro} |
| 638 |
% |
| 639 |
% \begin{macro}{\afm_let} |
| 640 |
% Saying |\afm_let|\marg{dest-command}\marg{source-command} copies |
| 641 |
% the definition of one AFM command to another. |
| 642 |
% \begin{macrocode} |
| 643 |
\def\afm_let#1#2{ |
| 644 |
\expandafter\let \csname afm-#1\expandafter\endcsname |
| 645 |
\csname afm-#2\endcsname |
| 646 |
} |
| 647 |
% \end{macrocode} |
| 648 |
% \end{macro} |
| 649 |
% |
| 650 |
% For example, we can define the following AFM commands: |
| 651 |
% \changes{1.6}{1997/02/07}{AFM commands fixed, to get fontdimens |
| 652 |
% comparable to EC fonts. (Thierry Bouche)} |
| 653 |
% ^^A (Fixed by Thierry Bouche |
| 654 |
% ^^A 1997/02/07, to get fontdimens comparable to EC fonts.) |
| 655 |
% \changes{1.912}{2000/02/20}{AFM command \texttt{StdVW} now |
| 656 |
% interpreted: generates \cs{setint} for integer |
| 657 |
% \texttt{verticalstem}. (LH)} |
| 658 |
% |
| 659 |
% \begin{macrocode} |
| 660 |
\afm_def{CharWidth}(#1){\afm_length\char_x_width{#1}} |
| 661 |
\afm_def{ItalicAngle}(#1~){\calculate_it_slant{#1}} |
| 662 |
\afm_def{XHeight}(#1){ |
| 663 |
\afm_length\a_count{#1} |
| 664 |
\out_line{\string\setint{xheight}{\the\a_count}}} |
| 665 |
\afm_def{CapHeight}(#1){ |
| 666 |
\afm_length\a_count{#1} |
| 667 |
\out_line{\string\setint{capheight}{\the\a_count}}} |
| 668 |
\afm_def{Ascender}(#1){ |
| 669 |
\afm_length\a_count{#1} |
| 670 |
\out_line{\string\setint{ascender}{\the\a_count}}} |
| 671 |
\afm_def{Descender}(#1){ |
| 672 |
\afm_length\a_count{#1} |
| 673 |
\out_line{\string\setint{descender_neg}{\the\a_count}}} |
| 674 |
\afm_def{UnderlineThickness}(#1){ |
| 675 |
\afm_length\a_count{#1} |
| 676 |
\out_line{\string\setint{underlinethickness}{\the\a_count}}} |
| 677 |
\afm_def{FontBBox}(#1~#2~#3~#4){ |
| 678 |
\afm_length\a_count{#4} |
| 679 |
\out_line{\string\setint{maxheight}{\the\a_count}} |
| 680 |
\afm_length\a_count{#2} |
| 681 |
\out_line{\string\setint{maxdepth_neg}{\the\a_count}}} |
| 682 |
\afm_def{StdVW}(#1){ |
| 683 |
\afm_length\a_count{#1} |
| 684 |
\out_line{\string\setint{verticalstem}{\the\a_count}}} |
| 685 |
\afm_def{IsFixedPitch}(#1){ |
| 686 |
\if\first_char#1=f |
| 687 |
\else\out_line{\string\setint{monowidth}{1}} |
| 688 |
\fi |
| 689 |
} |
| 690 |
% \end{macrocode} |
| 691 |
% |
| 692 |
% \multchanges{\cs{afm_font_name}}{1.901}{1999/03/06}{Macro added. (LH)} |
| 693 |
% \multchanges{\cs{afm_font_name}}{1.911}{1999/11/18}{Macro removed, |
| 694 |
% since no longer needed. (LH)} |
| 695 |
% |
| 696 |
% \begin{macro}{\afm-FontName} |
| 697 |
% The |FontName| of a font is needed for the |\storemapdata| command, |
| 698 |
% so it is when that is encountered that this is written. This |
| 699 |
% information is of no use when making TFMs and VFs, but it is likely |
| 700 |
% to be of use for generation of map files, so it will be included in |
| 701 |
% a file of recorded transforms, if such a file is being generated. |
| 702 |
% \begin{macrocode} |
| 703 |
\afm_def{FontName}(#1~){ |
| 704 |
\record_transform{\raw_font_name} |
| 705 |
{\string\fromafm{\source_font_name}{#1}}{}\iftrue |
| 706 |
} |
| 707 |
% \end{macrocode} |
| 708 |
% \end{macro} |
| 709 |
% |
| 710 |
% \begin{macro}{\afm-KPX} |
| 711 |
% \begin{macro}{\afm-KP} |
| 712 |
% Processing kern pairs. If one of the glyph name starts with |
| 713 |
% a dot as in |.notdef| or |.null| the kern pair is ignored. |
| 714 |
% The pair is also ignored if the absolute value of the kern |
| 715 |
% amount is |\minimum_kern| or less. |
| 716 |
% |
| 717 |
% That \texttt{KPX} can have the same definition as \texttt{KP} is |
| 718 |
% due to an edge case in the processing of AFM lines: |\afm_line| |
| 719 |
% inserts an extra space at the end of a line. For \texttt{KPX} |
| 720 |
% which really only has three arguments this extra space matches |
| 721 |
% the space in |#3~#4|, whereas for \texttt{KP} which has four |
| 722 |
% arguments this extra space appears at the end of |#4|. |
| 723 |
% |
| 724 |
% \begin{macrocode} |
| 725 |
\afm_def{KP}(#1~#2~#3~#4){ |
| 726 |
\if\first_char#1=.\else |
| 727 |
\if\first_char#2=.\else |
| 728 |
\afm_length\a_count{#3} |
| 729 |
\ifnum \a_count>\minimum_kern |
| 730 |
\afm_write_setkern{#1}{#2}{\the\a_count} |
| 731 |
\else\ifnum \a_count<-\minimum_kern |
| 732 |
\afm_write_setkern{#1}{#2}{\the\a_count} |
| 733 |
\fi\fi |
| 734 |
\fi\fi |
| 735 |
} |
| 736 |
\afm_let{KPX}{KP} |
| 737 |
% \end{macrocode} |
| 738 |
% \end{macro}\end{macro} |
| 739 |
% |
| 740 |
% \begin{macro}{\afm_write_setkern} |
| 741 |
% This macro is a hook for the auto-aliasing mechanism to redefine. |
| 742 |
% In this plain form, it just outputs a |\setkern| command with the |
| 743 |
% given three arguments. |
| 744 |
% \changes{1.933}{2007/01/23}{Macro added. (LH)} |
| 745 |
% \begin{macrocode} |
| 746 |
\def\afm_write_setkern#1#2#3{\out_line{\string\setkern{#1}{#2}{#3}}} |
| 747 |
% \end{macrocode} |
| 748 |
% \end{macro} |
| 749 |
% |
| 750 |
% Processing char metrics. |
| 751 |
% |
| 752 |
% \begin{macrocode} |
| 753 |
\afm_def{C}(#1~;#2){\init_afm{#1}\do_list[#2]\afm_char} |
| 754 |
% \end{macrocode} |
| 755 |
% |
| 756 |
% \begin{macro}{\afm-CH} |
| 757 |
% The |CH| keyword is like |C|, but signals that the following |
| 758 |
% character code is given in hexadecimal. |
| 759 |
% \changes{1.933}{2007/01/22}{Proper definition, that parses the |
| 760 |
% following hexadecimal value. (LH) Since noone has complained |
| 761 |
% about this before, it's probably not very common.} |
| 762 |
% \begin{macrocode} |
| 763 |
\afm_def{CH}(<#1>~;#2){\uppercase{\init_afm{"#1}}\do_list[#2]\afm_char} |
| 764 |
% \end{macrocode} |
| 765 |
% \end{macro} |
| 766 |
% |
| 767 |
% Processing composite chars. |
| 768 |
% |
| 769 |
% \begin{macrocode} |
| 770 |
\afm_def{CC}(#1~#2~;#3){\init_cc{#1}\do_list[#3]\cc_char} |
| 771 |
% \end{macrocode} |
| 772 |
% |
| 773 |
% When parsing a character, we set the values of the following |
| 774 |
% variables: |
| 775 |
% |
| 776 |
% \begin{macrocode} |
| 777 |
\newcount\char_slot |
| 778 |
\newcount\char_x_width |
| 779 |
\newcount\x_width |
| 780 |
\newcount\bbox_llx |
| 781 |
\newcount\bbox_lly |
| 782 |
\newcount\bbox_urx |
| 783 |
\newcount\bbox_ury |
| 784 |
\let\char_name=\empty_command |
| 785 |
% \end{macrocode} |
| 786 |
% |
| 787 |
% \begin{macro}{\init_afm} |
| 788 |
% |\init_afm| initializes the variables the AFM character list |
| 789 |
% writes to. |
| 790 |
% \begin{macrocode} |
| 791 |
\def\init_afm#1{ |
| 792 |
\char_slot=#1\x_relax |
| 793 |
\x_width=\char_x_width |
| 794 |
\bbox_llx=0 |
| 795 |
\bbox_lly=0 |
| 796 |
\bbox_urx=0 |
| 797 |
\bbox_ury=0 |
| 798 |
\let\char_name=\empty_command |
| 799 |
} |
| 800 |
% \end{macrocode} |
| 801 |
% \end{macro} |
| 802 |
% |
| 803 |
% \begin{macro}{\afm_char} |
| 804 |
% This command is executed at the end of processing a \texttt{C} |
| 805 |
% (or \texttt{CH}) line. It outputs the corresponding |
| 806 |
% |\setrawglyph| or |\setnotglyph| command, based on information |
| 807 |
% stored into registers when processing that line. |
| 808 |
% \changes{1.933}{2007/01/23}{Negating \cs{bbox_lly} using |
| 809 |
% \cs{number} instead of an assignment to \cs{a_count}. (LH)} |
| 810 |
% \begin{macrocode} |
| 811 |
\def\afm_char{ |
| 812 |
\eval_expr{ |
| 813 |
\italcorr_expression\x_width\bbox_llx\bbox_urx\bbox_lly\bbox_ury |
| 814 |
} |
| 815 |
\out_line{ |
| 816 |
\ifnum -1<\char_slot |
| 817 |
\string\setrawglyph |
| 818 |
\else |
| 819 |
\string\setnotglyph |
| 820 |
\fi |
| 821 |
{\char_name} |
| 822 |
{\raw_font_name} |
| 823 |
{10pt} |
| 824 |
{\the\char_slot} |
| 825 |
{\the\x_width} |
| 826 |
{\the\bbox_ury} |
| 827 |
{\number -\bbox_lly} |
| 828 |
{\the\result} |
| 829 |
} |
| 830 |
} |
| 831 |
% \end{macrocode} |
| 832 |
% \end{macro} |
| 833 |
% |
| 834 |
% |\init_cc| and |\cc_char| write out a composite character glyph. |
| 835 |
% |
| 836 |
% \begin{macrocode} |
| 837 |
\def\init_cc#1{% |
| 838 |
\out_line{\string\setglyph{#1}} |
| 839 |
\def\char_name{#1} |
| 840 |
} |
| 841 |
\def\cc_char{% |
| 842 |
\out_lline{\string\samesize{\char_name-not}} |
| 843 |
\out_line{\string\endsetglyph} |
| 844 |
} |
| 845 |
% \end{macrocode} |
| 846 |
% |
| 847 |
% |
| 848 |
% \changes{1.900}{1998/12/28}{Method of computing italic corrections |
| 849 |
% changed to using an integer expression. (LH)} |
| 850 |
% \DescribeMacro{\italcorr_expression} |
| 851 |
% The way the italic correction is computed has been changed |
| 852 |
% quite a bit, although the computed values are still the same. |
| 853 |
% The point is that it is much simpler to modify the formula according |
| 854 |
% to which the value is computed using this method than using the |
| 855 |
% previous method. |
| 856 |
% |
| 857 |
% The call |
| 858 |
% \begin{quote} |
| 859 |
% |\italcorr_expression|\marg{width}\marg{left}^^A |
| 860 |
% \marg{right}\marg{bottom}\marg{top}, |
| 861 |
% \end{quote} |
| 862 |
% where the arguments are \TeX\ \meta{number}s, should expand to an |
| 863 |
% integer expression. The value of that expression will be taken as the |
| 864 |
% italic correction of the current character. |
| 865 |
% |
| 866 |
% \meta{width} is the width of the character. \meta{left}, |
| 867 |
% \meta{right}, \meta{bottom}, and \meta{top} are the respective |
| 868 |
% coordinates of the sides of the bounding box of the character. A |
| 869 |
% quantity which is not given as an argument, but which nontheless |
| 870 |
% might be of interest for a calculation of italic correction, is the |
| 871 |
% italic slant of the font. This quantity can be found in the fontinst |
| 872 |
% integer \texttt{italicslant}. (The MTX file written will also set |
| 873 |
% the integer \texttt{italicslant} to this value.) |
| 874 |
% |
| 875 |
% \begin{macro}{\uprightitalcorr} |
| 876 |
% \begin{macro}{\slanteditalcorr} |
| 877 |
% These two commands are what |\italcorr_expression| will get set |
| 878 |
% to---the slanted version is used if the italic slant is positive and |
| 879 |
% the upright version is used otherwise. The default definitions |
| 880 |
% compute the same values as in fontinst v\,1.8, but the definitions |
| 881 |
% can easily be modified using |\resetcommand|. |
| 882 |
% \begin{macrocode} |
| 883 |
\def\uprightitalcorr#1#2#3#4#5{0} |
| 884 |
\def\slanteditalcorr#1#2#3#4#5{\max{\sub{#3}{#1}}{0}} |
| 885 |
% \end{macrocode} |
| 886 |
% \end{macro}\end{macro} |
| 887 |
% |
| 888 |
% |
| 889 |
% \begin{macro}{\calculate_it_slant} |
| 890 |
% To set the italic angle, we need to calculate the tangent of the |
| 891 |
% angle that the |.afm| file contains. This is done with David |
| 892 |
% Carlisle's \package{trig} macros. Note that the \package{trig} |
| 893 |
% macros don't like a space at the end of their argument. |
| 894 |
% |
| 895 |
% \changes{1.911}{1999/11/18}{Stripping off the space in |
| 896 |
% \cs{afm-ItalicAngle}. (LH)} |
| 897 |
% ^^A\question{\cs{afm_line} always inserts a space at the end of the line.} |
| 898 |
% ^^ACould we therefore save us a bit of trouble by simply changing the |
| 899 |
% ^^Apattern for |\ItalicAngle| to |(#1~)|? /LH |
| 900 |
% |
| 901 |
% \begin{macrocode} |
| 902 |
\def\calculate_it_slant#1{ |
| 903 |
\edef\theangle{#1} |
| 904 |
\CalculateTan{\theangle} |
| 905 |
\a_dimen=-\one_thousand sp |
| 906 |
\a_dimen=\UseTan{\theangle}\a_dimen |
| 907 |
\a_count=\a_dimen |
| 908 |
\out_line{\string\setint{italicslant}{\the\a_count}} |
| 909 |
\x_resetint{italicslant}{\a_count} |
| 910 |
\ifnum 0<\a_count |
| 911 |
\let\italcorr_expression=\slanteditalcorr |
| 912 |
\else |
| 913 |
\let\italcorr_expression=\uprightitalcorr |
| 914 |
\fi |
| 915 |
} |
| 916 |
% \end{macrocode} |
| 917 |
% \begin{macrocode} |
| 918 |
% \def\strip_spaces#1~#2\end_strip_spaces{#1} |
| 919 |
% \end{macrocode} |
| 920 |
% \end{macro} |
| 921 |
% |
| 922 |
% To process a list of commands separated by semi-colons, we call |
| 923 |
% |\do_list[LIST]|. This works in a similar way to |\afm_line|, but |
| 924 |
% the control sequence family used for decoding is |
| 925 |
% \describecsfamily{list-\meta{key}}|\list-|\meta{keyword} rather |
| 926 |
% than |\afm-|\meta{keyword}. |
| 927 |
% |
| 928 |
% \begin{macrocode} |
| 929 |
\def\do_list[~#1~#2;~#3]{ |
| 930 |
\csname~list-#1\endcsname\gobble_one_semi#2; |
| 931 |
\ifx\x_relax#3\x_relax\expandafter\gobble_one |
| 932 |
\else\expandafter\identity_one\fi |
| 933 |
{\do_list[~#3]} |
| 934 |
} |
| 935 |
\def\gobble_one_semi#1;{} |
| 936 |
% \end{macrocode} |
| 937 |
% |
| 938 |
% There is an analagous |\list_def| for defining commands to be used |
| 939 |
% inside lists. |
| 940 |
% |
| 941 |
% \begin{macrocode} |
| 942 |
\def\list_def#1(#2)#3{\x_cs\def{list-#1}\gobble_one_semi#2~;{#3}} |
| 943 |
% \end{macrocode} |
| 944 |
% |
| 945 |
% For example, these are the commands that are used in giving |
| 946 |
% character metrics: |
| 947 |
% |
| 948 |
% \begin{macrocode} |
| 949 |
\list_def{W}(#1~#2){\afm_length\x_width{#1}} |
| 950 |
\list_def{WX}(#1){\afm_length\x_width{#1}} |
| 951 |
\list_def{WY}(#1){} |
| 952 |
\list_def{N}(#1){\def\char_name{#1}} |
| 953 |
\list_def{B}(#1~#2~#3~#4){ |
| 954 |
\afm_length\bbox_llx{#1} |
| 955 |
\afm_length\bbox_lly{#2} |
| 956 |
\afm_length\bbox_urx{#3} |
| 957 |
\afm_length\bbox_ury{#4} |
| 958 |
} |
| 959 |
\list_def{PCC}(#1~#2~#3){ |
| 960 |
\afm_length\a_count{#2} |
| 961 |
\afm_length\b_count{#3} |
| 962 |
\out_lline{\string\glyphpcc{#1}{\the\a_count}{\the\b_count}} |
| 963 |
} |
| 964 |
% \end{macrocode} |
| 965 |
% |
| 966 |
% \begin{macro}{\definealias} |
| 967 |
% The |\definealias| command can be used to define a glyph name |
| 968 |
% alias, for generation of |\aliased| clauses in glyph names. The |
| 969 |
% syntax is |
| 970 |
% \begin{quote} |
| 971 |
% |\definealias|\marg{alias name}\marg{font's name}\marg{int} |
| 972 |
% \end{quote} |
| 973 |
% where \meta{font's name} is the glyph name that if found in an |
| 974 |
% AFM file should be converted to an |\aliased| clause using the |
| 975 |
% \meta{alias name}. The \meta{int} is the name of an integer which |
| 976 |
% will be incremented every time this alias applies to a glyph |
| 977 |
% definition; this mechanism is meant to help higher level code |
| 978 |
% pick an ETX file that fits the font's glyph names. |
| 979 |
% |
| 980 |
% \changes{1.933}{2007/01/22}{Command added. (LH)} |
| 981 |
% |
| 982 |
% Defined aliases are stored in the |
| 983 |
% \describecsfamily{GN-\meta{font's name}}|\GN-|\meta{font's name} |
| 984 |
% family of control sequences. These control sequences are defined |
| 985 |
% to be macros expanding to the two tokens |
| 986 |
% \begin{quote} |
| 987 |
% |\g-|\meta{alias name}\,|\i-|\meta{int} |
| 988 |
% \end{quote} |
| 989 |
% In the case of |\g-|\meta{alias name}, this is purely a trick to |
| 990 |
% save memory (it is very likely that these control sequences will |
| 991 |
% anyway occur during the fontmaking part of the processing). |
| 992 |
% \begin{macrocode} |
| 993 |
\def\definealias#1#2#3{ |
| 994 |
\expandafter\def \csname GN-#1 \expandafter\endcsname |
| 995 |
\expandafter{ \csname g-#2 \expandafter\endcsname |
| 996 |
\csname i-#3\endcsname} |
| 997 |
} |
| 998 |
% \end{macrocode} |
| 999 |
% \end{macro} |
| 1000 |
% |
| 1001 |
% \begin{macro}{\glyph_alias} |
| 1002 |
% \begin{macro}{\glyph_alias_i} |
| 1003 |
% The |\glyph_alias| macro has the syntax |
| 1004 |
% \begin{quote} |
| 1005 |
% |\glyph_alias|\marg{font's name} |
| 1006 |
% \end{quote} |
| 1007 |
% It expands to the \meta{alias name} corresponding to the |
| 1008 |
% \meta{font's name}, that had previously been set up using |
| 1009 |
% |\definealias|. Where this macro is used, it must already have |
| 1010 |
% been checked that |\GN-|\meta{font's name} is defined. |
| 1011 |
% \begin{macrocode} |
| 1012 |
\def\glyph_alias#1{ |
| 1013 |
\expandafter\expandafter \expandafter\glyph_alias_i |
| 1014 |
\csname GN-#1\endcsname |
| 1015 |
} |
| 1016 |
\def\glyph_alias_i#1#2{ |
| 1017 |
\expandafter\gobble_three \string#1 |
| 1018 |
} |
| 1019 |
% \end{macrocode} |
| 1020 |
% \end{macro}\end{macro} |
| 1021 |
% |
| 1022 |
% \begin{macrocode} |
| 1023 |
\let\charnameprefix\empty |
| 1024 |
\def\charnamealias#1{ |
| 1025 |
\if_defined{GN-\charnameprefix#1}\then |
| 1026 |
\glyph_alias{\charnameprefix#1} |
| 1027 |
\else\if_defined{GN-#1}\then |
| 1028 |
\glyph_alias{#1} |
| 1029 |
\else |
| 1030 |
#1 |
| 1031 |
\fi\fi |
| 1032 |
} |
| 1033 |
% \end{macrocode} |
| 1034 |
% |
| 1035 |
% \begin{macrocode} |
| 1036 |
\def\alias_incr#1{ |
| 1037 |
\expandafter\expandafter \expandafter\alias_incr_i |
| 1038 |
\csname GN-#1\endcsname |
| 1039 |
} |
| 1040 |
\def\alias_incr_i#1#2{ |
| 1041 |
\ifx#2\x_relax |
| 1042 |
\mathchardef#2=\@ne |
| 1043 |
\else |
| 1044 |
\a_count=#2 |
| 1045 |
\advance\a_count\@ne |
| 1046 |
\mathchardef#2=\a_count |
| 1047 |
\fi |
| 1048 |
} |
| 1049 |
% \end{macrocode} |
| 1050 |
% |
| 1051 |
% \begin{macrocode} |
| 1052 |
\def\alias_char_name#1{ |
| 1053 |
\if_defined{GN-\charnameprefix#1}\then |
| 1054 |
\edef\char_name{ |
| 1055 |
\string\aliased{#1}{\glyph_alias{\charnameprefix#1}} |
| 1056 |
} |
| 1057 |
\alias_incr{\charnameprefix#1} |
| 1058 |
\else\if_defined{GN-#1}\then |
| 1059 |
\edef\char_name{ |
| 1060 |
\string\aliased{#1}{\glyph_alias{#1}} |
| 1061 |
} |
| 1062 |
\alias_incr{#1} |
| 1063 |
\else |
| 1064 |
\edef\char_name{#1} |
| 1065 |
\fi\fi |
| 1066 |
} |
| 1067 |
\def\autoaliasafm{ |
| 1068 |
\begingroup |
| 1069 |
\list_def{N}(##1){\alias_char_name{##1}} |
| 1070 |
\def\afm_write_setkern##1##2##3{ |
| 1071 |
\out_line{ |
| 1072 |
\string\setkern{\charnamealias{##1}}{\charnamealias{##2}}{##3} |
| 1073 |
} |
| 1074 |
} |
| 1075 |
\def\init_cc##1{% |
| 1076 |
\edef\char_name{\charnamealias{##1}} |
| 1077 |
\out_line{\string\setglyph{\char_name}} |
| 1078 |
} |
| 1079 |
\list_def{PCC}(##1~##2~##3){ |
| 1080 |
\afm_length\a_count{##2} |
| 1081 |
\afm_length\b_count{##3} |
| 1082 |
\out_lline{\string\glyphpcc |
| 1083 |
{\charnamealias{##1}}{\the\a_count}{\the\b_count}} |
| 1084 |
} |
| 1085 |
} |
| 1086 |
\def\endautoaliasafm{\endgroup} |
| 1087 |
% \end{macrocode} |
| 1088 |
% |
| 1089 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1090 |
% |
| 1091 |
% \subsection{Converting a PL file to an MTX file} |
| 1092 |
% |
| 1093 |
% \DescribeMacro{\generalpltomtx}The macro |
| 1094 |
% \begin{quote} |
| 1095 |
% |\generalpltomtx|\marg{plfile}\marg{mtxfile}\marg{plsuffix}\relax |
| 1096 |
% \marg{opt-enc} |
| 1097 |
% \end{quote} |
| 1098 |
% reads \meta{plfile}|.|\meta{plsuffix}, interprets it as having the |
| 1099 |
% encoding specified by the file \meta{opt-enc}|.etx|, and writes the |
| 1100 |
% same metric information out to \meta{mtxfile}|.mtx|. In case |
| 1101 |
% \meta{opt-enc} is empty, the encoding will be determined using the |
| 1102 |
% |CODINGSCHEME| property of the file being read. |
| 1103 |
% \DescribeMacro{\pltomtx}The macro |
| 1104 |
% \begin{quote} |
| 1105 |
% |\pltomtx|\marg{plfile}\marg{mtxfile} |
| 1106 |
% \end{quote} |
| 1107 |
% reads \meta{plfile}|.pl|, uses the |CODINGSCHEME| property in that |
| 1108 |
% file to determine its encoding, and writes the same metric information |
| 1109 |
% out to \meta{mtxfile}|.mtx|. |
| 1110 |
% |
| 1111 |
% None of these commands can cope with |SKIP| properties in the (V)PL |
| 1112 |
% file. |
| 1113 |
% |
| 1114 |
% \begin{macro}{\generalpltomtx} |
| 1115 |
% \changes{1.902}{1999/05/01}{Command added, removed |
| 1116 |
% \cs{pltomtxgivenetx}. (LH)} |
| 1117 |
% \changes{1.910}{1999/11/01}{Made this command the standard one, |
| 1118 |
% which \cs{pltomtx} calls. (UV\&LH)} |
| 1119 |
% \changes{1.917}{2001/03/13}{Added resetting of |
| 1120 |
% \cs{setsomething_global}---assignments made here must be |
| 1121 |
% local. (LH)} |
| 1122 |
% \changes{1.923}{2002/12/03}{Changed test of fourth argument to |
| 1123 |
% instead of \cs{ifx} use \cs{if}. This is more versatile. (LH)} |
| 1124 |
% \begin{macrocode} |
| 1125 |
\def\generalpltomtx#1#2#3#4{{ |
| 1126 |
\let\setsomething_global=\x_relax |
| 1127 |
\let\setfontdimen=\pl_setfontdimen |
| 1128 |
\if _#4_ \else |
| 1129 |
\def\do_slot{\x_cs\let{name-\the\slot_number}\slot_name} |
| 1130 |
\def\do_boundary{\x_cs\let{name-BOUNDARYCHAR}\slot_name} |
| 1131 |
\inputetx{#4} |
| 1132 |
\let\CODINGSCHEME=\ignore_parens |
| 1133 |
\fi |
| 1134 |
\pl_to_mtx{#1}{#2}{#3}{\string\generalpltomtx{#1}{#2}{#3}{#4}} |
| 1135 |
}} |
| 1136 |
% \end{macrocode} |
| 1137 |
% \end{macro} |
| 1138 |
% |
| 1139 |
% \begin{macro}{\pltomtx} |
| 1140 |
% \begin{macrocode} |
| 1141 |
\def\pltomtx#1#2{\generalpltomtx{#1}{#2}{pl}{}} |
| 1142 |
% \end{macrocode} |
| 1143 |
% \end{macro} |
| 1144 |
% |
| 1145 |
% |
| 1146 |
% \begin{macro}{\pl_to_mtx} |
| 1147 |
% \changes{1.911}{1999/11/19}{\cs{edef}ing \cs{raw_font_name}. (LH)} |
| 1148 |
% The |\pl_to_mtx| macro contains all code that was common to |
| 1149 |
% |\pltomtx| and |\general|\-|pltomtx| before the former was redefined |
| 1150 |
% to a call of the latter. The structure of a call of |\pl_to_mtx| is |
| 1151 |
% \begin{quote} |
| 1152 |
% |\pl_to_mtx|\marg{plfile}\marg{mtxfile}\marg{plsuffix}\marg{call} |
| 1153 |
% \end{quote} |
| 1154 |
% \meta{call} is what should be written in the ``Created using:'' |
| 1155 |
% comment at the top of the MTX file written. |
| 1156 |
% \changes{1.921}{2002/07/27}{\cs{fromvpl} in \cs{storemapdata} does |
| 1157 |
% not have an argument. Fixed a bug that produced such an argument |
| 1158 |
% anyway. (LH)} |
| 1159 |
% \begin{macrocode} |
| 1160 |
\def\pl_to_mtx#1#2#3#4{ |
| 1161 |
\edef\raw_font_name{#1} |
| 1162 |
\open_out{\temp_prefix#2.mtx} |
| 1163 |
\out_line{\percent_char~Filename:~#2.mtx} |
| 1164 |
\out_line{\percent_char~Created~by:~tex~\jobname} |
| 1165 |
\out_line{\percent_char~Created~using:~#4} |
| 1166 |
\out_line{} |
| 1167 |
\out_line{\percent_char~This~file~contains~the~ |
| 1168 |
information~of~#1.#3~in~a~form} |
| 1169 |
\out_line{\percent_char~more~easily~read~by~TeX.~ |
| 1170 |
It~is~used~by~the~fontinst~package.} |
| 1171 |
\out_line{} |
| 1172 |
\out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.} |
| 1173 |
\out_line{} |
| 1174 |
\out_line{\string\relax} |
| 1175 |
\out_line{\string\metrics} |
| 1176 |
\out_line{} |
| 1177 |
\out_line{\string\needsfontinstversion{\fontinstversion}} |
| 1178 |
\out_line{} |
| 1179 |
\lowercase{ |
| 1180 |
\record_transform{#2}{ |
| 1181 |
\string\from#3 \x_cs\ifx{from#3}\frompl {#1} \fi |
| 1182 |
}{}\iftrue |
| 1183 |
} |
| 1184 |
\out_line{} |
| 1185 |
\catcode`\(=0 \catcode`\)=9 |
| 1186 |
\let\/=\ignore_parens |
| 1187 |
\let\do_pl_glyph=\x_relax |
| 1188 |
\primitiveinput #1.#3\x_relax |
| 1189 |
\do_pl_glyph |
| 1190 |
\out_line{} |
| 1191 |
\ifisint{\percent_char boundarychar}\then |
| 1192 |
\f_count=\int{\percent_char boundarychar} |
| 1193 |
\x_cs\ifx{name-\the\f_count}\x_relax \else |
| 1194 |
\out_line{\string\setstr{rightboundary} |
| 1195 |
{\csname name-\the\f_count\endcsname} |
| 1196 |
} |
| 1197 |
\out_line{} |
| 1198 |
\fi |
| 1199 |
\fi |
| 1200 |
\out_line{\endmetrics_text} |
| 1201 |
\close_out{Metrics} |
| 1202 |
} |
| 1203 |
% \end{macrocode} |
| 1204 |
% \end{macro} |
| 1205 |
% |
| 1206 |
% To parse a |.pl| file, we first make |(| the escape character, make |)| |
| 1207 |
% ignored, then define the various PL commands as \TeX\ control sequences. |
| 1208 |
% We can ignore a parenthesis matched string by making |(| and |)| the |
| 1209 |
% group delimiters, then gobbling them up. |
| 1210 |
% |
| 1211 |
% \begin{macrocode} |
| 1212 |
\def\ignore_parens{\bgroup\catcode`(=1 \catcode`)=2 \x_relax |
| 1213 |
\expandafter\expandafter\expandafter\gobble_parens |
| 1214 |
\iftrue\expandafter{\else}\fi} |
| 1215 |
\def\gobble_parens#1{\egroup} |
| 1216 |
% \end{macrocode} |
| 1217 |
% |
| 1218 |
% \begin{macro}{\pl_real} |
| 1219 |
% \begin{macro}{\pl_realer} |
| 1220 |
% Convert a PL real to an AFM unit, assuming it contains a decimal point. |
| 1221 |
% \begin{macrocode} |
| 1222 |
\def\pl_real#1{\pl_realer(#1000)} |
| 1223 |
\def\pl_realer(#1.#2#3#4#5){#1#2#3#4} |
| 1224 |
% \end{macrocode} |
| 1225 |
% \cs{pl_real} only works if the \texttt{DESIGNUNITS} |
| 1226 |
% setting is at the default value 1. Luckily, this is what |
| 1227 |
% \package{TFtoPL} and \package{VFtoVP} use in all (V)PL files they |
| 1228 |
% create, so you can always get a (V)PL file that will work by |
| 1229 |
% converting first to TFM (+\,VF) and then back again. As of v\,1.913, |
| 1230 |
% that is also the value \package{fontinst} uses for all VPL files it |
| 1231 |
% generates, so the problem isn't particularly important. |
| 1232 |
% \end{macro}\end{macro} |
| 1233 |
% |
| 1234 |
% \begin{macro}{\pl_rounded_real} |
| 1235 |
% \changes{1.921}{2002/07/26}{Macro added and is used instead of |
| 1236 |
% \cs{pl_real}. (LH)} |
| 1237 |
% The |\pl_rounded_real| macro is like |\pl_realer| in that it converts |
| 1238 |
% a PL unit containing a decimal point to an AFM unit. The difference |
| 1239 |
% is (i) that it rounds the number rather than truncating it and (ii) |
| 1240 |
% that it stores the result in |\result| rather than expanding to it. |
| 1241 |
% Note that the actual real (character string) to convert must be |
| 1242 |
% followed by at least four zeros for the conversion to work |
| 1243 |
% correctly in all cases. |
| 1244 |
% \begin{macrocode} |
| 1245 |
\def\pl_rounded_real(#1.#2#3#4#5){ |
| 1246 |
\global\result=#1#2#3#4\relax |
| 1247 |
\ifnum \first_char#5= >4 |
| 1248 |
\global\advance \result |
| 1249 |
\if - \first_char#1= \m@ne \else \@ne \fi |
| 1250 |
\fi |
| 1251 |
} |
| 1252 |
% \end{macrocode} |
| 1253 |
% \end{macro} |
| 1254 |
% |
| 1255 |
% |
| 1256 |
% \begin{macro}{\pl_int} |
| 1257 |
% Convert a PL int to a \TeX{} int, assuming it's prefixed |
| 1258 |
% by |C|, |D|, |O|, or |H|. |
| 1259 |
% \begin{macrocode} |
| 1260 |
\def\pl_int#1#2{ |
| 1261 |
\ifx#1C `#2 |
| 1262 |
\else\ifx#1D #2 |
| 1263 |
\else\ifx#1O '#2 |
| 1264 |
\else\ifx#1H "#2 |
| 1265 |
\else -1\errmessage{Unknown~PL~number~prefix~`#1'} |
| 1266 |
\fi\fi\fi\fi |
| 1267 |
} |
| 1268 |
% \end{macrocode} |
| 1269 |
% \end{macro} |
| 1270 |
% |
| 1271 |
% Many of the PL commands are ignored, and I'm assuming the |R|s are in |
| 1272 |
% the places \texttt{tftopl} puts them, which is a bit naughty of me. |
| 1273 |
% |
| 1274 |
% \begin{PLproperty}{FAMILY} |
| 1275 |
% \begin{PLproperty}{FACE} |
| 1276 |
% \begin{PLproperty}{CHECKSUM} |
| 1277 |
% \begin{PLproperty}{HEADER} |
| 1278 |
% \begin{PLproperty}{SEVENBITSAFEFLAG} |
| 1279 |
% \begin{macrocode} |
| 1280 |
\let\FAMILY=\ignore_parens |
| 1281 |
\let\FACE=\ignore_parens |
| 1282 |
\let\CHECKSUM=\ignore_parens |
| 1283 |
\def\HEADER~#1~#2~#3~#4~{} |
| 1284 |
\def\SEVENBITSAFEFLAG~#1~{} |
| 1285 |
% \end{macrocode} |
| 1286 |
% \end{PLproperty}\end{PLproperty}\end{PLproperty}\end{PLproperty} |
| 1287 |
% \end{PLproperty} |
| 1288 |
% |
| 1289 |
% \begin{PLproperty}{COMMENT} |
| 1290 |
% \begin{PLproperty}{LIG} |
| 1291 |
% \begin{PLproperty}{NEXTLARGER} |
| 1292 |
% \begin{PLproperty}{VARCHAR} |
| 1293 |
% \begin{macrocode} |
| 1294 |
\let\COMMENT=\ignore_parens |
| 1295 |
\let\LIG=\ignore_parens |
| 1296 |
\let\NEXTLARGER=\ignore_parens |
| 1297 |
\let\VARCHAR=\ignore_parens |
| 1298 |
% \end{macrocode} |
| 1299 |
% \end{PLproperty}\end{PLproperty}\end{PLproperty}\end{PLproperty} |
| 1300 |
% |
| 1301 |
% |
| 1302 |
% \begin{PLproperty}{VTITLE} |
| 1303 |
% \begin{PLproperty}{MAPFONT} |
| 1304 |
% \begin{PLproperty}{MAP} |
| 1305 |
% \begin{flushleft} |
| 1306 |
% ^^A Flushed left since the paragraph is so hard to break |
| 1307 |
% ^^A correctly. |
| 1308 |
% \changes{1.900}{1998/12/04}{VPL-specific properties added to |
| 1309 |
% those which are ignored by \cs{pltomtx}. (LH)} |
| 1310 |
% The properties which are unique for VPL files---|VTITLE|, |
| 1311 |
% |MAPFONT|, |MAP|, |FONTNAME|, |FONTAREA|, |FONTCHECKSUM|, |
| 1312 |
% |FONTAT|, |FONTDSIZE|, |SELECTFONT|, |SETCHAR|, |SETRULE|, |
| 1313 |
% |MOVERIGHT|, |MOVELEFT|, |MOVEUP|, |MOVEDOWN|, |PUSH|, |POP|, |
| 1314 |
% |SPECIAL|, and |SPECIALHEX|---should also be ignored, but it is |
| 1315 |
% actually sufficient to ignore the first three since the others |
| 1316 |
% are only allowed inside |MAP| or |MAPFONT| property lists. |
| 1317 |
% \end{flushleft} |
| 1318 |
% |
| 1319 |
% \begin{macrocode} |
| 1320 |
\let\VTITLE=\ignore_parens |
| 1321 |
\let\MAPFONT=\ignore_parens |
| 1322 |
\let\MAP=\ignore_parens |
| 1323 |
% \end{macrocode} |
| 1324 |
% \end{PLproperty}\end{PLproperty}\end{PLproperty} |
| 1325 |
% |
| 1326 |
% |
| 1327 |
% \begin{PLproperty}{CODINGSCHEME} |
| 1328 |
% \begin{macro}{\CODINGSCHEME_cont} |
| 1329 |
% When we reach a |CODINGSCHEME| instruction, we read the coding string, |
| 1330 |
% and read in the corresponding \meta{encoding}|.etx| file. |
| 1331 |
% |
| 1332 |
% The corresponding \meta{encoding} is specified by |\declareencoding| |
| 1333 |
% statements (see below). Each |\declare_encoding| defines a macro |
| 1334 |
% |\enc-|\meta{codingscheme} which expands to \meta{encoding}. |
| 1335 |
% |
| 1336 |
% If the PL file is converted using the |\generalpltomtx| command with |
| 1337 |
% a nonempty \meta{opt-enc} argument then the |CODINGSCHEME| instruction |
| 1338 |
% is ignored since an encoding file has already been read in. |
| 1339 |
% |
| 1340 |
% \begin{macrocode} |
| 1341 |
\def\CODINGSCHEME{\bgroup\catcode`\)=12\x_relax\CODINGSCHEME_cont} |
| 1342 |
\def\CODINGSCHEME_cont#1){ |
| 1343 |
\egroup |
| 1344 |
\if_undefined{enc-#1}\then |
| 1345 |
\errhelp{The~encoding~for~`#1'~has~not~been~declared.^^J |
| 1346 |
You~should~declare~it~with~ |
| 1347 |
\string\declareencoding{#1}{ETXFILE}.^^J |
| 1348 |
Press~<RETURN>~to~carry~on~with~fingers~crossed,^^J |
| 1349 |
or~X~<RETURN>~to~exit.} |
| 1350 |
\errmessage{Undeclared~encoding~`#1'} |
| 1351 |
\else |
| 1352 |
\def\do_slot{\x_cs\let{name-\the\slot_number}\slot_name} |
| 1353 |
\def\do_boundary{\x_cs\let{name-BOUNDARYCHAR}\slot_name} |
| 1354 |
\catcode`\(=12 \catcode`\)=12 |
| 1355 |
\x_cs\inputetx{enc-#1}\x_relax |
| 1356 |
\catcode`\(=0 \catcode`\)=9 |
| 1357 |
\fi |
| 1358 |
} |
| 1359 |
% \end{macrocode} |
| 1360 |
% \end{macro}\end{PLproperty} |
| 1361 |
% |
| 1362 |
% \begin{PLproperty}{DESIGNSIZE} |
| 1363 |
% The |DESIGNSIZE| is needed because the |FONTDSIZE| specified in a |
| 1364 |
% |MAPFONT| property list has to be the same as the |DESIGNSIZE| of |
| 1365 |
% the corresponding base font. |
| 1366 |
% \begin{macrocode} |
| 1367 |
\def\DESIGNSIZE~#1~#2~{ |
| 1368 |
\a_dimen=#2pt |
| 1369 |
\out_line{\string\setdim{designsize}{\the\a_dimen}} |
| 1370 |
} |
| 1371 |
% \end{macrocode} |
| 1372 |
% \end{PLproperty} |
| 1373 |
% |
| 1374 |
% \begin{PLproperty}{DESIGNUNITS} |
| 1375 |
% \changes{1.905}{1999/06/30}{Error message added. (LH)} |
| 1376 |
% \changes{1.912}{2000/02/20}{Store designunits value in |
| 1377 |
% \cs{b_dimen} rather than \cs{a_dimen}. \cs{a_dimen} holds the |
| 1378 |
% design size throughout PL-to-MTX. (LH)} |
| 1379 |
% The PL to MTX converter assumes that the (V)PL files to convert |
| 1380 |
% look like the ones created by \texttt{TFtoPL}\slash\texttt{VFtoVP}, |
| 1381 |
% and the interpretation of the \texttt{DESIGNUNITS} property is one |
| 1382 |
% thing specifically affected by this. The TFM file format does not |
| 1383 |
% store the \texttt{DESIGNUNITS} value used, so the two above |
| 1384 |
% programs always generate (V)PL files with the default setting of |
| 1385 |
% design unit equal to the design size. Hence any occurence of the |
| 1386 |
% \texttt{DESIGNUNITS} property with a nondefault value is an |
| 1387 |
% indication of an error. |
| 1388 |
% |
| 1389 |
% The incorrect metrics can be corrected by scaling by a suitable |
| 1390 |
% amount (1000 divided by the \texttt{designunits} dimen), but it is |
| 1391 |
% much simpler to convert the PL to a TFM and then convert it back, |
| 1392 |
% that will also fix the units. |
| 1393 |
% |
| 1394 |
% \begin{macrocode} |
| 1395 |
\def\DESIGNUNITS~#1~#2~{ |
| 1396 |
\b_dimen=#2pt\x_relax |
| 1397 |
\ifdim 1pt=\b_dimen \else |
| 1398 |
\fontinsterror{PL-to-MTX}{Nondefault~unit~used~in~PL~file} |
| 1399 |
{You~may~continue,~but~the~metrics~for~this~font~will~be~wrong.} |
| 1400 |
\fi |
| 1401 |
\out_line{\string\setdim{designunits}{\the\b_dimen}} |
| 1402 |
} |
| 1403 |
% \end{macrocode} |
| 1404 |
% \end{PLproperty} |
| 1405 |
% |
| 1406 |
% \begin{PLproperty}{BOUNDARYCHAR} |
| 1407 |
% \begin{macrocode} |
| 1408 |
\def\BOUNDARYCHAR~#1~#2~{ |
| 1409 |
\x_setint{\percent_char boundarychar}{\pl_int{#1}{#2}} |
| 1410 |
} |
| 1411 |
% \end{macrocode} |
| 1412 |
% \end{PLproperty} |
| 1413 |
% |
| 1414 |
% \changes{1.917}{2001/03/16}{Rewrote the fontdimen part of the |
| 1415 |
% (V)PL-to-MTX converter so that the ETX can specify the |
| 1416 |
% fontdimens. (LH)} |
| 1417 |
% |
| 1418 |
% Declared fontdimens are converted to |\setint| commands in the MTX |
| 1419 |
% file. A fontdimen declaration for fontdimen $n$ is stored in the |
| 1420 |
% control sequence \describecsfamily{fdimen-\meta{n}}|\fdimen-|$n$; if |
| 1421 |
% this control sequence is undefined then the fontdimen is not declared |
| 1422 |
% and if it is set then it is a macro which expands to the name of the |
| 1423 |
% corresponding integer variable. |
| 1424 |
% |
| 1425 |
% \begin{macro}{\pl_setfontdimen} |
| 1426 |
% Fontdimens are declared by the |\pl_setfontdimen| macro, which is a |
| 1427 |
% definition of |\setfontdimen| that is used during (V)PL-to-MTX |
| 1428 |
% conversion. |
| 1429 |
% \begin{macrocode} |
| 1430 |
\def\pl_setfontdimen#1#2{\x_cs\def{fdimen-#1}{#2}} |
| 1431 |
% \end{macrocode} |
| 1432 |
% \end{macro} |
| 1433 |
% |
| 1434 |
% \begin{PLproperty}{PARAMETER} |
| 1435 |
% The |PARAMETER| property is the generic specifier of fontdimens in |
| 1436 |
% (V)PL files. It takes two arguments: the fontdimen number (integer) |
| 1437 |
% and value (real). |
| 1438 |
% \begin{macrocode} |
| 1439 |
\def\PARAMETER~#1~#2~R~#3~{ |
| 1440 |
\f_count=\pl_int{#1}{#2}\x_relax |
| 1441 |
\if_defined{fdimen-\the\f_count}\then |
| 1442 |
\pl_rounded_real(#3 0000) |
| 1443 |
\out_line{\string\setint{\csname fdimen-\the\f_count\endcsname} |
| 1444 |
{\the\result}} |
| 1445 |
\fi |
| 1446 |
} |
| 1447 |
% \end{macrocode} |
| 1448 |
% \end{PLproperty} |
| 1449 |
% |
| 1450 |
% \begin{PLproperty}{FONTDIMEN} |
| 1451 |
% No special processing is required for the |FONTDIMEN| property. |
| 1452 |
% \begin{macrocode} |
| 1453 |
\let\FONTDIMEN=\x_relax |
| 1454 |
% \end{macrocode} |
| 1455 |
% \end{PLproperty} |
| 1456 |
% |
| 1457 |
% \begin{PLproperty}{SLANT} |
| 1458 |
% \begin{PLproperty}{SPACE} |
| 1459 |
% \begin{PLproperty}{STRETCH} |
| 1460 |
% \begin{PLproperty}{SHRINK} |
| 1461 |
% \begin{PLproperty}{XHEIGHT} |
| 1462 |
% \begin{PLproperty}{QUAD} |
| 1463 |
% \begin{PLproperty}{EXTRASPACE} |
| 1464 |
% The properties for the seven mandatory fontdimens are converted |
| 1465 |
% to the corresponding |PARAMETER| properties but their meanings are |
| 1466 |
% predeclared. The effect of these predeclarations is that even ETX |
| 1467 |
% files that don't use |\setfontdimen| to set the fontdimens have |
| 1468 |
% these fontdimens converted to |\setint|s. |
| 1469 |
% |
| 1470 |
% A scan shows that the current (2001/03/17) MTX and ETX files aren't |
| 1471 |
% using the integers \texttt{stretchword}, \texttt{shrinkword}, |
| 1472 |
% \texttt{quad}, and \texttt{extraspace}. They probably should. |
| 1473 |
% \begin{macrocode} |
| 1474 |
\def\SLANT{\PARAMETER D~1~} |
| 1475 |
\pl_setfontdimen{1}{italicslant} |
| 1476 |
\def\SPACE{\PARAMETER D~2~} |
| 1477 |
\pl_setfontdimen{2}{interword} |
| 1478 |
\def\STRETCH{\PARAMETER D~3~} |
| 1479 |
\pl_setfontdimen{3}{stretchword} |
| 1480 |
\def\SHRINK{\PARAMETER D~4~} |
| 1481 |
\pl_setfontdimen{4}{shrinkword} |
| 1482 |
\def\XHEIGHT{\PARAMETER D~5~} |
| 1483 |
\pl_setfontdimen{5}{xheight} |
| 1484 |
\def\QUAD{\PARAMETER D~6~} |
| 1485 |
\pl_setfontdimen{6}{quad} |
| 1486 |
\def\EXTRASPACE{\PARAMETER D~7~} |
| 1487 |
\pl_setfontdimen{7}{extraspace} |
| 1488 |
% \end{macrocode} |
| 1489 |
% \end{PLproperty}\end{PLproperty}\end{PLproperty}\end{PLproperty} |
| 1490 |
% \end{PLproperty}\end{PLproperty}\end{PLproperty} |
| 1491 |
% |
| 1492 |
% \begin{numPLproperty}{NUM}{1,2,3} |
| 1493 |
% \begin{numPLproperty}{DENOM}{1,2} |
| 1494 |
% The |NUM|$*$ and |DENOM|$*$ properties are for fontdimens 8--10 |
| 1495 |
% and 11--12. They have to do with positioning numerator and |
| 1496 |
% denominator in fractions. |
| 1497 |
% \begin{macrocode} |
| 1498 |
\def\NUM#1~#2~#3~{ |
| 1499 |
\ifcase #1\or |
| 1500 |
\PARAMETER D~8~#2~#3~ |
| 1501 |
\or |
| 1502 |
\PARAMETER D~9~#2~#3~ |
| 1503 |
\or |
| 1504 |
\PARAMETER D~10~#2~#3~ |
| 1505 |
\fi |
| 1506 |
} |
| 1507 |
\def\DENOM#1~#2~#3~{ |
| 1508 |
\ifcase #1\or |
| 1509 |
\PARAMETER D~11~#2~#3~ |
| 1510 |
\or |
| 1511 |
\PARAMETER D~12~#2~#3~ |
| 1512 |
\fi |
| 1513 |
} |
| 1514 |
% \end{macrocode} |
| 1515 |
% \end{numPLproperty}\end{numPLproperty} |
| 1516 |
% |
| 1517 |
% \begin{numPLproperty}{SUP}{1,2,3} |
| 1518 |
% \begin{numPLproperty}{SUB}{1,2} |
| 1519 |
% The |SUP|$*$ and |SUB|$*$ properties are for fontdimens 13--15 |
| 1520 |
% and 16--17. They have to do with positioning superscripts and |
| 1521 |
% subscripts. |
| 1522 |
% \begin{macrocode} |
| 1523 |
\def\SUP#1~#2~#3~{ |
| 1524 |
\ifcase #1\or |
| 1525 |
\PARAMETER D~13~#2~#3~ |
| 1526 |
\or |
| 1527 |
\PARAMETER D~14~#2~#3~ |
| 1528 |
\or |
| 1529 |
\PARAMETER D~15~#2~#3~ |
| 1530 |
\fi |
| 1531 |
} |
| 1532 |
\def\SUB#1~#2~#3~{ |
| 1533 |
\ifcase #1\or |
| 1534 |
\PARAMETER D~16~#2~#3~ |
| 1535 |
\or |
| 1536 |
\PARAMETER D~17~#2~#3~ |
| 1537 |
\fi |
| 1538 |
} |
| 1539 |
% \end{macrocode} |
| 1540 |
% \end{numPLproperty}\end{numPLproperty} |
| 1541 |
% |
| 1542 |
% \begin{PLproperty}{SUPDROP} |
| 1543 |
% \begin{PLproperty}{SUBDROP} |
| 1544 |
% \begin{PLproperty}{AXISHEIGHT} |
| 1545 |
% These are fontdimens 18, 19, and 22. |
| 1546 |
% \begin{macrocode} |
| 1547 |
\def\SUPDROP{\PARAMETER D~18~} |
| 1548 |
\def\SUBDROP{\PARAMETER D~19~} |
| 1549 |
\def\AXISHEIGHT{\PARAMETER D~22~} |
| 1550 |
% \end{macrocode} |
| 1551 |
% \end{PLproperty}\end{PLproperty}\end{PLproperty} |
| 1552 |
% |
| 1553 |
% \begin{numPLproperty}{DELIM}{1,2} |
| 1554 |
% The |DELIM|$*$ fondimens have number 20 and 21. They have to do with |
| 1555 |
% the size of delimiters put around a generalised fraction. |
| 1556 |
% \begin{macrocode} |
| 1557 |
\def\DELIM#1~#2~#3~{ |
| 1558 |
\ifcase #1\or |
| 1559 |
\PARAMETER D~20~#2~#3~ |
| 1560 |
\or |
| 1561 |
\PARAMETER D~21~#2~#3~ |
| 1562 |
\fi |
| 1563 |
} |
| 1564 |
% \end{macrocode} |
| 1565 |
% \end{numPLproperty} |
| 1566 |
% |
| 1567 |
% \begin{PLproperty}{DEFAULTRULETHICKNESS} |
| 1568 |
% \begin{numPLproperty}{BIGOPSPACING}{1,2,3,4,5} |
| 1569 |
% The fontdimen properties that are special for math extension fonts |
| 1570 |
% are |DEFAULT|\-|RULE|\-|THICKNESS| and the various |
| 1571 |
% |BIG|\-|OP|\-|SPACING|$*$. |
| 1572 |
% \begin{macrocode} |
| 1573 |
\def\DEFAULTRULETHICKNESS{\PARAMETER D~8~} |
| 1574 |
\def\BIGOPSPACING#1~#2~#3~{ |
| 1575 |
\ifcase #1\or |
| 1576 |
\PARAMETER D~9~#2~#3~ |
| 1577 |
\or |
| 1578 |
\PARAMETER D~10~#2~#3~ |
| 1579 |
\or |
| 1580 |
\PARAMETER D~11~#2~#3~ |
| 1581 |
\or |
| 1582 |
\PARAMETER D~12~#2~#3~ |
| 1583 |
\or |
| 1584 |
\PARAMETER D~13~#2~#3~ |
| 1585 |
\fi |
| 1586 |
} |
| 1587 |
% \end{macrocode} |
| 1588 |
% This is the old definition of |\DEFAULTRULETHICKNESS| for historical |
| 1589 |
% references (since its behaviour has changed). |
| 1590 |
% \begin{macrocode} |
| 1591 |
% \def\DEFAULTRULETHICKNESS~R~#1~{ |
| 1592 |
% \out_line{\string\setint{underlinethickness}{\pl_real{#1}}} |
| 1593 |
% } |
| 1594 |
% \end{macrocode} |
| 1595 |
% \end{numPLproperty}\end{PLproperty} |
| 1596 |
% |
| 1597 |
% |
| 1598 |
% \begin{PLproperty}{LABEL} |
| 1599 |
% \begin{macro}{\LABEL_slot} |
| 1600 |
% \begin{macro}{\LABEL_boundarychar} |
| 1601 |
% \begin{macro}{\do_if_defined} |
| 1602 |
% The most complicated part of the processing of the |LIGTABLE| |
| 1603 |
% property list is that it has to keep track of which glyphs the |
| 1604 |
% current ligature\slash kerning program applies to. This stored as |
| 1605 |
% a |\do|\marg{glyph} list in |\a_macro| and building this list |
| 1606 |
% is the job of the |LABEL| property. |
| 1607 |
% |
| 1608 |
% It is assumed that |\do| is |\never_do| whenever some element is |
| 1609 |
% added to |\a_macro|. |
| 1610 |
% \begin{macrocode} |
| 1611 |
\def\LABEL~#1{\ifx #1B |
| 1612 |
\expandafter\LABEL_boundarychar |
| 1613 |
\else |
| 1614 |
\expandafter\LABEL_slot \expandafter#1 |
| 1615 |
\fi |
| 1616 |
} |
| 1617 |
\def\LABEL_slot #1~#2~{ |
| 1618 |
\f_count=\pl_int{#1}{#2} |
| 1619 |
\edef\a_macro{\a_macro |
| 1620 |
\x_cs\do_if_defined{name-\the\f_count} |
| 1621 |
} |
| 1622 |
} |
| 1623 |
\def\LABEL_boundarychar OUNDARYCHAR{ |
| 1624 |
\edef\a_macro{\a_macro |
| 1625 |
\x_cs\do_if_defined{name-BOUNDARYCHAR} |
| 1626 |
} |
| 1627 |
} |
| 1628 |
\def\do_if_defined#1{\ifx #1\x_relax \else \do{#1} \fi} |
| 1629 |
% \end{macrocode} |
| 1630 |
% \end{macro}\end{macro}\end{macro}\end{PLproperty} |
| 1631 |
% |
| 1632 |
% |
| 1633 |
% \begin{PLproperty}{LIGTABLE} |
| 1634 |
% \begin{PLproperty}{STOP} |
| 1635 |
% \begin{PLproperty}{SKIP} |
| 1636 |
% The |LIGTABLE|, |STOP|, and |SKIP| properties are the remaining |
| 1637 |
% properties involved in managing the |\a_macro| list. |SKIP| |
| 1638 |
% properties are \emph{not} processed. |
| 1639 |
% \begin{macrocode} |
| 1640 |
\def\LIGTABLE{\let\do=\never_do\let\a_macro\empty_command} |
| 1641 |
\def\STOP{\let\a_macro\empty_command} |
| 1642 |
\def\SKIP~#1~#2~{\immediate\write16{Warning:~SKIP~instruction~ignored.}} |
| 1643 |
% \end{macrocode} |
| 1644 |
% \end{PLproperty}\end{PLproperty}\end{PLproperty} |
| 1645 |
% |
| 1646 |
% \begin{PLproperty}{KRN} |
| 1647 |
% \begin{macro}{\write_pl_krn} |
| 1648 |
% |KRN| properties are converted to |\setkern| instructions. |
| 1649 |
% \begin{macrocode} |
| 1650 |
\def\KRN~#1~#2~R~#3~{ |
| 1651 |
\pl_rounded_real(#3 0000) |
| 1652 |
\edef\do{\noexpand\write_pl_krn{\pl_int{#1}{#2}}{\the\result}} |
| 1653 |
\a_macro |
| 1654 |
\let\do=\never_do |
| 1655 |
} |
| 1656 |
\def\write_pl_krn#1#2#3{ |
| 1657 |
\f_count=#1\x_relax |
| 1658 |
\x_cs\ifx{name-\the\f_count}\x_relax \else |
| 1659 |
\out_line{\string\setkern{#3} |
| 1660 |
{\csname name-\the\f_count\endcsname}{#2} |
| 1661 |
} |
| 1662 |
\fi |
| 1663 |
} |
| 1664 |
% \end{macrocode} |
| 1665 |
% \end{macro}\end{PLproperty} |
| 1666 |
% |
| 1667 |
% \begin{PLproperty}{CHARACTER} |
| 1668 |
% \begin{PLproperty}{CHARWD} |
| 1669 |
% \begin{PLproperty}{CHARHT} |
| 1670 |
% \begin{PLproperty}{CHARDP} |
| 1671 |
% \begin{PLproperty}{CHARIC} |
| 1672 |
% The character metrics that are processed are |CHARWD|, |CHARHT|, |
| 1673 |
% |CHARDP|, and |CHARIC|. The |CHARACTER| property takes care of |
| 1674 |
% writing the information to the MTX file, but note that each new |
| 1675 |
% |CHARACTER| property writes the information from the preceeding |
| 1676 |
% |CHARACTER| property. |
| 1677 |
% \begin{macrocode} |
| 1678 |
\def\CHARWD~R~#1~{\pl_rounded_real(#1 0000) \b_count=\result} |
| 1679 |
\def\CHARHT~R~#1~{\pl_rounded_real(#1 0000) \c_count=\result} |
| 1680 |
\def\CHARDP~R~#1~{\pl_rounded_real(#1 0000) \d_count=\result} |
| 1681 |
\def\CHARIC~R~#1~{\pl_rounded_real(#1 0000) \e_count=\result} |
| 1682 |
\def\CHARACTER~#1~#2~{ |
| 1683 |
\do_pl_glyph |
| 1684 |
\a_count=\pl_int{#1}{#2} |
| 1685 |
\b_count=0 |
| 1686 |
\c_count=0 |
| 1687 |
\d_count=0 |
| 1688 |
\e_count=0 |
| 1689 |
\let\do_pl_glyph=\write_pl_glyph |
| 1690 |
} |
| 1691 |
% \end{macrocode} |
| 1692 |
% \end{PLproperty}\end{PLproperty}\end{PLproperty}\end{PLproperty} |
| 1693 |
% \end{PLproperty} |
| 1694 |
% |
| 1695 |
% \begin{macro}{\write_pl_glyph} |
| 1696 |
% The |\write_pl_glyph| actually writes the information contained in |
| 1697 |
% a |CHARACTER| property list to the MTX file as a |\setrawglyph| |
| 1698 |
% command. |
| 1699 |
% \begin{macrocode} |
| 1700 |
\def\write_pl_glyph{ |
| 1701 |
\x_cs\ifx{name-\the\a_count}\x_relax\else |
| 1702 |
\out_line{\string\setrawglyph |
| 1703 |
{\csname~name-\the\a_count\endcsname} |
| 1704 |
{\raw_font_name} |
| 1705 |
{\the\a_dimen} |
| 1706 |
{\the\a_count} |
| 1707 |
{\the\b_count} |
| 1708 |
{\the\c_count} |
| 1709 |
{\the\d_count} |
| 1710 |
{\the\e_count}} |
| 1711 |
\fi |
| 1712 |
} |
| 1713 |
% \end{macrocode} |
| 1714 |
% \end{macro} |
| 1715 |
% |
| 1716 |
% |
| 1717 |
% \subsection{Converting an MTX file to a PL file} |
| 1718 |
% |
| 1719 |
% \DescribeMacro{\mtxtopl} |
| 1720 |
% The macro |
| 1721 |
% \begin{quote} |
| 1722 |
% |\mtxtopl|\marg{mtxfile}\marg{plfile} |
| 1723 |
% \end{quote} |
| 1724 |
% writes a font from the |\setrawglyph| instructions in \meta{mtxfile} |
| 1725 |
% to \meta{plfile}. It ignores any font dimensions and kerning, so the |
| 1726 |
% resulting font is only useful for generating virtual fonts from. |
| 1727 |
% (This macro is called by |\transformfont|.) |
| 1728 |
% |
| 1729 |
% \begin{macro}{\mtxtopl} |
| 1730 |
% \changes{1.911}{1999/11/19}{Added `ligless' to one of the comment |
| 1731 |
% lines. (LH) Clarification requested by Walter Schmidt.} |
| 1732 |
% \changes{1.917}{2001/03/13}{Added resetting of |
| 1733 |
% \cs{setsomething_global}---assignments made here must be |
| 1734 |
% local. (LH)} |
| 1735 |
% \changes{1.929}{2005/02/05}{Corrected `\texttt{pltotf}' in |
| 1736 |
% comment. (LH)} |
| 1737 |
% \begin{macrocode} |
| 1738 |
\def\mtxtopl#1#2{{ |
| 1739 |
\let\setsomething_global=\x_relax |
| 1740 |
\open_out{#2.pl} |
| 1741 |
\top_of_pl_hook |
| 1742 |
\out_line{(COMMENT~raw~font~#2~created~by~fontinst~ |
| 1743 |
v\fontinstversion)} |
| 1744 |
\out_line{} |
| 1745 |
\out_line{(COMMENT~Filename:~#2.pl)} |
| 1746 |
\out_line{(COMMENT~Created~by:~tex~\jobname)} |
| 1747 |
\out_line{(COMMENT~Created~using:~\string\mtxtopl{#1}{#2})} |
| 1748 |
\out_line{} |
| 1749 |
\out_line{(COMMENT~This~file~can~be~turned~into~ |
| 1750 |
a~ligless~TeX~font~with)} |
| 1751 |
\out_line{(COMMENT~pltotf~#2.pl~#2.tfm)} |
| 1752 |
\out_line{} |
| 1753 |
\out_line{(COMMENT~THIS~FILE~CAN~THEN~BE~DELETED.)} |
| 1754 |
\out_line{} |
| 1755 |
\out_line{(DESIGNSIZE~R~10.0)} |
| 1756 |
\out_line{} |
| 1757 |
\let\setglyph=\iffalse |
| 1758 |
\let\endsetglyph=\fi |
| 1759 |
\let\setkern=\gobble_three |
| 1760 |
\let\setscaledrawglyph=\first_pl_raw_glyph |
| 1761 |
\def\setscalednotglyph##1##2##3##4##5##6##7##8##9{} |
| 1762 |
\inputmtx{#1} |
| 1763 |
\out_line{} |
| 1764 |
\out_line{(COMMENT~END~OF~FILE~#2.pl)} |
| 1765 |
\close_out{Raw~font} |
| 1766 |
}} |
| 1767 |
% \end{macrocode} |
| 1768 |
% \end{macro} |
| 1769 |
% |
| 1770 |
% \begin{macro}{\first_pl_raw_glyph} |
| 1771 |
% The |\first_pl_raw_glyph| writes the \texttt{DESIGNUNITS} property |
| 1772 |
% for the font when the first |\setscaledrawglyph| is encountered. |
| 1773 |
% This is to undo the scaling that has already been applied to the |
| 1774 |
% metrics, so that the metrics will match the actual font. |
| 1775 |
% \begin{macrocode} |
| 1776 |
\def\first_pl_raw_glyph#1#2#3#4{ |
| 1777 |
\out_line{(DESIGNUNITS~R~\make_factor{#4})} |
| 1778 |
\let\setscaledrawglyph=\pl_raw_glyph |
| 1779 |
\pl_raw_glyph{#1}{#2}{#3}{#4} |
| 1780 |
} |
| 1781 |
% \end{macrocode} |
| 1782 |
% \end{macro} |
| 1783 |
% |
| 1784 |
% \begin{macro}{\pl_raw_glyph} |
| 1785 |
% \begin{macrocode} |
| 1786 |
\def\pl_raw_glyph#1#2#3#4#5#6#7#8#9{ |
| 1787 |
\out_line{(CHARACTER~D~\number#5~\space(COMMENT~#1)} |
| 1788 |
\out_lline{(CHARWD~R~\make_factor{#6})} |
| 1789 |
\out_lline{(CHARHT~R~\make_factor{#7})} |
| 1790 |
\out_lline{(CHARDP~R~\make_factor{#8})} |
| 1791 |
\out_lline{(CHARIC~R~\make_factor{#9})} |
| 1792 |
\out_lline{)} |
| 1793 |
} |
| 1794 |
% \end{macrocode} |
| 1795 |
% \end{macro} |
| 1796 |
% |
| 1797 |
% |
| 1798 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 1799 |
% |
| 1800 |
% \section{Font transformations} |
| 1801 |
% \label{Sec:Font.trans} |
| 1802 |
% \changes{1.902}{1999/05/01}{Moved Section \thesection\space to |
| 1803 |
% \texttt{ficonv.dtx}. (LH)} |
| 1804 |
% |
| 1805 |
% \subsection{Transformable metric files} |
| 1806 |
% \label{Ssec:TransMTX} |
| 1807 |
% |
| 1808 |
% \changes{1.901}{1999/02/28}{Definition of transformable metric file |
| 1809 |
% added. (LH)} |
| 1810 |
% \changes{1.913}{2000/03/10}{Definition of transformable metric file |
| 1811 |
% changed to include the \cs{setscaledrawglyph} and |
| 1812 |
% \cs{setscalednotglyph} commands. (LH)} |
| 1813 |
% \changes{1.915}{2000/09/09}{Added description of \cs{aliased} macro |
| 1814 |
% to the definition of transformable metric files. (LH)} |
| 1815 |
% A \emph{transformable metric file} is a metric file |
| 1816 |
% which complies with certain restrictions in its syntax. The only |
| 1817 |
% metric commands allowed are |
| 1818 |
% \begin{isyntax} |
| 1819 |
% |\setscaledrawglyph|\marg{glyph}\marg{font}\marg{size}^^A |
| 1820 |
% \marg{scale}\marg{slot}\marg{width}\penalty0 |
| 1821 |
% \marg{height}\penalty0\marg{depth}\penalty0\marg{italic}\\ |
| 1822 |
% |\setrawglyph|\marg{glyph}\marg{font}\marg{size}\marg{slot}^^A |
| 1823 |
% \marg{width}\marg{height}\penalty0\marg{depth}\penalty0 |
| 1824 |
% \marg{italic}\\ |
| 1825 |
% |\setscalednotglyph|\marg{glyph}\marg{font}\marg{size}^^A |
| 1826 |
% \marg{scale}\marg{slot}\marg{width}\penalty0 |
| 1827 |
% \marg{height}\penalty0\marg{depth}\penalty0\marg{italic}\\ |
| 1828 |
% |\setnotglyph|\marg{glyph}\marg{font}\marg{size}\marg{slot}^^A |
| 1829 |
% \marg{width}\marg{height}\penalty0\marg{depth}\penalty0 |
| 1830 |
% \marg{italic}\\ |
| 1831 |
% |\setkern|\marg{glyph1}\marg{glyph2}\marg{amount}\\ |
| 1832 |
% |\setglyph|\marg{glyph} \meta{glyph commands} |\endsetglyph| |
| 1833 |
% \end{isyntax} |
| 1834 |
% where \meta{glyph}, \meta{glyph1}, \meta{glyph2}, and \meta{font} are |
| 1835 |
% strings without any variable references (no |\str| or |\strint| are |
| 1836 |
% allowed), \meta{scale}, \meta{slot}, \meta{width}, \meta{height}, |
| 1837 |
% \meta{depth}, \meta{italic}, and \meta{amount} are \TeX\ numbers, and |
| 1838 |
% \meta{size} is a \TeX\ dimen. (More accurately, all dimens in a |
| 1839 |
% transformable metric file should be on the form \meta{optional |
| 1840 |
% signs}\penalty0 \meta{decimal constant}\penalty0 \meta{physical unit}, |
| 1841 |
% but that's at the ``dangerous bend'' level.) The \meta{glyph}s may be |
| 1842 |
% of the form |
| 1843 |
% \begin{quote} |
| 1844 |
% |\aliased|\marg{font's name}\marg{alias name} |
| 1845 |
% \end{quote} |
| 1846 |
% Such \meta{glyph}s are interpreted as \meta{alias name} for all |
| 1847 |
% purposes except reencoding, when they are interpreted as \meta{font's |
| 1848 |
% name}. \meta{glyph}s of this form are furthermore copied as they are |
| 1849 |
% to MTX files created by |\transform|\-|font| (|\mtxtomtx|). |
| 1850 |
% |
| 1851 |
% The only \meta{glyph commands} allowed are |
| 1852 |
% \begin{quote} |
| 1853 |
% |\samesize|\marg{glyph}\\ |
| 1854 |
% |\glyphpcc|\marg{glyph}\marg{xoffset}\marg{yoffset} |
| 1855 |
% \end{quote} |
| 1856 |
% where \meta{glyph} is as above, and \meta{xoffset} and \meta{yoffset} |
| 1857 |
% are \TeX\ numbers. |
| 1858 |
% |
| 1859 |
% The only general commands allowed are |
| 1860 |
% \begin{quote} |
| 1861 |
% |\needsfontinstversion|\marg{version}\\ |
| 1862 |
% |\setint|\marg{name}\marg{number}\\ |
| 1863 |
% |\setdim|\marg{name}\marg{dimen}\\ |
| 1864 |
% |\setstr|\marg{name}\marg{string}\\ |
| 1865 |
% |\storemapdata|\marg{font}\marg{source}\marg{transformations} |
| 1866 |
% \end{quote} |
| 1867 |
% where \meta{name} and \meta{string} are strings without variable |
| 1868 |
% references, \meta{number} is a \TeX\ number, and \meta{dimen} is a |
| 1869 |
% \TeX\ dimen. The arguments of |\needs|\-|fontinst|\-|version| and |
| 1870 |
% |\store|\-|map|\-|data| are as usual, but these commands do not get |
| 1871 |
% copied in a font transformation. |
| 1872 |
% |
| 1873 |
% The metric files produced by |\afmtomtx| and |\generalpltomtx| are |
| 1874 |
% meant to be transformable. If they are not then there is a bug |
| 1875 |
% somewhere. |
| 1876 |
% |
| 1877 |
% The name of the integer in |\setint| commands is interpreted. This |
| 1878 |
% name is used to determine how the number should be transformed, see |
| 1879 |
% the implementation of |\mtxtomtx_setint| below. |
| 1880 |
% |
| 1881 |
% |
| 1882 |
% \subsection{Making font transformations} |
| 1883 |
% |
| 1884 |
% \changes{1.911}{1999/11/19}{Recording of transformations moved to the |
| 1885 |
% macros that actually write the MTX files. (LH)} |
| 1886 |
% \changes{1.911}{1999/11/19}{Flag for that source font wasn't found |
| 1887 |
% changed to \texttt{afm-name}. \texttt{transform-source} string |
| 1888 |
% completely removed. (LH)} |
| 1889 |
% \changes{1.913}{2000/03/11}{New implementation of \cs{scalefont} and |
| 1890 |
% \cs{yscalefont}, using the new \cs{setscaledrawglyph} and |
| 1891 |
% \cs{setscalednotglyph} commands. (LH)} |
| 1892 |
% \changes{1.913}{2000/03/12}{Using \cs{slots-}\meta{glyph} control |
| 1893 |
% sequences for storing encoding positions of glyphs in reencoded |
| 1894 |
% fonts. (LH)} |
| 1895 |
% |
| 1896 |
% \DescribeMacro{\transformfont} |
| 1897 |
% The macro: |
| 1898 |
% \begin{quote} |
| 1899 |
% |\transformfont|\marg{font-name}\marg{transformed font} |
| 1900 |
% \end{quote} |
| 1901 |
% transforms the metrics of a raw font. As far as \TeX\ is concerned, |
| 1902 |
% \meta{font-name} will be a new font. Actually doing the |
| 1903 |
% transformation and providing the transformed font (as opposed to the |
| 1904 |
% metrics of the transformed font) is for most transforms up to some |
| 1905 |
% other piece of software, in most cases the DVI driver, but |
| 1906 |
% \package{fontinst} will handle isotropic scaling itself. |
| 1907 |
% |
| 1908 |
% The easiest way to find out which transformations need to be carried |
| 1909 |
% out is to generate a map file for the \texttt{debug} ``driver'' (see |
| 1910 |
% Section~\ref{Sec:Mapfiles}). Of course, if \package{fontinst} can |
| 1911 |
% generate a mapfile for the target driver then you probably don't need |
| 1912 |
% to find out which transformations were necessary\,\textellipsis |
| 1913 |
% \spacefactor=\sfcode`\.\space\space |
| 1914 |
% In any case, the arguments of |\storemapdata| in the MTX file |
| 1915 |
% generated will tell which transformations of this |\transformfont| |
| 1916 |
% command that must be performed by some other software. |
| 1917 |
% |
| 1918 |
% \DescribeMacro{\fromafm} |
| 1919 |
% \DescribeMacro{\frommtx} |
| 1920 |
% \DescribeMacro{\frompl} |
| 1921 |
% \DescribeMacro{\scalefont} |
| 1922 |
% \DescribeMacro{\xscalefont} |
| 1923 |
% \DescribeMacro{\yscalefont} |
| 1924 |
% \DescribeMacro{\slantfont} |
| 1925 |
% \DescribeMacro{\reencodefont} |
| 1926 |
% The \meta{transformed font} commands are: |
| 1927 |
% \begin{quote} |
| 1928 |
% |\fromafm|\marg{AFM file}\\ |
| 1929 |
% |\frompl|\marg{PL file}\\ |
| 1930 |
% |\fromplgivenetx|\marg{PL file}\marg{etx}\\ |
| 1931 |
% |\frommtx|\marg{MTX file}\\ |
| 1932 |
% |\fromany|\marg{file}\\ |
| 1933 |
% |\scalefont|\marg{integer expression}\marg{transformed font}\\ |
| 1934 |
% |\xscalefont|\marg{integer expression}\marg{transformed font}\\ |
| 1935 |
% |\yscalefont|\marg{integer expression}\marg{transformed font}\\ |
| 1936 |
% |\slantfont|\marg{integer expression}\marg{transformed font}\\ |
| 1937 |
% |\reencodefont|\marg{etx}\marg{transformed font} |
| 1938 |
% \end{quote} |
| 1939 |
% |
| 1940 |
% Each |\transformfont| command generates an |.mtx| file for |
| 1941 |
% \meta{font-name} and a corresponding raw |.pl| file, which is written |
| 1942 |
% out by |\mtxtopl|. |
| 1943 |
% |
| 1944 |
% Each |\fromafm|, |\frompl|, or |\fromplgivenetx| command also generates |
| 1945 |
% an |.mtx| file for the source font, which is written out by |\afmtomtx| |
| 1946 |
% or |\generalpltomtx|. In addition, |\fromafm| also uses |\mtxtopl| |
| 1947 |
% to generate a corresponding raw |.pl| file. |
| 1948 |
% |
| 1949 |
% |\fromany| reads an MTX, PL, AFM, or VPL file depending on what it can |
| 1950 |
% find. It tries them in the order first MTX, then PL, then AFM, and |
| 1951 |
% last VPL. |
| 1952 |
% |
| 1953 |
% \begin{macro}{\transformfont} |
| 1954 |
% \changes{1.912}{2000/01/15}{Added local resetting of |
| 1955 |
% \cs{setsomething_global} to \cs{relax}, since \cs{transformfont} |
| 1956 |
% assumes such assignments are local. (LH)} |
| 1957 |
% \begin{macrocode} |
| 1958 |
\def\transformfont#1#2{{ |
| 1959 |
\let\setsomething_global=\x_relax |
| 1960 |
\unsetstr{afm-name} |
| 1961 |
\unsetstr{etx-name} |
| 1962 |
\x_resetint{x-scale}{\one_thousand} |
| 1963 |
\x_resetint{y-scale}{\one_thousand} |
| 1964 |
\x_resetint{slant-scale}{0} |
| 1965 |
#2 |
| 1966 |
% \end{macrocode} |
| 1967 |
% \changes{1.903}{1999/06/01}{Added behaviour for the case source file |
| 1968 |
% not found. (LH)} |
| 1969 |
% \changes{1.921}{2002/07/31}{Corrected an error message that tried |
| 1970 |
% to use a variable that wasn't set! (LH)} |
| 1971 |
% \begin{macrocode} |
| 1972 |
\ifisstr{afm-name}\then |
| 1973 |
\mtxtomtx{\str{afm-name}}{#1} |
| 1974 |
\mtxtopl{#1}{#1} |
| 1975 |
\else |
| 1976 |
\fontinsterror{Transformfont}{ |
| 1977 |
Failed~to~make~transformed~font~#1;\messagebreak |
| 1978 |
source~font~metrics~file~not~found |
| 1979 |
}\error_help_a |
| 1980 |
\fi |
| 1981 |
}} |
| 1982 |
% \end{macrocode} |
| 1983 |
% \end{macro} |
| 1984 |
% |
| 1985 |
% \begin{macro}{\fromafm} |
| 1986 |
% \changes{1.904}{1999/06/17}{Added call of \cs{record_transform}. (LH)} |
| 1987 |
% \changes{1.911}{1999/11/19}{Added test for file existence. (LH)} |
| 1988 |
% \begin{macrocode} |
| 1989 |
\def\fromafm#1{ |
| 1990 |
\if_file_exists{#1.afm}\then |
| 1991 |
\x_setstr{afm-name}{#1} |
| 1992 |
\afmtomtx{#1}{#1} |
| 1993 |
\mtxtopl{#1}{#1} |
| 1994 |
\fi |
| 1995 |
} |
| 1996 |
% \end{macrocode} |
| 1997 |
% \end{macro} |
| 1998 |
% \begin{macro}{\frommtx} |
| 1999 |
% \changes{1.911}{1999/11/19}{Added test for file existence. (LH)} |
| 2000 |
% \begin{macrocode} |
| 2001 |
\def\frommtx#1{ |
| 2002 |
\if_file_exists{#1.mtx}\then \x_setstr{afm-name}{#1} \fi |
| 2003 |
} |
| 2004 |
% \end{macrocode} |
| 2005 |
% \end{macro} |
| 2006 |
% |
| 2007 |
% \begin{macro}{\frompl} |
| 2008 |
% \changes{1.904}{1999/06/17}{Added call of \cs{record_transform}. (LH)} |
| 2009 |
% \changes{1.911}{1999/11/19}{Added test for file existence. (LH)} |
| 2010 |
% \begin{macro}{\fromplgivenetx} |
| 2011 |
% \changes{1.902}{1999/05/02}{Command added. (LH)} |
| 2012 |
% \changes{1.904}{1999/06/17}{Added call of \cs{record_transform}. (LH)} |
| 2013 |
% \changes{1.911}{1999/11/19}{Added test for file existence. (LH)} |
| 2014 |
% \begin{macrocode} |
| 2015 |
\def\frompl#1{ |
| 2016 |
\if_file_exists{#1.pl}\then |
| 2017 |
\x_setstr{afm-name}{#1} |
| 2018 |
\generalpltomtx{#1}{#1}{pl}{} |
| 2019 |
\fi |
| 2020 |
} |
| 2021 |
% \end{macrocode} |
| 2022 |
% \begin{macrocode} |
| 2023 |
\def\fromplgivenetx#1#2{ |
| 2024 |
\if_file_exists{#1.pl}\then |
| 2025 |
\x_setstr{afm-name}{#1} |
| 2026 |
\generalpltomtx{#1}{#1}{pl}{#2} |
| 2027 |
\fi |
| 2028 |
} |
| 2029 |
% \end{macrocode} |
| 2030 |
% \end{macro} \end{macro} |
| 2031 |
% |
| 2032 |
% \multchanges{\cs{fromvpl}\cs{fromvplgivenetx}}{1.902}{1999/05/02} |
| 2033 |
% {Commands added. (LH)} |
| 2034 |
% \multchanges{\cs{fromvpl}\cs{fromvplgivenetx}}{1.904}{1999/06/16} |
| 2035 |
% {Commands removed. (LH)} |
| 2036 |
% Regarding \cs{fromvpl} and \cs{fromvplgivenetx}: I realized that |
| 2037 |
% there isn't any point in reading metrics for a font that is to be |
| 2038 |
% transformed from a VPL file, since no driver I know of can transform |
| 2039 |
% virtual fonts. If someone has a problem with this then I suppose he |
| 2040 |
% or she should send word about it. /LH |
| 2041 |
% |
| 2042 |
% |
| 2043 |
% \begin{macro}{\fromany} |
| 2044 |
% \changes{1.903}{1999/05/20}{Command added. (LH) Based on a |
| 2045 |
% suggestion by Vladimir Volovich.} |
| 2046 |
% \changes{1.903}{1999/06/01}{Added behaviour for AFM not found case. |
| 2047 |
% (LH)} |
| 2048 |
% \changes{1.904}{1999/06/16}{Added search for VPL file and calls to |
| 2049 |
% \cs{record_transform}. (LH)} |
| 2050 |
% \changes{1.923}{2002/12/03}{Added \cs{pl_encoding}. (LH)} |
| 2051 |
% \changes{1.926}{2003/07/10}{Removed \cs{pl_encoding}; it is better |
| 2052 |
% to provide that functionality in a separate macro. (LH)} |
| 2053 |
% \changes{1.926}{2003/07/10}{Has to reset the \texttt{afm-name} |
| 2054 |
% string, since \cs{input_mtx_file} now uses the value. (LH)} |
| 2055 |
% The |\fromany| transformed font command searches for font metrics |
| 2056 |
% for \#1 by looking for, in turn, the files \#1|.mtx|, \#1|.pl|, |
| 2057 |
% \#1|.afm|, and \#1|.vpl|. If an MTX file doesn't exist, it is |
| 2058 |
% generated, and if the MTX is generated from an AFM then a |
| 2059 |
% corresponding (non-ligful) PL file is generated as well. |\fromany| |
| 2060 |
% also sets the fontinst string \texttt{afm-name} according |
| 2061 |
% to what kind of font it found. If none of the fonts existed then |
| 2062 |
% |afm-name| is unset. |
| 2063 |
% \begin{macrocode} |
| 2064 |
\def\fromany#1{ |
| 2065 |
\x_cs\edef{s-afm-name}{#1} |
| 2066 |
\if_file_exists{#1.mtx}\then\else |
| 2067 |
% \end{macrocode} |
| 2068 |
% |
| 2069 |
% \changes{1.6}{1997/01/15}{Search order changed to PL before AFM. |
| 2070 |
% (SPQR) The code wasn't in \cs{fromany} back then, though.} |
| 2071 |
% 1997/01/15 SPQR changed the below search order to |.pl| before |.afm| |
| 2072 |
% because of the |cmr*.afm| files found in the |TEXMF|\slash |
| 2073 |
% |fonts|\slash|afm| hierarchy. |
| 2074 |
% \begin{macrocode} |
| 2075 |
\if_file_exists{#1.pl}\then |
| 2076 |
\generalpltomtx{#1}{#1}{pl}{} |
| 2077 |
\else |
| 2078 |
\if_file_exists{#1.afm}\then |
| 2079 |
\afmtomtx{#1}{#1} |
| 2080 |
\mtxtopl{#1}{#1} |
| 2081 |
\else |
| 2082 |
\if_file_exists{#1.vpl}\then |
| 2083 |
\generalpltomtx{#1}{#1}{vpl}{} |
| 2084 |
\else |
| 2085 |
\unsetstr{afm-name} |
| 2086 |
\fi\fi\fi\fi |
| 2087 |
} |
| 2088 |
% \end{macrocode} |
| 2089 |
% \end{macro} |
| 2090 |
% |
| 2091 |
% |
| 2092 |
% \subsubsection*{The mathematical basis for the metric font transformations} |
| 2093 |
% |
| 2094 |
% Mathematically, all the metric font transformations (|\scale|\-|font|, |
| 2095 |
% |\xscale|\-|font|, |\yscale|\-|font|, and |\slant|\-|font|) are linear |
| 2096 |
% mappings of the real plane onto itself. All quantities in a |
| 2097 |
% transformable metric file are interpreted as being determined by some |
| 2098 |
% point in this plane and hence their transformation depends on how that |
| 2099 |
% point would be moved by the metric font transformations performed. |
| 2100 |
% This is usually simpler than it sounds, since all quantities except |
| 2101 |
% |italicslant| are interpreted as either the $x$- or the $y$-coordinate |
| 2102 |
% of some point. |italicslant| is interpreted as the quotient |
| 2103 |
% $\frac{x}{y}$ for a point. |
| 2104 |
% |
| 2105 |
% The best way to describe a linear mapping of the real plane to itself |
| 2106 |
% is by a \(2 \times 2\) matrix whose components are real numbers. Since |
| 2107 |
% true real numbers are not available in \TeX, integers are used instead, |
| 2108 |
% with the convention that they are in units of thousandths. In a |
| 2109 |
% concrete form this means that $0$ represents $0$, $500$ represents |
| 2110 |
% $\frac{1}{2}$, $1000$ represents $1$, etc. This works just as for the |
| 2111 |
% scaling factors used in |\scale|. It also means that the matrix |
| 2112 |
% $$ |
| 2113 |
% \left(\begin{array}{cc} 1000 & 0 \\ 0 & 1000 \end{array}\right) |
| 2114 |
% $$ |
| 2115 |
% represents the identity mapping (the mapping taking everything to |
| 2116 |
% itself). |
| 2117 |
% |
| 2118 |
% Thinking of points as column vectors (\(2 \times 1\) matrices) with |
| 2119 |
% the $x$-coordinate in the first component and the $y$-coordinate in |
| 2120 |
% the second, the respective elementary metric font transformations |
| 2121 |
% correspond to the following matrices: |
| 2122 |
% \begin{eqnarray*} |
| 2123 |
% \mbox{\cs{scalefont}\marg{n}} & \mbox{is} & |
| 2124 |
% \left( \begin{array}{cc} |
| 2125 |
% \mbox{\meta{n}}& 0 \\ |
| 2126 |
% 0 & \mbox{\meta{n}} |
| 2127 |
% \end{array} \right) \\ |
| 2128 |
% \mbox{\cs{xscalefont}\marg{n}} & \mbox{is} & |
| 2129 |
% \left( \begin{array}{cc} |
| 2130 |
% \mbox{\meta{n}}& 0 \\ |
| 2131 |
% 0 & 1000 |
| 2132 |
% \end{array} \right) \\ |
| 2133 |
% \mbox{\cs{yscalefont}\marg{n}} & \mbox{is} & |
| 2134 |
% \left( \begin{array}{cc} |
| 2135 |
% 1000 & 0 \\ |
| 2136 |
% 0 & \mbox{\meta{n}} |
| 2137 |
% \end{array} \right) \\ |
| 2138 |
% \mbox{\cs{slantfont}\marg{n}} & \mbox{is} & |
| 2139 |
% \left( \begin{array}{cc} |
| 2140 |
% 1000 & \mbox{\meta{n}} \\ |
| 2141 |
% 0 & 1000 |
| 2142 |
% \end{array} \right) |
| 2143 |
% \end{eqnarray*} |
| 2144 |
% Since all these matrices are upper triangular, all products of such |
| 2145 |
% matrices (corresponding to compositions of the linear mappings) will be |
| 2146 |
% upper triangular as well. It is therefore unnecessary to store the |
| 2147 |
% subdiagonal component anywhere (it is always zero), and hence |
| 2148 |
% \package{fontinst} represents an arbitrary metric transform by the |
| 2149 |
% matrix |
| 2150 |
% $$ |
| 2151 |
% \left( \begin{array}{cc} |
| 2152 |
% \mbox{\texttt{x-scale}} & \mbox{\texttt{slant-scale}} \\ |
| 2153 |
% 0 & \mbox{\texttt{y-scale}} |
| 2154 |
% \end{array} \right) |
| 2155 |
% $$ |
| 2156 |
% where \texttt{x-scale}, \texttt{y-scale}, and \texttt{slant-scale} |
| 2157 |
% are fontinst integers. |
| 2158 |
% |
| 2159 |
% The reason there is a representation of arbitrary metric transforms |
| 2160 |
% is that all the elementary metric transforms listed in the second |
| 2161 |
% argument of |\transformfont| are concatenated before the actual font |
| 2162 |
% file conversion is made. This reduces the amount of calculations |
| 2163 |
% performed in case there are many transformations of the font. |
| 2164 |
% |
| 2165 |
% Why do we only consider transformations that correspond to upper |
| 2166 |
% triangular matrices? Well, a transformation corresponds to an upper |
| 2167 |
% triangular matrix if and only if it leaves horizontal lines horizontal. |
| 2168 |
% Since in particular the baseline must always be horizontal in \TeX, |
| 2169 |
% there is no point in considering other linear transformations. |
| 2170 |
% |
| 2171 |
% \begin{macro}{\scalefont} |
| 2172 |
% \begin{macro}{\xscalefont} |
| 2173 |
% \begin{macro}{\yscalefont} |
| 2174 |
% \begin{macro}{\slantfont} |
| 2175 |
% \begin{macro}{\reencodefont} |
| 2176 |
% \begin{macrocode} |
| 2177 |
\def\scalefont#1#2{ |
| 2178 |
\eval_expr_to\d_count{#1} |
| 2179 |
\x_resetint{x-scale}{\scale{\d_count}{\int{x-scale}}} |
| 2180 |
\x_resetint{y-scale}{\scale{\d_count}{\int{y-scale}}} |
| 2181 |
\x_resetint{slant-scale}{\scale{\d_count}{\int{slant-scale}}} |
| 2182 |
#2 |
| 2183 |
} |
| 2184 |
\def\xscalefont#1#2{ |
| 2185 |
\x_resetint{x-scale}{\scale{#1}{\int{x-scale}}} |
| 2186 |
#2 |
| 2187 |
} |
| 2188 |
\def\yscalefont#1#2{ |
| 2189 |
\eval_expr_to\d_count{#1} |
| 2190 |
\x_resetint{y-scale}{\scale{\d_count}{\int{y-scale}}} |
| 2191 |
\x_resetint{slant-scale}{\scale{\d_count}{\int{slant-scale}}} |
| 2192 |
#2 |
| 2193 |
} |
| 2194 |
\def\slantfont#1#2{ |
| 2195 |
\x_resetint{slant-scale}{ |
| 2196 |
\add{\scale{#1}{\int{x-scale}}}{\int{slant-scale}} |
| 2197 |
} |
| 2198 |
#2 |
| 2199 |
} |
| 2200 |
\def\reencodefont#1#2{ |
| 2201 |
#2 |
| 2202 |
\resetstr{etx-name}{#1} |
| 2203 |
} |
| 2204 |
% \end{macrocode} |
| 2205 |
% \end{macro} |
| 2206 |
% \end{macro} |
| 2207 |
% \end{macro} |
| 2208 |
% \end{macro} |
| 2209 |
% \end{macro} |
| 2210 |
% |
| 2211 |
% That's only half the story, however. It is true that the transformation |
| 2212 |
% matrix, as computed by |\scalefont|, |\slantfont|, |\xscalefont|, and |
| 2213 |
% |\yscalefont| above, is used for transforming the font metrics, but it |
| 2214 |
% is not directly used for transforming the font itself. Instead it is |
| 2215 |
% factorized as |
| 2216 |
% $$ |
| 2217 |
% \left( \begin{array}{cc} |
| 2218 |
% x & s \\ 0 & y |
| 2219 |
% \end{array} \right) = |
| 2220 |
% y \left( \begin{array}{cc} |
| 2221 |
% x/y & s/y \\ 0 & 1 |
| 2222 |
% \end{array} \right) |
| 2223 |
% $$ |
| 2224 |
% Here the scalar factor $y$ will be used to scale the \meta{scale} |
| 2225 |
% argument of |\set|\-|scaled|\-|raw|\-|glyph| and |
| 2226 |
% |\set|\-|scaled|\-|not|\-|glyph| commands, whereas the matrix |
| 2227 |
% factor will be put in the third argument of |\store|\-|map|\-|data| |
| 2228 |
% in the MTX file written. Thus \package{fontinst} will handle the |
| 2229 |
% scalar factor of the transformation itself, but leave the matrix |
| 2230 |
% factor for some other software to take care of. |
| 2231 |
% |
| 2232 |
% \bigskip |
| 2233 |
% |
| 2234 |
% |
| 2235 |
% \DescribeMacro{\mtxtomtx} |
| 2236 |
% The macro: |
| 2237 |
% \begin{quote} |
| 2238 |
% |\mtxtomtx|\marg{source MTX}\marg{destination MTX} |
| 2239 |
% \end{quote} |
| 2240 |
% converts the first |.mtx| file to the second, using the current values |
| 2241 |
% of |\int{x-scale}|, |\int{y-scale}|, |\int{slant-scale}|, and |
| 2242 |
% |\str{etx-name}|. |
| 2243 |
% |
| 2244 |
% NOTE: this doesn't convert arbitrary |.mtx| files, just the |
| 2245 |
% transformable ones. |
| 2246 |
% |
| 2247 |
% \begin{macro}{\mtxtomtx} |
| 2248 |
% \changes{1.911}{1999/11/19}{\cs{edef}ing \cs{raw_font_name}. (LH)} |
| 2249 |
% \changes{1.915}{2000/09/09}{Locally redefining \cs{aliased}. (LH)} |
| 2250 |
% \changes{1.924}{2003/02/08}{Added \cs{directfalse}. (LH)} |
| 2251 |
% \changes{1.931}{2005/05/13}{Placed ETX processing after |
| 2252 |
% \cs{needsfontinstversion} had been written, so that ETX commands |
| 2253 |
% can write data directly to the output MTX file. (LH)} |
| 2254 |
% \changes{1.931}{2005/05/13}{Copying \cs{declarepsencoding} data to |
| 2255 |
% generated MTX file as a \cs{setpsencoding} command. (LH)} |
| 2256 |
% \begin{macrocode} |
| 2257 |
\def\mtxtomtx#1#2{{ |
| 2258 |
\let\a_macro=\empty_command |
| 2259 |
\_a_true |
| 2260 |
\ifnum \int{x-scale}=\int{y-scale} |
| 2261 |
\ifnum \int{slant-scale}=\z@ |
| 2262 |
\_a_false |
| 2263 |
\fi \fi |
| 2264 |
\if_a_ |
| 2265 |
\a_count=\int{x-scale} |
| 2266 |
\l_inv_scale\a_count{\int{y-scale}} |
| 2267 |
\b_count=\int{slant-scale} |
| 2268 |
\l_inv_scale\b_count{\int{y-scale}} |
| 2269 |
\edef\a_macro{\a_macro |
| 2270 |
\string\transformfont{\the\a_count}{\the\b_count} |
| 2271 |
} |
| 2272 |
\fi |
| 2273 |
\open_out{\temp_prefix#2.mtx} |
| 2274 |
\edef\raw_font_name{#2} |
| 2275 |
\out_line{\percent_char~Filename:~#2.mtx} |
| 2276 |
\out_line{\percent_char~Created~by:~tex~\jobname} |
| 2277 |
\out_line{\percent_char~Created~using:~\string\mtxtomtx{#1}{#2}} |
| 2278 |
\out_line{} |
| 2279 |
\out_line{\percent_char~This~file~is~used~by~the~fontinst~package.} |
| 2280 |
\out_line{} |
| 2281 |
\out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.} |
| 2282 |
\out_line{} |
| 2283 |
\out_line{\string\relax} |
| 2284 |
\out_line{\string\metrics} |
| 2285 |
\out_line{} |
| 2286 |
\out_line{\string\needsfontinstversion{\fontinstversion}} |
| 2287 |
\out_line{} |
| 2288 |
\ifisstr{etx-name}\then |
| 2289 |
\def\do_slot{\x_cs\edef{slots-\slot_name}{\the\slot_number}} |
| 2290 |
\def\declarepsencoding##1##2##3{ |
| 2291 |
\a_toks={{##1}{##2}{##3}} |
| 2292 |
\out_line{\string\providepsencoding\the\a_toks} |
| 2293 |
\ifnum \transform_record_file=\closed_stream \else |
| 2294 |
\pout_line\transform_record_file |
| 2295 |
{\string\providepsencoding\the\a_toks} |
| 2296 |
\fi |
| 2297 |
} |
| 2298 |
\directfalse |
| 2299 |
\inputetx{\str{etx-name}} |
| 2300 |
\edef\a_macro{\a_macro\string\reencodefont{\str{etx-name}}} |
| 2301 |
\fi |
| 2302 |
\record_transform{#2}{\string\frommtx{#1}}{\a_macro}\iftrue |
| 2303 |
\out_line{} |
| 2304 |
\mtxtomtx_redefinitions |
| 2305 |
\inputmtx{#1} |
| 2306 |
\out_line{} |
| 2307 |
\out_line{\endmetrics_text} |
| 2308 |
\close_out{Transformed~metrics} |
| 2309 |
}} |
| 2310 |
% \end{macrocode} |
| 2311 |
% \end{macro} |
| 2312 |
% |
| 2313 |
% \begin{macro}{\mtxtomtx_redefinitions} |
| 2314 |
% This macro serves as a hook. One can make additional commands |
| 2315 |
% transformable by appending suitable redefenitions of them to this |
| 2316 |
% macro. |
| 2317 |
% \changes{1.927}{2003/12/08}{Macro added. The code used to be in |
| 2318 |
% \cs{mtxtomtx}. (LH)} |
| 2319 |
% \begin{macrocode} |
| 2320 |
\def\mtxtomtx_redefinitions{ |
| 2321 |
\let\setint=\mtxtomtx_setint |
| 2322 |
\let\setdim=\mtxtomtx_setdim |
| 2323 |
\let\setstr=\mtxtomtx_setstr |
| 2324 |
\let\setscaledrawglyph=\mtxtomtx_setscaledrawglyph |
| 2325 |
\let\setscalednotglyph=\mtxtomtx_setscaledrawglyph |
| 2326 |
\let\setkern=\mtxtomtx_setkern |
| 2327 |
\let\setglyph=\mtxtomtx_setglyph |
| 2328 |
\let\glyphpcc=\mtxtomtx_glyphpcc |
| 2329 |
\let\samesize=\mtxtomtx_samesize |
| 2330 |
\let\endsetglyph=\mtxtomtx_endsetglyph |
| 2331 |
\def\aliased{\string\aliased} |
| 2332 |
} |
| 2333 |
%</pkg> |
| 2334 |
% \end{macrocode} |
| 2335 |
% \end{macro} |
| 2336 |
% |
| 2337 |
% \begin{macro}{\aliased} |
| 2338 |
% \changes{1.915}{2000/09/09}{Macro added. (LH)} |
| 2339 |
% The |\aliased| macro has the syntax |
| 2340 |
% \begin{quote} |
| 2341 |
% |\aliased|\marg{font's name}\marg{alias name} |
| 2342 |
% \end{quote} |
| 2343 |
% This normally expands to \meta{alias name}, but in |\mtxtomtx| it |
| 2344 |
% normally expands to |
| 2345 |
% \begin{quote} |
| 2346 |
% |\string\aliased|\marg{font's name}\marg{alias name} |
| 2347 |
% \end{quote} |
| 2348 |
% and when |\mtxtomtx_setscaledrawglyph| is reencoding it uses |
| 2349 |
% \meta{font's name} to determine the new slot position. |
| 2350 |
% \begin{macrocode} |
| 2351 |
%<pkg|misc>\let\aliased=\second_of_two |
| 2352 |
%<doc>\let\aliased=\@secondoftwo |
| 2353 |
% \end{macrocode} |
| 2354 |
% \end{macro} |
| 2355 |
% |
| 2356 |
% \begin{macro}{\mtxtomtx_setint} |
| 2357 |
% \changes{1.917}{2001/03/24}{Redefined to allow an extensible list |
| 2358 |
% \cs{width_ints_list} of integers that should be transformed as |
| 2359 |
% widths. (LH)} |
| 2360 |
% \begin{macro}{\italicslant_name} |
| 2361 |
% \begin{macro}{\width_ints_list} |
| 2362 |
% \changes{1.917}{2001/03/24}{Macro added. \cs{verticalstem_name} |
| 2363 |
% removed. (LH)} |
| 2364 |
% Most integers are transformed as if they are the $y$-coordinates of |
| 2365 |
% some points, but |italicslant| and the integers in the |
| 2366 |
% |\width_ints_list| are treated differently. |italicslant| is |
| 2367 |
% interpreted as the quotient $\frac{x}{y}$ for a point $(x,y)$, but |
| 2368 |
% represented as a real number (i.e., the \TeX\ number is really a |
| 2369 |
% thousand times the actual quotient). The integers in the |
| 2370 |
% |\width_ints_list| are transformed as if they are the |
| 2371 |
% $x$-coordinates of some points on the baseline. |
| 2372 |
% |
| 2373 |
% The |\width_ints_list| macro is an ordinary |\do|-type list where |
| 2374 |
% each |\do| has precisely one argument. These arguments are the names |
| 2375 |
% of the integers which should be transformed as widths. Elements can |
| 2376 |
% be added to the list using the |\add_to| macro. |
| 2377 |
% |
| 2378 |
% The test for whether a specific integer is in the |\width_ints_list| |
| 2379 |
% exploits that |\if_true| and |\if_false| only matter in |\if|--|\fi| |
| 2380 |
% matching after they have been expanded, whereas |
| 2381 |
% |\gobble_one|\,|\iftrue| only matters before it is expanded. |
| 2382 |
% \begin{macrocode} |
| 2383 |
%<*pkg> |
| 2384 |
\def\mtxtomtx_setint#1#2{ |
| 2385 |
\def\a_macro{#1} |
| 2386 |
\ifx \a_macro\italicslant_name |
| 2387 |
\eval_expr{#2} |
| 2388 |
\global\multiply \result \int{x-scale} |
| 2389 |
\a_count=\int{slant-scale} |
| 2390 |
\multiply \a_count \one_thousand |
| 2391 |
\advance \a_count \result |
| 2392 |
\divide \a_count \int{y-scale}\x_relax |
| 2393 |
\else |
| 2394 |
\def\do##1{ |
| 2395 |
\def\b_macro{##1} |
| 2396 |
\ifx \a_macro\b_macro \expandafter\if_false \fi |
| 2397 |
} |
| 2398 |
\gobble_one\iftrue \width_ints_list \if_true |
| 2399 |
\eval_expr_to\a_count{\scale{#2}{\int{y-scale}}} |
| 2400 |
\else |
| 2401 |
\eval_expr_to\a_count{\scale{#2}{\int{x-scale}}} |
| 2402 |
\fi |
| 2403 |
\fi |
| 2404 |
\out_line{\string\setint{#1}{\the\a_count}} |
| 2405 |
} |
| 2406 |
\def\italicslant_name{italicslant} |
| 2407 |
\def\width_ints_list{ |
| 2408 |
\do{interword}\do{stretchword}\do{shrinkword}\do{quad} |
| 2409 |
\do{extraspace}\do{digitwidth}\do{verticalstem} |
| 2410 |
} |
| 2411 |
% \end{macrocode} |
| 2412 |
% \end{macro}\end{macro}\end{macro} |
| 2413 |
% |
| 2414 |
% \begin{macro}{\mtxtomtx_setdim} |
| 2415 |
% \begin{macro}{\mtxtomtx_setstr} |
| 2416 |
% Strings and dimens are not affected by the |\mtxtomtx| transforms. |
| 2417 |
% \begin{macrocode} |
| 2418 |
\def\mtxtomtx_setdim#1#2{ |
| 2419 |
\out_line{\string\setdim{#1}{#2}} |
| 2420 |
} |
| 2421 |
% \end{macrocode} |
| 2422 |
% \begin{macrocode} |
| 2423 |
\def\mtxtomtx_setstr#1#2{ |
| 2424 |
\out_line{\string\setstr{#1}{#2}} |
| 2425 |
} |
| 2426 |
% \end{macrocode} |
| 2427 |
% \end{macro} \end{macro} |
| 2428 |
% |
| 2429 |
% \begin{macro}{\mtxtomtx_setscaledrawglyph} |
| 2430 |
% \changes{1.915}{2000/09/09}{Added local redefinition of |
| 2431 |
% \cs{aliased}. (LH)} |
| 2432 |
% |#6| (the width) is transformed as the $x$-coordinate of a point on |
| 2433 |
% the baseline. |#7| and |#8| (the height and depth respectively) are |
| 2434 |
% transformed as $y$-coordinates. The depth should probably really have |
| 2435 |
% been transformed as the negative of a $y$-coordinate, but it comes |
| 2436 |
% out the same in the end anyway. |#9| (the italic correction) is |
| 2437 |
% transformed as the $x$-coordinate of a point whose $y$-coordinate |
| 2438 |
% equals the height of the character. |#4| (the scaling) is |
| 2439 |
% transformed as a $y$-coordinate. |
| 2440 |
% |
| 2441 |
% If the italic slant of the font is negative then the italic |
| 2442 |
% correction should possibly be transformed as the $x$-coordinate of |
| 2443 |
% a point whose $y$-coordinate equals the negative of the depth |
| 2444 |
% instead (as that is the part of the box that is sticking out to the |
| 2445 |
% right), but it is hard to say for sure how that case should be |
| 2446 |
% treated. |
| 2447 |
% |
| 2448 |
% \begin{macrocode} |
| 2449 |
\def\mtxtomtx_setscaledrawglyph#1#2#3#4#5#6#7#8#9{ |
| 2450 |
\eval_expr_to\a_count{\scale{#6}{\int{x-scale}}} |
| 2451 |
\eval_expr_to\b_count{\scale{#7}{\int{y-scale}}} |
| 2452 |
\eval_expr_to\c_count{\scale{#8}{\int{y-scale}}} |
| 2453 |
\eval_expr_to\d_count{#9} \eval_expr{#7} |
| 2454 |
\multiply \d_count \int{x-scale} |
| 2455 |
\global\multiply \result \int{slant-scale} |
| 2456 |
\global\advance \result \d_count |
| 2457 |
\rounded_thousandths |
| 2458 |
\d_count=\result |
| 2459 |
\eval_expr{\scale{#4}{\int{y-scale}}} |
| 2460 |
\ifisstr{etx-name}\then |
| 2461 |
\bgroup |
| 2462 |
\let\aliased=\first_of_two |
| 2463 |
\if_undefined{slots-#1}\then |
| 2464 |
\egroup \e_count=\m@ne |
| 2465 |
\else |
| 2466 |
\expandafter\egroup \expandafter\e_count |
| 2467 |
\csname slots-#1\endcsname |
| 2468 |
\fi |
| 2469 |
\else |
| 2470 |
\e_count=#5 |
| 2471 |
\fi |
| 2472 |
\out_line{ |
| 2473 |
\ifnum \e_count>\m@ne |
| 2474 |
\string\setscaledrawglyph |
| 2475 |
\else |
| 2476 |
\string\setscalednotglyph |
| 2477 |
\fi |
| 2478 |
{#1}{\raw_font_name}{#3}{\the\result}{\the\e_count} |
| 2479 |
{\the\a_count}{\the\b_count}{\the\c_count}{\the\d_count} |
| 2480 |
} |
| 2481 |
} |
| 2482 |
% \end{macrocode} |
| 2483 |
% \end{macro} |
| 2484 |
% |
| 2485 |
% \begin{macro}{\mtxtomtx_setkern} |
| 2486 |
% Kerns are transformed as the $x$-coordinate of a point on the |
| 2487 |
% baseline. |
| 2488 |
% |
| 2489 |
% \begin{macrocode} |
| 2490 |
\def\mtxtomtx_setkern#1#2#3{ |
| 2491 |
\eval_expr{\scale{\int{x-scale}}{#3}} |
| 2492 |
\out_line{\string\setkern{#1}{#2}{\the\result}} |
| 2493 |
} |
| 2494 |
% \end{macrocode} |
| 2495 |
% \end{macro} |
| 2496 |
% |
| 2497 |
% \begin{macro}{\mtxtomtx_setglyph} |
| 2498 |
% \begin{macro}{\mtxtomtx_samesize} |
| 2499 |
% \begin{macro}{\mtxtomtx_endsetglyph} |
| 2500 |
% \begin{macrocode} |
| 2501 |
\def\mtxtomtx_setglyph#1{\out_line{\string\setglyph{#1}}} |
| 2502 |
\def\mtxtomtx_samesize#1{\out_lline{\string\samesize{#1}}} |
| 2503 |
\def\mtxtomtx_endsetglyph{\out_line{\string\endsetglyph}} |
| 2504 |
% \end{macrocode} |
| 2505 |
% \end{macro} \end{macro} \end{macro} |
| 2506 |
% |
| 2507 |
% \begin{macro}{\mtxtomtx_glyphpcc} |
| 2508 |
% |#2| is transformed as the $x$-coordinate and |#3| is transformed |
| 2509 |
% as the $y$-coordinate of a point---the same point for both |
| 2510 |
% parameters. |
| 2511 |
% |
| 2512 |
% \begin{macrocode} |
| 2513 |
\def\mtxtomtx_glyphpcc#1#2#3{ |
| 2514 |
\eval_expr_to\b_count{\scale{\int{y-scale}}{#3}} |
| 2515 |
\eval_expr_to\a_count{#2} \eval_expr{#3} |
| 2516 |
\multiply \a_count \int{x-scale} |
| 2517 |
\global\multiply \result \int{slant-scale} |
| 2518 |
\global\advance \result \a_count |
| 2519 |
\rounded_thousandths |
| 2520 |
\out_lline{\string\glyphpcc{#1}{\the\result}{\the\b_count}} |
| 2521 |
} |
| 2522 |
% \end{macrocode} |
| 2523 |
% \end{macro} |
| 2524 |
% |
| 2525 |
% |
| 2526 |
% \subsection{Changing glyph names} |
| 2527 |
% \label{Ssec:Reglyph} |
| 2528 |
% |
| 2529 |
% \package{fontinst} uses names to identify glyphs, and if for example |
| 2530 |
% the font in question is a postscript font, then names will also be used |
| 2531 |
% to identify glyphs in the printer. Between those two points however, |
| 2532 |
% and in particular inside \TeX\ itself, glyphs are represented with |
| 2533 |
% numbers (slots). Therefore there is no real need for the glyph names |
| 2534 |
% used within \package{fontinst} and the glyph names used in the printer |
| 2535 |
% (the names gotten from the AFM file) to be equal, but they usually are. |
| 2536 |
% There are some cases though where the glyph names of a font are |
| 2537 |
% unsuitable for use with \package{fontinst}---mainly because |
| 2538 |
% \package{fontinst} can mix glyphs from different printer fonts---and |
| 2539 |
% therefore \package{fontinst} also offers the ability to automatically |
| 2540 |
% change the names of glyphs in transformable metric files. |
| 2541 |
% |
| 2542 |
% \begin{macro}{\reglyphfonts} |
| 2543 |
% \changes{1.912}{2000/01/15}{Added local resetting of |
| 2544 |
% \cs{setsomething_global} to \cs{relax}. It shouldn't be needed, |
| 2545 |
% since \cs{reglyphfonts} should not occur between \cs{installfonts} |
| 2546 |
% and \cs{endinstallfonts}, but I bet someone will try. (LH)} |
| 2547 |
% \begin{macro}{\endreglyphfonts} |
| 2548 |
% \begin{quote} |
| 2549 |
% |\reglyphfonts| \meta{reglyphing commands} |\endreglyphfonts| |
| 2550 |
% \end{quote} |
| 2551 |
% \begin{macrocode} |
| 2552 |
\def\reglyphfonts{ |
| 2553 |
\begingroup |
| 2554 |
\let\setsomething_global=\x_relax |
| 2555 |
\x_setint{renameweight}{1} |
| 2556 |
\x_setint{killweight}{-10} |
| 2557 |
\setcommand\iftokeep##1\then{\ifnum -1<##1} |
| 2558 |
} |
| 2559 |
\def\endreglyphfonts{\endgroup} |
| 2560 |
% \end{macrocode} |
| 2561 |
% \end{macro} \end{macro} |
| 2562 |
% |
| 2563 |
% |
| 2564 |
% The \meta{reglyphing commands} are |
| 2565 |
% \begin{quote} |
| 2566 |
% |\renameglyph|\marg{to}\marg{from}\\ |
| 2567 |
% |\renameglyphweighted|\marg{to}\marg{from}\marg{weight}\\ |
| 2568 |
% |\killglyph|\marg{glyph}\\ |
| 2569 |
% |\killglyphweighted|\marg{glyph}\marg{weight}\\ |
| 2570 |
% |\offmtxcommand|\marg{command}\\ |
| 2571 |
% |\onmtxcommand|\marg{command}\\ |
| 2572 |
% |\reglyphfont|\marg{destination font}\marg{source font} |
| 2573 |
% \end{quote} |
| 2574 |
% The only reglyphing command that actually convert the names of any |
| 2575 |
% glyphs is \DescribeMacro{\reglyphfont}|\reglyph|\-|font|; it reads a font |
| 2576 |
% \meta{source font} (which may be of type MTX, PL, AFM, or VPL) and |
| 2577 |
% writes another font \meta{destination font} in which the names of |
| 2578 |
% glyphs have been converted. All the other commands control \emph{how} |
| 2579 |
% this conversion should be made, and these settings get cleared at the |
| 2580 |
% closing |\endreglyphfonts|. |
| 2581 |
% |
| 2582 |
% The conversion works in two ways. First of all, the names of the |
| 2583 |
% glyphs can be changed. This works as a general mapping and is |
| 2584 |
% controlled by the \DescribeMacro{\renameglyph}|\renameglyph| and |
| 2585 |
% \DescribeMacro{\renameglyphweighted}|\renameglyphweighted| |
| 2586 |
% commands. Any mensioning of the glyph \meta{from} in a command will be |
| 2587 |
% converted to a mensioning of the glyph \meta{to}, if that command |
| 2588 |
% survives the conversion. The other way the conversion works is that it |
| 2589 |
% can selectively kill---refrain from including in \meta{destination |
| 2590 |
% font}---commands in the metric file. This part weighs in several |
| 2591 |
% factors. |
| 2592 |
% |
| 2593 |
% For one thing, one can specify that all metric commands of a certain |
| 2594 |
% type should be killed, and this is done with the |
| 2595 |
% \DescribeMacro{\offmtxcommand}|\offmtxcommand| command. For example, |
| 2596 |
% one can see to that all kerning commands are killed by |
| 2597 |
% \begin{quote} |
| 2598 |
% |\offmtxcommand{\setkern}| |
| 2599 |
% \end{quote} |
| 2600 |
% The effect is the same as that of saying |
| 2601 |
% \begin{quote} |
| 2602 |
% |offkern,|\meta{destination font}|,onkern| |
| 2603 |
% \end{quote} |
| 2604 |
% rather than just \meta{destination font} in the second argument to |
| 2605 |
% |\installfont|, but it is somewhat faster since less text is written |
| 2606 |
% to and subsequently read from the \meta{destination font}|.mtx| file. |
| 2607 |
% The effect of a previous |\offmtxcommand| can be canceled by a call to |
| 2608 |
% \DescribeMacro{\onmtxcommand}|\onmtxcommand|, just like with |
| 2609 |
% |\offcommand| and |\oncommand|. |
| 2610 |
% |
| 2611 |
% The survivance of a command is also affected by the glyphs it refers to. |
| 2612 |
% Each glyph has a \emph{weight} associated with it and the sum of the |
| 2613 |
% weights for all glyphs mensioned by a command is also used to decide |
| 2614 |
% whether that command should survive. The test here is performed by the |
| 2615 |
% macro \DescribeMacro{\iftokeep}|\iftokeep|, whose parameter text |
| 2616 |
% must be |#1\then|, where |#1| will be a |\count| register. This |
| 2617 |
% macro must eventually expand to an if of some sort and that if |
| 2618 |
% evaluating to true is interpreted as that the command should be kept. |
| 2619 |
% The default replacement text is |\ifnum -1<#1|, which causes a command |
| 2620 |
% to be killed (not kept) iff the sum of weights for it is negative. |
| 2621 |
% |
| 2622 |
% The weight of a glyph is set by |\rename|\-|glyph|, |
| 2623 |
% |\rename|\-|glyph|\-|weighted|, |
| 2624 |
% \DescribeMacro{\killglyph}|\kill|\-|glyph|, and |
| 2625 |
% \DescribeMacro{\killglyphweighted}|\kill|\-|glyph|\-|weighted|. The |
| 2626 |
% |\rename|\textellipsis\ commands also set a new name for the glyph if |
| 2627 |
% it survives, whereas the |\kill|\textellipsis\ commands will keep the |
| 2628 |
% old name. Since the standard settings are that a |
| 2629 |
% |\rename|\textellipsis\ weight is small and positive and a |
| 2630 |
% |\kill|\textellipsis\ weight is large and negative, glyphs for which |
| 2631 |
% a |\kill|\textellipsis\ has been done will usually not survive. |
| 2632 |
% |
| 2633 |
% Any one of |\rename|\-|glyph|, |\rename|\-|glyph|\-|weighted|, |
| 2634 |
% |\kill|\-|glyph|, and |\kill|\-|glyph|\-|weighted| for a glyph will |
| 2635 |
% override all previous settings |
| 2636 |
% by any of these four commands for that glyph. The equivalent of the |
| 2637 |
% neutral state for a glyph (no settings by any of these commands have |
| 2638 |
% been made for that glyph) is achieved by the command |
| 2639 |
% \begin{quote} |
| 2640 |
% |\killglyphweighted|\marg{glyph}|{0}| |
| 2641 |
% \end{quote} |
| 2642 |
% |
| 2643 |
% |
| 2644 |
% \begin{macro}{\offmtxcommand} |
| 2645 |
% \begin{macro}{\onmtxcommand} |
| 2646 |
% These two are just special forms of |\offcommand| and |\oncommand|. |
| 2647 |
% \begin{macrocode} |
| 2648 |
\def\offmtxcommand#1{ |
| 2649 |
\x_cs\offcommand{reglyph_\expandafter\gobble_one\string#1} |
| 2650 |
} |
| 2651 |
\def\onmtxcommand#1{ |
| 2652 |
\x_cs\oncommand{reglyph_\expandafter\gobble_one\string#1} |
| 2653 |
} |
| 2654 |
% \end{macrocode} |
| 2655 |
% \end{macro} \end{macro} |
| 2656 |
% |
| 2657 |
% |
| 2658 |
% \describecsfamily{slots-\meta{glyph}}Inside a |\reglyphfonts| |
| 2659 |
% \textellipsis\ |\endreglyphfonts| block, the family |
| 2660 |
% |\slots-|\meta{glyph} of control sequences is used to store the |
| 2661 |
% information about how glyph \meta{glyph} should be converted. These |
| 2662 |
% control sequences are either undefined or parameterless macros |
| 2663 |
% whose replacement texts are of one of the forms |
| 2664 |
% \begin{quote} |
| 2665 |
% |\rename_glyph|\marg{to}\marg{weight}\\ |
| 2666 |
% |\rename_glyph|\marg{to}|\i-renameweight|\\ |
| 2667 |
% |\kill_glyph|\marg{weight}\\ |
| 2668 |
% |\kill_glyph\i-killweight| |
| 2669 |
% \end{quote} |
| 2670 |
% \meta{to} is what the glyph will be renamed to and \meta{weight} is |
| 2671 |
% the associated weight. These four different forms are generated by |
| 2672 |
% the four different commands |\renameglyphweighted|, |\renameglyph|, |
| 2673 |
% |\killglyphweighted|, and |\killglyph| respectively. |
| 2674 |
% |
| 2675 |
% \begin{macro}{\renameglyph} |
| 2676 |
% \begin{macro}{\renameglyphweighted} |
| 2677 |
% The difference between the commands |\renameglyphweighted| and |
| 2678 |
% |\renameglyph| is that the former lets one specify the weight exactly |
| 2679 |
% while the latter will use the value of the integer |renameweight| |
| 2680 |
% \emph{at the time of conversion}. By changing the value of |
| 2681 |
% |renameweight| between two conversions, one changes the weights |
| 2682 |
% used for all glyph renamings declared using |\renameglyph|. |
| 2683 |
% \begin{macrocode} |
| 2684 |
\begingroup |
| 2685 |
\catcode`\-=11 |
| 2686 |
\gdef\renameglyph#1#2{ |
| 2687 |
\x_cs\edef{slots-#2}{ |
| 2688 |
\noexpand\rename_glyph{#1}\noexpand\i-renameweight |
| 2689 |
} |
| 2690 |
} |
| 2691 |
\endgroup |
| 2692 |
% \end{macrocode} |
| 2693 |
% \begin{macrocode} |
| 2694 |
\def\renameglyphweighted#1#2#3{ |
| 2695 |
\eval_expr{#3} |
| 2696 |
\x_cs\edef{slots-#2}{\noexpand\rename_glyph{#1}{\the\result}} |
| 2697 |
} |
| 2698 |
% \end{macrocode} |
| 2699 |
% \end{macro} \end{macro} |
| 2700 |
% |
| 2701 |
% \begin{macro}{\killglyph} |
| 2702 |
% \begin{macro}{\killglyphweighted} |
| 2703 |
% The difference between the commands |\killglyphweighted| and |
| 2704 |
% |\killglyph| is that the former lets one specify the weight exactly |
| 2705 |
% while the latter will use the value of the integer |killweight| |
| 2706 |
% \emph{at the time of conversion}. By changing the value of |
| 2707 |
% |killweight| between two conversions, one changes the weights |
| 2708 |
% used for all glyph killings declared using |\killglyph|. |
| 2709 |
% \begin{macrocode} |
| 2710 |
\begingroup |
| 2711 |
\catcode`\-=11 |
| 2712 |
\gdef\killglyph#1{ |
| 2713 |
\x_cs\def{slots-#1}{\kill_glyph\i-killweight} |
| 2714 |
} |
| 2715 |
\endgroup |
| 2716 |
% \end{macrocode} |
| 2717 |
% \begin{macrocode} |
| 2718 |
\def\killglyphweighted#1#2{ |
| 2719 |
\eval_expr{#2} |
| 2720 |
\x_cs\edef{slots-#1}{\noexpand\kill_glyph{\the\result}} |
| 2721 |
} |
| 2722 |
% \end{macrocode} |
| 2723 |
% \end{macro} \end{macro} |
| 2724 |
% |
| 2725 |
% |
| 2726 |
% \begin{macro}{\reglyphfont} |
| 2727 |
% The command |
| 2728 |
% \begin{quote} |
| 2729 |
% |\reglyphfont|\marg{destination font}\marg{source font} |
| 2730 |
% \end{quote} |
| 2731 |
% reads the font metric file \meta{source font}|.mtx| (which must be |
| 2732 |
% transformable), \meta{source font}|.pl|, or \meta{source font}|.afm| |
| 2733 |
% (the possibilities are tried in that order) and writes out a font |
| 2734 |
% metric file \meta{destination font}|.mtx| that is the converted (as |
| 2735 |
% described above) form of the source font. |
| 2736 |
% |
| 2737 |
% \meta{destination font} and \meta{source font} may not be equal. |
| 2738 |
% \changes{1.903}{1999/06/01}{Using \cs{fromany} for locating font. |
| 2739 |
% (LH)} |
| 2740 |
% \changes{1.904}{1999/06/16}{Added \cs{record_transform}. (LH)} |
| 2741 |
% \begin{macrocode} |
| 2742 |
\def\reglyphfont#1#2{ |
| 2743 |
\fromany{#2} |
| 2744 |
\ifisstr{afm-name}\then |
| 2745 |
\reglyph_font{#1}{#2} |
| 2746 |
\else |
| 2747 |
\fontinsterror{Reglyph}{Could~not~find~font~metrics~for~#2.} |
| 2748 |
\error_help_a |
| 2749 |
\fi |
| 2750 |
} |
| 2751 |
% \end{macrocode} |
| 2752 |
% \end{macro} |
| 2753 |
% |
| 2754 |
% \begin{macro}{\reglyph_font} |
| 2755 |
% This macro does the actual conversion. |
| 2756 |
% \begin{macrocode} |
| 2757 |
\def\reglyph_font#1#2{{ |
| 2758 |
\open_out{\temp_prefix#1.mtx} |
| 2759 |
\out_line{\percent_char~Filename:~#1.mtx} |
| 2760 |
\out_line{\percent_char~Created~by:~tex~\jobname} |
| 2761 |
\out_line{\percent_char~Created~using:~\string\reglyphfont{#1}{#2}} |
| 2762 |
\out_line{} |
| 2763 |
\out_line{\percent_char~This~file~is~used~by~the~fontinst~package.} |
| 2764 |
\out_line{} |
| 2765 |
\out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.} |
| 2766 |
\out_line{} |
| 2767 |
\out_line{\string\relax} |
| 2768 |
\out_line{\string\metrics} |
| 2769 |
\out_line{} |
| 2770 |
\out_line{\string\needsfontinstversion{\fontinstversion}} |
| 2771 |
\out_line{} |
| 2772 |
\record_transform{#1}{\string\frommtx{#2}}{\string\reglyphfont} |
| 2773 |
\iftrue |
| 2774 |
\out_line{} |
| 2775 |
\reglyph_redefinitions |
| 2776 |
\inputmtx{#2} |
| 2777 |
\out_line{} |
| 2778 |
\out_line{\endmetrics_text} |
| 2779 |
\close_out{Reglyphed~metrics} |
| 2780 |
}} |
| 2781 |
% \end{macrocode} |
| 2782 |
% \end{macro} |
| 2783 |
% |
| 2784 |
% \begin{macro}{\reglyph_redefinitions} |
| 2785 |
% This macro serves as a hook. One can make additional commands |
| 2786 |
% transformable by appending suitable redefenitions of them to this |
| 2787 |
% macro. |
| 2788 |
% \changes{1.927}{2003/12/08}{Macro added. The code used to be in |
| 2789 |
% \cs{reglyph_font}. (LH)} |
| 2790 |
% \begin{macrocode} |
| 2791 |
\def\reglyph_redefinitions{ |
| 2792 |
\let\setint=\reglyph_setint |
| 2793 |
\let\setdim=\reglyph_setdim |
| 2794 |
\let\setstr=\reglyph_setstr |
| 2795 |
\let\setscaledrawglyph=\reglyph_setscaledrawglyph |
| 2796 |
\let\setscalednotglyph=\reglyph_setscaledrawglyph |
| 2797 |
\let\setkern=\reglyph_setkern |
| 2798 |
\let\setglyph=\reglyph_setglyph |
| 2799 |
\let\glyphpcc=\reglyph_glyphpcc |
| 2800 |
\let\samesize=\reglyph_samesize |
| 2801 |
\let\endsetglyph=\reglyph_endsetglyph |
| 2802 |
} |
| 2803 |
% \end{macrocode} |
| 2804 |
% \end{macro} |
| 2805 |
% |
| 2806 |
% \begin{macro}{\reglyph_setint} |
| 2807 |
% \begin{macro}{\reglyph_setdim} |
| 2808 |
% \begin{macro}{\reglyph_setstr} |
| 2809 |
% These are just copied to the file generated. |
| 2810 |
% \begin{macrocode} |
| 2811 |
\def\reglyph_setint#1#2{\out_line{\string\setint{#1}{#2}}} |
| 2812 |
\def\reglyph_setdim#1#2{\out_line{\string\setdim{#1}{#2}}} |
| 2813 |
\def\reglyph_setstr#1#2{\out_line{\string\setstr{#1}{#2}}} |
| 2814 |
% \end{macrocode} |
| 2815 |
% \end{macro} \end{macro} \end{macro} |
| 2816 |
% |
| 2817 |
% \begin{macro}{\command_survivance} |
| 2818 |
% This |\count| register stores the sum of the weights associated |
| 2819 |
% with the glyphs considered so far. It is updated by |\rename_glyph| |
| 2820 |
% and |\kill_glyph|. |
| 2821 |
% \begin{macrocode} |
| 2822 |
\newcount\command_survivance |
| 2823 |
% \end{macrocode} |
| 2824 |
% \end{macro} |
| 2825 |
% |
| 2826 |
% The macro \DescribeMacro{\glyphname}|\glyphname| holds the name of |
| 2827 |
% the glyph currently under consideration. It is altered by |
| 2828 |
% |\rename_glyph|. |
| 2829 |
% |
| 2830 |
% \begin{macro}{\rename_glyph} |
| 2831 |
% \begin{macro}{\kill_glyph} |
| 2832 |
% \begin{macrocode} |
| 2833 |
\def\rename_glyph#1{\def\glyphname{#1}\kill_glyph} |
| 2834 |
\def\kill_glyph#1{\advance \command_survivance #1\x_relax} |
| 2835 |
% \end{macrocode} |
| 2836 |
% \end{macro} \end{macro} |
| 2837 |
% |
| 2838 |
% |
| 2839 |
% \begin{macro}{\reglyph_setscaledrawglyph} |
| 2840 |
% \changes{1.915}{2000/06/25}{Corrected bug in the \cs{ifnum}: it |
| 2841 |
% should test argument \#5, not \#4. (LH) Encountered by Thierry |
| 2842 |
% Bouche.} |
| 2843 |
% The |\reglyph_|\-|setscaled|\-|rawglyph| macro is straightforward. |
| 2844 |
% Whether it writes a |\setscaled|\-|rawglyph| or a |\setscaled|\-^^A |
| 2845 |
% |notglyph| command depends on the fifth parameter, just like with |
| 2846 |
% |\mtxtomtx_|\-|setscaled|\-|rawglyph|. |
| 2847 |
% \begin{macrocode} |
| 2848 |
\def\reglyph_setscaledrawglyph#1#2#3#4#5#6#7#8#9{ |
| 2849 |
\command_survivance=0 |
| 2850 |
\def\glyphname{#1} |
| 2851 |
\csname slots-#1\endcsname |
| 2852 |
\iftokeep\command_survivance\then |
| 2853 |
\out_line{ |
| 2854 |
\ifnum #5<\z@ |
| 2855 |
\string\setscalednotglyph |
| 2856 |
\else |
| 2857 |
\string\setscaledrawglyph |
| 2858 |
\fi |
| 2859 |
{\glyphname}{#2}{#3}{\number#4}{#5}{#6}{#7}{#8}{#9} |
| 2860 |
} |
| 2861 |
\fi |
| 2862 |
} |
| 2863 |
% \end{macrocode} |
| 2864 |
% \end{macro} |
| 2865 |
% |
| 2866 |
% \begin{macro}{\reglyph_setkern} |
| 2867 |
% \begin{macrocode} |
| 2868 |
\def\reglyph_setkern#1#2#3{ |
| 2869 |
\command_survivance=0 |
| 2870 |
\def\glyphname{#1} |
| 2871 |
\csname slots-#1\endcsname |
| 2872 |
\let\a_macro=\glyphname |
| 2873 |
\def\glyphname{#2} |
| 2874 |
\csname slots-#2\endcsname |
| 2875 |
\iftokeep\command_survivance\then |
| 2876 |
\out_line{\string\setkern{\a_macro}{\glyphname}{#3}} |
| 2877 |
\fi |
| 2878 |
} |
| 2879 |
% \end{macrocode} |
| 2880 |
% \end{macro} |
| 2881 |
% |
| 2882 |
% \begin{macro}{\reglyph_setglyph} |
| 2883 |
% \multchanges{\cs{reglyph_glyphpcc}\cs{reglyph_samesize}^^A |
| 2884 |
% \cs{reglyph_setglyph}}{1.911}{1999/12/10}{\cs{string} |
| 2885 |
% which should be \cs{noexpand} corrected. (LH) Reported by |
| 2886 |
% Rolf Lindgren.} |
| 2887 |
% \begin{macro}{\off-\reglyph_setglyph} |
| 2888 |
% \begin{macro}{\reglyph_glyphpcc} |
| 2889 |
% \changes{1.911}{1999/12/10}{Typo corrected. (LH) Spotted by Rolf |
| 2890 |
% Lindgren.} |
| 2891 |
% \begin{macro}{\reglyph_samesize} |
| 2892 |
% \begin{macro}{\reglyph_endsetglyph} |
| 2893 |
% In |\setglyph| \textellipsis\ |\endsetglyph| constructions (which |
| 2894 |
% are written for composite characters in AFM files), the decision of |
| 2895 |
% whether to write a command or not due to glyph weights is done |
| 2896 |
% only once for the entire construction. This means that the commands |
| 2897 |
% must be saved until the |\endsetglyph| where the result is finally |
| 2898 |
% known. The token list register |\a_toks| is used for this purpose. |
| 2899 |
% \begin{macrocode} |
| 2900 |
\def\reglyph_setglyph#1{ |
| 2901 |
\command_survivance=0 |
| 2902 |
\def\glyphname{#1} |
| 2903 |
\csname slots-#1\endcsname |
| 2904 |
\edef\a_macro{\noexpand\out_line{\string\setglyph{\glyphname}}} |
| 2905 |
\a_toks=\expandafter{\a_macro} |
| 2906 |
} |
| 2907 |
\x_cs\def{off-\string\reglyph_setglyph}#1{\gobble_glyph} |
| 2908 |
% \end{macrocode} |
| 2909 |
% \begin{macrocode} |
| 2910 |
\def\reglyph_glyphpcc#1#2#3{ |
| 2911 |
\def\glyphname{#1} |
| 2912 |
\csname slots-#1\endcsname |
| 2913 |
\edef\a_macro{\noexpand\out_lline{ |
| 2914 |
\string\glyphpcc{\glyphname}{#2}{#3} |
| 2915 |
}} |
| 2916 |
\a_toks=\expandafter{\the\expandafter\a_toks \a_macro} |
| 2917 |
} |
| 2918 |
% \end{macrocode} |
| 2919 |
% \begin{macrocode} |
| 2920 |
\def\reglyph_samesize#1{ |
| 2921 |
\def\glyphname{#1} |
| 2922 |
\csname slots-#1\endcsname |
| 2923 |
\edef\a_macro{\noexpand\out_lline{ |
| 2924 |
\string\samesize{\glyphname} |
| 2925 |
}} |
| 2926 |
\a_toks=\expandafter{\the\expandafter\a_toks \a_macro} |
| 2927 |
} |
| 2928 |
% \end{macrocode} |
| 2929 |
% \begin{macrocode} |
| 2930 |
\def\reglyph_endsetglyph{ |
| 2931 |
\iftokeep\command_survivance\then |
| 2932 |
\the\a_toks |
| 2933 |
\out_line{\string\endsetglyph} |
| 2934 |
\fi |
| 2935 |
\a_toks={} |
| 2936 |
} |
| 2937 |
%</pkg> |
| 2938 |
% \end{macrocode} |
| 2939 |
% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} |
| 2940 |
% |
| 2941 |
% |
| 2942 |
% \subsubsection*{Three common reglyphing schemes} |
| 2943 |
% |
| 2944 |
% As is mensioned elsewhere, the most common reglyphing operation is to |
| 2945 |
% take a caps and small caps font produced by some major foundry and |
| 2946 |
% change the glyph names so that they agree with the glyph names used in |
| 2947 |
% expert fonts. The following code contains the modifying reglyphing |
| 2948 |
% commands to set up this reglyphing, in two different variants. |
| 2949 |
% |
| 2950 |
% The commands are currently based on a comparision of Adobe Garamond |
| 2951 |
% Small Caps \& Oldstyle Figures (\texttt{padrc8a} in the Berry |
| 2952 |
% scheme) with Adobe Garamond Regular Expert (\texttt{padr8x} in the |
| 2953 |
% Berry scheme), so they should be correct for a fair amount of Adobe |
| 2954 |
% font families, but it is also highly probable that there are lots of |
| 2955 |
% fonts out there for which it doesn't work quite right. In case you do |
| 2956 |
% find such a font, please write to tell the \package{fontinst} mailing |
| 2957 |
% list about it---it would be rather easy to add various alternative |
| 2958 |
% set-up schemes, controlled by switches, to these files. Just make sure |
| 2959 |
% first (by checking the newest version of \package{fontinst}) that the |
| 2960 |
% alternative setting you have found hasn't already been included. |
| 2961 |
% |
| 2962 |
% As mentioned, there are two different reglyphing schemes that are set |
| 2963 |
% up by the code below---one has \package{docstrip} guard \Module{glyphs}, |
| 2964 |
% the other has guard \Module{!glyphs}---but they both change SC names |
| 2965 |
% to Expert names. The difference lies instead in what information is |
| 2966 |
% copied from source font to destination font: the \Module{glyphs} |
| 2967 |
% variant copies everything, whereas the \Module{!glyphs} variant |
| 2968 |
% doesn't copy |\setrawglyph| commands, |\setnotglyph| commands, |
| 2969 |
% |\setscaledrawglyph| commands, |\setscalednotglyph| commands or |
| 2970 |
% |\setglyph| constructions. The \Module{!glyphs} variant also |
| 2971 |
% suppresses kerns between two glyphs that doesn't change name. |
| 2972 |
% |
| 2973 |
% The motive for having such a curious set-up naturally lies in how the |
| 2974 |
% files are meant to be used. If you have SC fonts, but no Expert |
| 2975 |
% fonts, then you should definitely use the \Module{glyphs} variant. If |
| 2976 |
% on the other hand you have both SC and Expert fonts for a family, |
| 2977 |
% then it is worth considering using the \Module{!glyphs} variant instead. |
| 2978 |
% The observation this is based on is that within a triad of the |
| 2979 |
% corresponding regular, expert, and SC fonts, almost all glyphs present |
| 2980 |
% in the SC font can also be found in either the regular or the expert |
| 2981 |
% font; furthermore the only missing glyphs were \texttt{FIsmall}, |
| 2982 |
% \texttt{FLsmall}, and \texttt{SSsmall}, which (i) were included in the |
| 2983 |
% SC font only to complete the \texttt{8a} encoding vector and (ii) are |
| 2984 |
% identical to \package{fontinst}'s fakes for them. |
| 2985 |
% |
| 2986 |
% Thus by constructing the \texttt{sc} shape fonts from the regular and |
| 2987 |
% expert variants, instead of the SC variant, one can get away with |
| 2988 |
% using one raw font less, thus reducing the time needed for downloading |
| 2989 |
% the fonts to the printer and the size of the corresponding postscript |
| 2990 |
% file. One thing not found in either of the regular or expert font in |
| 2991 |
% the triad is however the kerns between capitals and small capitals, but |
| 2992 |
% these can be extracted from the metrics of the SC font, and doing this |
| 2993 |
% is the primary objective for the \Module{!glyphs} variant. |
| 2994 |
% |
| 2995 |
% \bigskip |
| 2996 |
% \changes{1.906}{1999/08/01}{Reglyphing settings files added. (LH)} |
| 2997 |
% |
| 2998 |
% First there is the English alphabet: |
| 2999 |
% \begin{macrocode} |
| 3000 |
%<*reglyphletters> |
| 3001 |
\renameglyph{Asmall}{a} |
| 3002 |
\renameglyph{Bsmall}{b} |
| 3003 |
\renameglyph{Csmall}{c} |
| 3004 |
\renameglyph{Dsmall}{d} |
| 3005 |
\renameglyph{Esmall}{e} |
| 3006 |
\renameglyph{Fsmall}{f} |
| 3007 |
\renameglyph{Gsmall}{g} |
| 3008 |
\renameglyph{Hsmall}{h} |
| 3009 |
\renameglyph{Ismall}{i} |
| 3010 |
\renameglyph{Jsmall}{j} |
| 3011 |
\renameglyph{Ksmall}{k} |
| 3012 |
\renameglyph{Lsmall}{l} |
| 3013 |
\renameglyph{Msmall}{m} |
| 3014 |
\renameglyph{Nsmall}{n} |
| 3015 |
\renameglyph{Osmall}{o} |
| 3016 |
\renameglyph{Psmall}{p} |
| 3017 |
\renameglyph{Qsmall}{q} |
| 3018 |
\renameglyph{Rsmall}{r} |
| 3019 |
\renameglyph{Ssmall}{s} |
| 3020 |
\renameglyph{Tsmall}{t} |
| 3021 |
\renameglyph{Usmall}{u} |
| 3022 |
\renameglyph{Vsmall}{v} |
| 3023 |
\renameglyph{Wsmall}{w} |
| 3024 |
\renameglyph{Xsmall}{x} |
| 3025 |
\renameglyph{Ysmall}{y} |
| 3026 |
\renameglyph{Zsmall}{z} |
| 3027 |
%</reglyphletters> |
| 3028 |
% \end{macrocode} |
| 3029 |
% |
| 3030 |
% Then there are the figures: |
| 3031 |
% \multchanges{\notcs{Reglyphing}}{1.911}{1999/12/10} |
| 3032 |
% {\texttt{eightoldstyle} typo corrected. (LH) Spotted by |
| 3033 |
% Rolf Lindgren.} |
| 3034 |
% \multchanges{\notcs{Reglyphing}}{1.927}{2004/07/12} |
| 3035 |
% {Placed commands for letters and figures in separate modules, |
| 3036 |
% so that they can be separated in generation. (LH)} |
| 3037 |
% \begin{macrocode} |
| 3038 |
%<*reglyphfigures> |
| 3039 |
\renameglyph{zerooldstyle}{zero} |
| 3040 |
\renameglyph{oneoldstyle}{one} |
| 3041 |
\renameglyph{twooldstyle}{two} |
| 3042 |
\renameglyph{threeoldstyle}{three} |
| 3043 |
\renameglyph{fouroldstyle}{four} |
| 3044 |
\renameglyph{fiveoldstyle}{five} |
| 3045 |
\renameglyph{sixoldstyle}{six} |
| 3046 |
\renameglyph{sevenoldstyle}{seven} |
| 3047 |
\renameglyph{eightoldstyle}{eight} |
| 3048 |
\renameglyph{nineoldstyle}{nine} |
| 3049 |
%</reglyphfigures> |
| 3050 |
% \end{macrocode} |
| 3051 |
% |
| 3052 |
% Then there are the accents and a couple of miscellaneous symbols. You |
| 3053 |
% might want to check these carefully, as there might not always be a |
| 3054 |
% distinction. |
| 3055 |
% \changes{1.925}{2003/05/13}{Added \cs{renameglyph} for |
| 3056 |
% \texttt{Hungarumlautsmall}. Walter Schmidt noticed it was missing. |
| 3057 |
% (LH)} |
| 3058 |
% \begin{macrocode} |
| 3059 |
%<*reglyphletters> |
| 3060 |
\renameglyph{Acutesmall}{acute} |
| 3061 |
\renameglyph{Brevesmall}{breve} |
| 3062 |
\renameglyph{Caronsmall}{caron} |
| 3063 |
\renameglyph{Cedillasmall}{cedilla} |
| 3064 |
\renameglyph{Circumflexsmall}{circumflex} |
| 3065 |
\renameglyph{Dieresissmall}{dieresis} |
| 3066 |
\renameglyph{Dotaccentsmall}{dotaccent} |
| 3067 |
\renameglyph{Gravesmall}{grave} |
| 3068 |
\renameglyph{Hungarumlautsmall}{hungarumlaut} |
| 3069 |
\renameglyph{Macronsmall}{macron} |
| 3070 |
\renameglyph{Ogoneksmall}{ogonek} |
| 3071 |
\renameglyph{Ringsmall}{ring} |
| 3072 |
\renameglyph{Tildesmall}{tilde} |
| 3073 |
\renameglyph{ampersandsmall}{ampersand} |
| 3074 |
\renameglyph{centoldstyle}{cent} |
| 3075 |
\renameglyph{dollaroldstyle}{dollar} |
| 3076 |
% \end{macrocode} |
| 3077 |
% |
| 3078 |
% There are also all the non-English letters: |
| 3079 |
% \begin{macrocode} |
| 3080 |
\renameglyph{AEsmall}{ae} |
| 3081 |
\renameglyph{Ethsmall}{eth} |
| 3082 |
\renameglyph{Lslashsmall}{lslash} |
| 3083 |
\renameglyph{Oslashsmall}{oslash} |
| 3084 |
\renameglyph{OEsmall}{oe} |
| 3085 |
\renameglyph{Thornsmall}{thorn} |
| 3086 |
% \end{macrocode} |
| 3087 |
% \begin{macrocode} |
| 3088 |
\renameglyph{Agravesmall}{agrave} |
| 3089 |
\renameglyph{Egravesmall}{egrave} |
| 3090 |
\renameglyph{Igravesmall}{igrave} |
| 3091 |
\renameglyph{Ogravesmall}{ograve} |
| 3092 |
\renameglyph{Ugravesmall}{ugrave} |
| 3093 |
% \end{macrocode} |
| 3094 |
% \begin{macrocode} |
| 3095 |
\renameglyph{Aacutesmall}{aacute} |
| 3096 |
\renameglyph{Eacutesmall}{eacute} |
| 3097 |
\renameglyph{Iacutesmall}{iacute} |
| 3098 |
\renameglyph{Oacutesmall}{oacute} |
| 3099 |
\renameglyph{Uacutesmall}{uacute} |
| 3100 |
\renameglyph{Yacutesmall}{yacute} |
| 3101 |
% \end{macrocode} |
| 3102 |
% \begin{macrocode} |
| 3103 |
\renameglyph{Acircumflexsmall}{acircumflex} |
| 3104 |
\renameglyph{Ecircumflexsmall}{ecircumflex} |
| 3105 |
\renameglyph{Icircumflexsmall}{icircumflex} |
| 3106 |
\renameglyph{Ocircumflexsmall}{ocircumflex} |
| 3107 |
\renameglyph{Ucircumflexsmall}{ucircumflex} |
| 3108 |
% \end{macrocode} |
| 3109 |
% \begin{macrocode} |
| 3110 |
\renameglyph{Atildesmall}{atilde} |
| 3111 |
\renameglyph{Ntildesmall}{ntilde} |
| 3112 |
\renameglyph{Otildesmall}{otilde} |
| 3113 |
% \end{macrocode} |
| 3114 |
% \begin{macrocode} |
| 3115 |
\renameglyph{Adieresissmall}{adieresis} |
| 3116 |
\renameglyph{Edieresissmall}{edieresis} |
| 3117 |
\renameglyph{Idieresissmall}{idieresis} |
| 3118 |
\renameglyph{Odieresissmall}{odieresis} |
| 3119 |
\renameglyph{Ydieresissmall}{ydieresis} |
| 3120 |
\renameglyph{Udieresissmall}{udieresis} |
| 3121 |
% \end{macrocode} |
| 3122 |
% \begin{macrocode} |
| 3123 |
\renameglyph{Aringsmall}{aring} |
| 3124 |
\renameglyph{Ccedillasmall}{ccedilla} |
| 3125 |
\renameglyph{Scaronsmall}{scaron} |
| 3126 |
\renameglyph{Zcaronsmall}{zcaron} |
| 3127 |
% \end{macrocode} |
| 3128 |
% |
| 3129 |
% The following four glyphs aren't really necessary, since they are |
| 3130 |
% usually identical to another glyph or to their fakes. |
| 3131 |
% \begin{macrocode} |
| 3132 |
\killglyph{dotlessi} |
| 3133 |
%<*glyphs> |
| 3134 |
\renameglyph{FIsmall}{fi} |
| 3135 |
\renameglyph{FLsmall}{fl} |
| 3136 |
\renameglyph{SSsmall}{germandbls} |
| 3137 |
%</glyphs> |
| 3138 |
%<*!glyphs> |
| 3139 |
\killglyph{fi} |
| 3140 |
\killglyph{fl} |
| 3141 |
\killglyph{germandbls} |
| 3142 |
%</!glyphs> |
| 3143 |
%</reglyphletters> |
| 3144 |
% \end{macrocode} |
| 3145 |
% |
| 3146 |
% The \Module{!glyphs} settings have no need for |\setrawglyph|, |
| 3147 |
% |\setscaledrawglyph|, or |\setglyph| commands, and no need for the |
| 3148 |
% kerns between capitals either, since these are already known from the |
| 3149 |
% regular variant. Note that it is pointless to say |\offmtxcommand|^^A |
| 3150 |
% \penalty0|\setrawglyph| as of v\,1.913 since |\setrawglyph| is now |
| 3151 |
% simply syntactic sugar for the equivalent |\set|\-|scaled|\-|raw|\-^^A |
| 3152 |
% |glyph|. |
| 3153 |
% \begin{macrocode} |
| 3154 |
%<*(reglyphletters|reglyphfigures)&!glyphs> |
| 3155 |
\offmtxcommand\setscaledrawglyph |
| 3156 |
\offmtxcommand\setglyph |
| 3157 |
\resetcommand\iftokeep#1\then{\ifnum 0<#1} |
| 3158 |
%</(reglyphletters|reglyphfigures)&!glyphs> |
| 3159 |
% \end{macrocode} |
| 3160 |
% |
| 3161 |
% |
| 3162 |
% \changes{1.904}{1999/06/13}{Font transformation recordings moved to |
| 3163 |
% \texttt{fimapgen.dtx}, so that the interface will be specified |
| 3164 |
% in a single place. (LH)} |
| 3165 |
% |
| 3166 |
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3167 |
% |
| 3168 |
% \Finale |
| 3169 |
\endinput |