diff options
author | Karl Berry <karl@freefriends.org> | 2009-08-28 17:52:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-08-28 17:52:47 +0000 |
commit | 9574391f1c92725d497fa2a84962aee68b5cbf25 (patch) | |
tree | 8c6a92468e9c6da565ed5da07c13c0c01187875f /Master/texmf-dist/source/fontinst/base | |
parent | 227ebe2cb5e11abb7e12b88ba66adc7735fa9570 (diff) |
fontinst 1.933 (24aug09)
git-svn-id: svn://tug.org/texlive/trunk@14924 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/fontinst/base')
-rw-r--r-- | Master/texmf-dist/source/fontinst/base/CHANGES | 6 | ||||
-rw-r--r-- | Master/texmf-dist/source/fontinst/base/fibasics.dtx | 38 | ||||
-rw-r--r-- | Master/texmf-dist/source/fontinst/base/ficonv.dtx | 337 | ||||
-rw-r--r-- | Master/texmf-dist/source/fontinst/base/fimain.dtx | 77 | ||||
-rw-r--r-- | Master/texmf-dist/source/fontinst/base/fimapgen.dtx | 100 | ||||
-rw-r--r-- | Master/texmf-dist/source/fontinst/base/fisource.dvi | bin | 1091112 -> 1147220 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/fontinst/base/fisource.tex | 82 | ||||
-rw-r--r-- | Master/texmf-dist/source/fontinst/base/fitrig.dtx | 326 | ||||
-rw-r--r-- | Master/texmf-dist/source/fontinst/base/fontinst.ins | 28 |
9 files changed, 835 insertions, 159 deletions
diff --git a/Master/texmf-dist/source/fontinst/base/CHANGES b/Master/texmf-dist/source/fontinst/base/CHANGES index 481d5f3a34d..1c6155ecb8c 100644 --- a/Master/texmf-dist/source/fontinst/base/CHANGES +++ b/Master/texmf-dist/source/fontinst/base/CHANGES @@ -1,6 +1,10 @@ --- CHANGES --- -This is the changes log for the fontinst font installation package. +This is the old changes log for the fontinst font installation package. +As of v1.9, changes in the core are recorded using the \changes +mechanism of the doc package, and appear as a section in the typeset form +of the source (fisource.dvi). Changes to supporting files are typically +recorded in each file, at the end. Feb 4 1993, v0.01: Created the file, wrote an afm and enc parser, started on a vpl writer. diff --git a/Master/texmf-dist/source/fontinst/base/fibasics.dtx b/Master/texmf-dist/source/fontinst/base/fibasics.dtx index 56515e55140..eb8bc1b7a1a 100644 --- a/Master/texmf-dist/source/fontinst/base/fibasics.dtx +++ b/Master/texmf-dist/source/fontinst/base/fibasics.dtx @@ -1,10 +1,11 @@ -% \CheckSum{1512} +% \CheckSum{1505} % \iffalse meta-comment % % Copyright 1993, 1994, 1995, 1996 Alan Jeffrey, % hacked and maintained 1997, 1998 Sebastian Rahtz, -% copyright 1998, 1999, 2000, 2001 the fontinst maintenance team and any -% individual authors listed elsewhere in this file. All rights reserved. +% copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +% the fontinst maintenance team and any individual authors listed +% elsewhere in this file. All rights reserved. % % This file is part of the fontinst system version 1.9. % ----------------------------------------------------- @@ -64,7 +65,7 @@ % stuff any earlier than this. Note that |\fontinstversion| is not % just used for indentification but also in |\needsfontinstversion|. % \begin{macrocode} -%<pkg|doc>\def\fontinstversion{1.929} +%<pkg|doc>\def\fontinstversion{1.933} % \end{macrocode} % \end{macro} % @@ -86,7 +87,7 @@ %<doc>\NeedsTeXFormat{LaTeX2e}[1995/06/01] %<doc>\ProvidesPackage{fontdoc} %<pkg>\ProvidesPackage{fontinst} -%<pkg|doc>[2005/02/05 v\fontinstversion\space +%<pkg|doc>[2007/01/23 v\fontinstversion\space %<doc> fontinst documentation package] %<pkg> fontinst installation package] % \end{macrocode} @@ -439,24 +440,20 @@ \mathchardef\max_mathchardef="7FFF \mathchardef\two_thousand=2000 \newdimen\half_point \half_point=0.5pt +%</pkg> % \end{macrocode} % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} % % % \subsection{Trigonometry macros} % -% Include David Carlisle's trigonometry macros. First, do some hacks -% to get round all that |\NeedsTeXFormat{LaTeX2e}| stuff that David -% put in :-) In v\,1.8 these hacks been moved to an earlier place since -% we put in |\ProvidesPackage| ourselves. -% \SortIndex{trig package}{\package{trig} package} -% -% \begin{macrocode} -\let\@tempdima\a_dimen -\let\@tempdimb\b_dimen -\input trig.sty -%</pkg> -% \end{macrocode} +% Before v\,1.930, the file \texttt{trig.sty} used to be input at this +% point. That is now inlined into the \package{fontinst} source proper +% instead. +% +% \multchanges{\cs{@tempdima}\cs{@tempdimb}}{1.930}{2005/02/06} +% {These aliases for \cs{a_dimen} and \cs{b_dimen} were removed, +% since we may now hack them out of \cs{CalculateTan}. (LH)} % % % \subsection @@ -1948,7 +1945,7 @@ % \meta{digits} is the number of digits to generate. If the % \meta{value} is greater than or equal to $16^{\mathit{digits}}$ % then |\a_count| will be set to \meta{value} divided by this number -% and the formatted value will be for the corresponding reminder. +% and the formatted value will be for the corresponding remainder. % \changes{1.928}{2004/11/28}{Macro added. (LH)} % % The macro overwrites |\a_count|, |\b_count|, and |\c_count|. @@ -1960,7 +1957,7 @@ % |\format_hex_i|\marg{command}\marg{control token} % \end{quote} % If the \meta{control token} is |i| then nothing is done. -% Otherwise the quotient and reminder of |\a_count| with respect to +% Otherwise the quotient and remainder of |\a_count| with respect to % $16$ is computed, where the former is assigned to |\a_count| and % the latter is converted to hexadecimal and prepended to the % \meta{command}, after which the macro expands to @@ -1988,7 +1985,8 @@ % To get the loop to run the wanted number of times, one uses the % trick that |\romannumeral| can generate an arbitrary number of |m|s. % The |\identity_one| stuff is to prevent |\number| from processesing -% the subsequent |001~|, which will be the last that |\roman| reads. +% the subsequent |001~|, which will be the last that |\romannumeral| +% reads. % \begin{macrocode} \def\format_hex#1#2#3{ \a_count=#2 diff --git a/Master/texmf-dist/source/fontinst/base/ficonv.dtx b/Master/texmf-dist/source/fontinst/base/ficonv.dtx index 8af04ffc216..4281142ea16 100644 --- a/Master/texmf-dist/source/fontinst/base/ficonv.dtx +++ b/Master/texmf-dist/source/fontinst/base/ficonv.dtx @@ -1,4 +1,4 @@ -% \CheckSum{2337} +% \CheckSum{2502} % \iffalse meta-comment % % Copyright 1993, 1994, 1995, 1996 Alan Jeffrey, @@ -47,10 +47,6 @@ % reads \meta{encfile}|.enc| and writes the same information to % \meta{etxfile}|.etx|, in a format \TeX{} can read more easily. % -% Each |/|\meta{glyph} command is recorded in a macro |\o-|\meta{glyph}, -% which expands to a corresponding |\setslot|\marg{glyph} -% \textellipsis\ |\endslot| -% statement. % % \begin{macrocode} %<*misc> @@ -59,6 +55,12 @@ % \end{macrocode} % % \begin{macro}{\enctoetx} +% For every |/|\meta{glyph} command, the command |\o-|\meta{glyph} +% gets passed code which writes the corresponding +% |\setslot|\marg{glyph} \textellipsis\ |\endslot| statement. +% Normally that constrol sequence is undefined, hence equivalent to +% |\relax|, and thus the code gets executed. However |\o-.notdef| will +% instead gobble this argument and set |missingslots| to true. % \begin{macrocode} { \catcode`\/=\active @@ -67,20 +69,10 @@ \catcode`\/=\active \catcode`\]=\active \def/##1[{ + \encname_to_etx ##1~{#1}{#2} \a_count=0 \global\missingslotsfalse - \def/####1~{ - \csname~o-####1\endcsname{ - \ifmissingslots - \out_line{\string\nextslot{\the\a_count}} - \fi - \global\missingslotsfalse - \out_line{\string\setslot{####1}} - \out_line{\string\endsetslot} - \out_line{} - } - \advance\a_count by 1 - } + \let/=\encslot_to_etx } \def]~def{} \make_etx{#1}{#2} @@ -88,9 +80,63 @@ } % \end{macrocode} % \end{macro} +% +% \begin{macro}{\encname_to_etx} +% This macro recieves the encoding vector name, the ENC file name, +% and the ETX file name when converting an ENC file to an ETX file. +% The call syntax is +% \begin{quote} +% |\encname_to_etx|\meta{vectorname}\textvisiblespace +% \marg{enc}\marg{etx} +% \end{quote} +% (making the first argument space-delimited but the second +% undelimited is a trick to gobble any space that may be present at +% the end of that which the caller thinks is the vector name). +% +% The command outputs a |\declarepsencoding| command to the +% generated ETX file. +% \changes{1.931}{2005/05/13}{Macro added, to support caching +% original ENC names in autogenerated ETX files. (LH) +% Thanks to Alexej Kryukov for the inspiration for this.} +% \begin{macrocode} +\def\encname_to_etx#1~#2#3{ + \out_line{\percent_char\space REMOVE~THE~FOLLOWING~LINE~IF~ + THIS~FILE~IS~MODIFIED~OR~RENAMED.} + \out_line{\string\declarepsencoding{#3}{#1}{\string\download{#2.enc}}} + \out_line{} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\encslot_to_etx} +% This macro grabs everything up to the next space and writes a +% |\setslot| entry with the grabbed material as glyph name. It is +% used as the definition of |/| (active character) when parsing +% elements of an encoding vector. +% \changes{1.931}{2005/05/13}{Macro added (separated from +% \cs{enctoetx}). (LH)} +% \begin{macrocode} +\def\encslot_to_etx#1~{ + \csname o-#1\endcsname{ + \ifmissingslots + \out_line{\string\nextslot{\the\a_count}} + \fi + \global\missingslotsfalse + \out_line{\string\setslot{#1}} + \out_line{\string\endsetslot} + \out_line{} + } + \advance\a_count by 1 +} +% \end{macrocode} +% \end{macro} % -% |\make_etx| finishes the job of |\enctoetx|. -% +% \begin{macro}{\make_etx} +% |\make_etx| does the stuff that |\enctoetx| does not; it handles +% writing the preamble and postamble of the ETX file, but also does +% the actual |\input| of the ENC file to convert. +% \changes{1.931}{2005/05/13}{Now requiring a particular +% \package{fontdoc} version. (LH)} % \begin{macrocode} \def\make_etx#1#2{ \open_out{\temp_prefix#2.etx} @@ -108,13 +154,13 @@ \out_line{\string\relax} \out_line{} \out_line{\string\documentclass[twocolumn]{article}} - \out_line{\string\usepackage{fontdoc}} + \out_line{\string\usepackage{fontdoc}[2005/05/13]} \out_line{} \out_line{\string\begin{document}} \out_line{} \out_line{This~document~describes~the~#1~encoding.} \out_line{It~was~automatically~generated~by~the} - \out_line{{\string\tt\space~fontinst}~package.} + \out_line{\string\texttt{fontinst}~package.} \out_line{} \out_line{\string\encoding} \out_line{} @@ -125,9 +171,10 @@ \out_line{\string\end encoding} \out_line{} \out_line{\string\end{document}} - \close_out{Encoding~vector} + \close_out{Encoding} } % \end{macrocode} +% \end{macro} % % % \subsection{Converting an ETX file to an ENC file} @@ -400,7 +447,9 @@ % % % \begin{macro}{\etxtocmap} -% The +% As usual for macros with this kind of name, this is the user +% level command to call to generate a CMAP from an ETX. The +% arguments are file names (not including extensions). % \begin{macrocode} \def\etxtocmap#1#2{\begingroup \inputetx{#1} @@ -561,8 +610,9 @@ {\afm_command#1~\end_of_line\afm_line}} % \end{macrocode} % -% The command |\afm_command| reads the first word |FOO|, and calls -% |afm-FOO|. If this does not exist, then |\gobble_one_line| will +% The command |\afm_command| reads the first word \meta{FOO}, and +% calls |\afm-|\meta{FOO}\describecsfamily{afm-\meta{key}}. If this +% does not exist, then |\gobble_one_line| will % eat up the rest of the line. % % \begin{macrocode} @@ -580,10 +630,12 @@ % To define an AFM command, you say |\afm_def|\marg{command}^^A % \parg{pattern}\marg{result} % \begin{macrocode} -\def\afm_def#1(#2)#3{\x_cs\def{afm-#1} - \gobble_one_line#2\end_of_line{#3}} +\def\afm_def#1(#2)#3{ + \x_cs\def{afm-#1}\gobble_one_line#2\end_of_line{#3} +} % \end{macrocode} % \end{macro} +% % \begin{macro}{\afm_let} % Saying |\afm_let|\marg{dest-command}\marg{source-command} copies % the definition of one AFM command to another. @@ -654,9 +706,20 @@ } % \end{macrocode} % \end{macro} -% -% Processing kern pairs. If one of the glyph name starts with -% a dot as in |.notdef| or |.null| the kern pair is ignored. +% +% \begin{macro}{\afm-KPX} +% \begin{macro}{\afm-KP} +% Processing kern pairs. If one of the glyph name starts with +% a dot as in |.notdef| or |.null| the kern pair is ignored. +% The pair is also ignored if the absolute value of the kern +% amount is |\minimum_kern| or less. +% +% That \texttt{KPX} can have the same definition as \texttt{KP} is +% due to an edge case in the processing of AFM lines: |\afm_line| +% inserts an extra space at the end of a line. For \texttt{KPX} +% which really only has three arguments this extra space matches +% the space in |#3~#4|, whereas for \texttt{KP} which has four +% arguments this extra space appears at the end of |#4|. % % \begin{macrocode} \afm_def{KP}(#1~#2~#3~#4){ @@ -664,21 +727,42 @@ \if\first_char#2=.\else \afm_length\a_count{#3} \ifnum \a_count>\minimum_kern - \out_line{\string\setkern{#1}{#2}{\the\a_count}} + \afm_write_setkern{#1}{#2}{\the\a_count} \else\ifnum \a_count<-\minimum_kern - \out_line{\string\setkern{#1}{#2}{\the\a_count}} + \afm_write_setkern{#1}{#2}{\the\a_count} \fi\fi \fi\fi } \afm_let{KPX}{KP} % \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\afm_write_setkern} +% This macro is a hook for the auto-aliasing mechanism to redefine. +% In this plain form, it just outputs a |\setkern| command with the +% given three arguments. +% \changes{1.933}{2007/01/23}{Macro added. (LH)} +% \begin{macrocode} +\def\afm_write_setkern#1#2#3{\out_line{\string\setkern{#1}{#2}{#3}}} +% \end{macrocode} +% \end{macro} % % Processing char metrics. % % \begin{macrocode} \afm_def{C}(#1~;#2){\init_afm{#1}\do_list[#2]\afm_char} -\afm_let{CH}{C} % \end{macrocode} +% +% \begin{macro}{\afm-CH} +% The |CH| keyword is like |C|, but signals that the following +% character code is given in hexadecimal. +% \changes{1.933}{2007/01/22}{Proper definition, that parses the +% following hexadecimal value. (LH) Since noone has complained +% about this before, it's probably not very common.} +% \begin{macrocode} +\afm_def{CH}(<#1>~;#2){\uppercase{\init_afm{"#1}}\do_list[#2]\afm_char} +% \end{macrocode} +% \end{macro} % % Processing composite chars. % @@ -700,8 +784,9 @@ \let\char_name=\empty_command % \end{macrocode} % -% |\init_afm| initializes the variables the AFM character list writes to. -% +% \begin{macro}{\init_afm} +% |\init_afm| initializes the variables the AFM character list +% writes to. % \begin{macrocode} \def\init_afm#1{ \char_slot=#1\x_relax @@ -713,23 +798,17 @@ \let\char_name=\empty_command } % \end{macrocode} +% \end{macro} % -% ^^A Commented out, since it describes the way of things before -% ^^A v1.308 (this comment has been wrong for over five years!): -% ^^A -% ^^A |\afm_char| writes the values of these variables to the |.mtx| -% ^^A file, and saves them in a macro |\g-GLYPHNAME|, in the form: -% ^^A \begin{quote} -% ^^A |{WIDTH}{HEIGHT}{DEPTH}{ITALIC}| -% ^^A \end{quote} -% ^^A -% ^^A These are needed, because the (grumble grumble) syntax of |CC| -% ^^A commands doesn't include the glyph measurements, so we have to -% ^^A remember them. -% +% \begin{macro}{\afm_char} +% This command is executed at the end of processing a \texttt{C} +% (or \texttt{CH}) line. It outputs the corresponding +% |\setrawglyph| or |\setnotglyph| command, based on information +% stored into registers when processing that line. +% \changes{1.933}{2007/01/23}{Negating \cs{bbox_lly} using +% \cs{number} instead of an assignment to \cs{a_count}. (LH)} % \begin{macrocode} \def\afm_char{ - \a_count=-\bbox_lly \eval_expr{ \italcorr_expression\x_width\bbox_llx\bbox_urx\bbox_lly\bbox_ury } @@ -745,11 +824,12 @@ {\the\char_slot} {\the\x_width} {\the\bbox_ury} - {\the\a_count} + {\number -\bbox_lly} {\the\result} } } % \end{macrocode} +% \end{macro} % % |\init_cc| and |\cc_char| write out a composite character glyph. % @@ -840,7 +920,10 @@ % \end{macro} % % To process a list of commands separated by semi-colons, we call -% |\do_list[LIST]|. This works in a similar way to |\afm_line|. +% |\do_list[LIST]|. This works in a similar way to |\afm_line|, but +% the control sequence family used for decoding is +% \describecsfamily{list-\meta{key}}|\list-|\meta{keyword} rather +% than |\afm-|\meta{keyword}. % % \begin{macrocode} \def\do_list[~#1~#2;~#3]{ @@ -879,7 +962,129 @@ \out_lline{\string\glyphpcc{#1}{\the\a_count}{\the\b_count}} } % \end{macrocode} -% +% +% \begin{macro}{\definealias} +% The |\definealias| command can be used to define a glyph name +% alias, for generation of |\aliased| clauses in glyph names. The +% syntax is +% \begin{quote} +% |\definealias|\marg{alias name}\marg{font's name}\marg{int} +% \end{quote} +% where \meta{font's name} is the glyph name that if found in an +% AFM file should be converted to an |\aliased| clause using the +% \meta{alias name}. The \meta{int} is the name of an integer which +% will be incremented every time this alias applies to a glyph +% definition; this mechanism is meant to help higher level code +% pick an ETX file that fits the font's glyph names. +% +% \changes{1.933}{2007/01/22}{Command added. (LH)} +% +% Defined aliases are stored in the +% \describecsfamily{GN-\meta{font's name}}|\GN-|\meta{font's name} +% family of control sequences. These control sequences are defined +% to be macros expanding to the two tokens +% \begin{quote} +% |\g-|\meta{alias name}\,|\i-|\meta{int} +% \end{quote} +% In the case of |\g-|\meta{alias name}, this is purely a trick to +% save memory (it is very likely that these control sequences will +% anyway occur during the fontmaking part of the processing). +% \begin{macrocode} +\def\definealias#1#2#3{ + \expandafter\def \csname GN-#1 \expandafter\endcsname + \expandafter{ \csname g-#2 \expandafter\endcsname + \csname i-#3\endcsname} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\glyph_alias} +% \begin{macro}{\glyph_alias_i} +% The |\glyph_alias| macro has the syntax +% \begin{quote} +% |\glyph_alias|\marg{font's name} +% \end{quote} +% It expands to the \meta{alias name} corresponding to the +% \meta{font's name}, that had previously been set up using +% |\definealias|. Where this macro is used, it must already have +% been checked that |\GN-|\meta{font's name} is defined. +% \begin{macrocode} +\def\glyph_alias#1{ + \expandafter\expandafter \expandafter\glyph_alias_i + \csname GN-#1\endcsname +} +\def\glyph_alias_i#1#2{ + \expandafter\gobble_three \string#1 +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macrocode} +\let\charnameprefix\empty +\def\charnamealias#1{ + \if_defined{GN-\charnameprefix#1}\then + \glyph_alias{\charnameprefix#1} + \else\if_defined{GN-#1}\then + \glyph_alias{#1} + \else + #1 + \fi\fi +} +% \end{macrocode} +% +% \begin{macrocode} +\def\alias_incr#1{ + \expandafter\expandafter \expandafter\alias_incr_i + \csname GN-#1\endcsname +} +\def\alias_incr_i#1#2{ + \ifx#2\x_relax + \mathchardef#2=\@ne + \else + \a_count=#2 + \advance\a_count\@ne + \mathchardef#2=\a_count + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\def\alias_char_name#1{ + \if_defined{GN-\charnameprefix#1}\then + \edef\char_name{ + \string\aliased{#1}{\glyph_alias{\charnameprefix#1}} + } + \alias_incr{\charnameprefix#1} + \else\if_defined{GN-#1}\then + \edef\char_name{ + \string\aliased{#1}{\glyph_alias{#1}} + } + \alias_incr{#1} + \else + \edef\char_name{#1} + \fi\fi +} +\def\autoaliasafm{ + \begingroup + \list_def{N}(##1){\alias_char_name{##1}} + \def\afm_write_setkern##1##2##3{ + \out_line{ + \string\setkern{\charnamealias{##1}}{\charnamealias{##2}}{##3} + } + } + \def\init_cc##1{% + \edef\char_name{\charnamealias{##1}} + \out_line{\string\setglyph{\char_name}} + } + \list_def{PCC}(##1~##2~##3){ + \afm_length\a_count{##2} + \afm_length\b_count{##3} + \out_lline{\string\glyphpcc + {\charnamealias{##1}}{\the\a_count}{\the\b_count}} + } +} +\def\endautoaliasafm{\endgroup} +% \end{macrocode} % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -2043,16 +2248,14 @@ % \changes{1.911}{1999/11/19}{\cs{edef}ing \cs{raw_font_name}. (LH)} % \changes{1.915}{2000/09/09}{Locally redefining \cs{aliased}. (LH)} % \changes{1.924}{2003/02/08}{Added \cs{directfalse}. (LH)} +% \changes{1.931}{2005/05/13}{Placed ETX processing after +% \cs{needsfontinstversion} had been written, so that ETX commands +% can write data directly to the output MTX file. (LH)} +% \changes{1.931}{2005/05/13}{Copying \cs{declarepsencoding} data to +% generated MTX file as a \cs{setpsencoding} command. (LH)} % \begin{macrocode} \def\mtxtomtx#1#2{{ - \ifisstr{etx-name}\then - \def\do_slot{\x_cs\edef{slots-\slot_name}{\the\slot_number}} - \directfalse - \inputetx{\str{etx-name}} - \edef\a_macro{\string\reencodefont{\str{etx-name}}} - \else - \let\a_macro=\empty_command - \fi + \let\a_macro=\empty_command \_a_true \ifnum \int{x-scale}=\int{y-scale} \ifnum \int{slant-scale}=\z@ @@ -2082,6 +2285,20 @@ \out_line{} \out_line{\string\needsfontinstversion{\fontinstversion}} \out_line{} + \ifisstr{etx-name}\then + \def\do_slot{\x_cs\edef{slots-\slot_name}{\the\slot_number}} + \def\declarepsencoding##1##2##3{ + \a_toks={{##1}{##2}{##3}} + \out_line{\string\providepsencoding\the\a_toks} + \ifnum \transform_record_file=\closed_stream \else + \pout_line\transform_record_file + {\string\providepsencoding\the\a_toks} + \fi + } + \directfalse + \inputetx{\str{etx-name}} + \edef\a_macro{\a_macro\string\reencodefont{\str{etx-name}}} + \fi \record_transform{#2}{\string\frommtx{#1}}{\a_macro}\iftrue \out_line{} \mtxtomtx_redefinitions diff --git a/Master/texmf-dist/source/fontinst/base/fimain.dtx b/Master/texmf-dist/source/fontinst/base/fimain.dtx index 6edad395440..8fe61d23a73 100644 --- a/Master/texmf-dist/source/fontinst/base/fimain.dtx +++ b/Master/texmf-dist/source/fontinst/base/fimain.dtx @@ -1,4 +1,4 @@ -% \CheckSum{4033} +% \CheckSum{4056} % \iffalse meta-comment % % Copyright 1993, 1994, 1995, 1996 Alan Jeffrey, @@ -2332,6 +2332,10 @@ % \end{quote} % \changes{1.925}{2003/05/28}{Added check that the glyph used is % defined; we get an ugly error if it isn't. (LH)} +% \changes{1.932}{2005/06/17}{Changed error message to warning when a +% corresponding notglyph exists. (LH) This deals with an issue +% regarding composites in fonts which have been reencoded to +% something not a superset of \texttt{8a}.} % % \begin{macrocode} %<*pkg> @@ -2342,12 +2346,17 @@ \moveup{#3} \glyph{\glyph_name_modifier{#1}}{\one_thousand} \pop + \else\ifisglyph{\glyph_name_modifier{#1}-not}\then + \fontinstwarning{\string\glyphpcc}{ + Base~glyph~`\glyph_name_modifier{#1}'~not~appended,\messagebreak + because~it~is~so~far~unencoded~in~the~glyph~base + } \else \fontinsterror{\string\glyphpcc}{ - Base~glyph~not~set.\messagebreak - This~could~be~a~sign~that~the~AFM~file~is~buggy + Base~glyph~not~set.\messagebreak + This~could~be~a~sign~that~the~AFM~file~is~buggy }\error_help_a - \fi + \fi\fi } %</pkg> % \end{macrocode} @@ -2715,7 +2724,7 @@ % is a category 12 (other) token whose character code equals the slot % number. % -% In the entire space of such names, each slot sould be mensioned +% In the entire space of such names, each slot should be mentioned % at most once, with one exception, namely the slot which serves as % right boundary marker, which may occur twice (once for the glyph % which actually is assigned to the slot and once for the right boundary @@ -4451,22 +4460,50 @@ % % \begin{macro}{\substitutesilent} % \begin{macro}{\substitutenoisy} -% |\substitutesilent{TO}{FROM}|\\ -% |\substitutenoisy{TO}{FROM}| -% -% Specifies a default substitution for family or shape |TO|, -% which is substituted by family or shape |FROM|. -% -% \begin{macrocode} -\def\substitutesilent#1#2{ - \x_cs\def{sub-#2}{#1} - \x_cs\def{typ-#2}{ssub} -} -\def\substitutenoisy#1#2{ - \x_cs\def{sub-#2}{#1} - \x_cs\def{typ-#2}{sub} +% These commands specify a default substitution for series or shape +% \meta{to}, which points to the series or shape \meta{from}. +% \begin{quote} +% |\substitutesilent|\marg{to}\marg{from}\\ +% |\substitutenoisy|\marg{to}\marg{from} +% \end{quote} +% There can be at most one \meta{to} for every \meta{from}; later +% substitutions will override previous ones. If \meta{to} and +% \meta{from} are equal, then any existing substitution from +% \meta{from} is disabled. +% +% The way this is implemented is that if a font has been installed +% with shape or series \meta{from}, but no entry for \meta{to} has +% been written, then write an entry also for \meta{to} consisting of +% a substitution by \meta{from}. (After doing that, an entry has been +% written also for \meta{to}, so the process may repeat itself with +% the old \meta{to} as a new \meta{from}.) +% +% \begin{macro}{\substitute_generic} +% This is the common part of |\substitutesilent| and +% |\substitutenoisy|. The syntax is +% \begin{quote} +% |\substitute_generic|\marg{type}\marg{to}\marg{from} +% \end{quote} +% where \meta{type} is |ssub| or |sub| respectively. +% \changes{1.931}{2005/05/12}{Macro added, to support explicit +% disabling of substitutions. (LH)} +% \begin{macrocode} +\def\substitute_generic#1#2#3{ + \edef\a_macro{#2} + \edef\b_macro{#3} + \ifx \a_macro \b_macro + \x_cs\let{sub-#3}\undefined_command + \else + \x_cs\let{sub-#3}\a_macro + \x_cs\def{typ-#3}{#1} + \fi } % \end{macrocode} +% \end{macro} +% \begin{macrocode} +\def\substitutesilent{\substitute_generic{ssub}} +\def\substitutenoisy{\substitute_generic{sub}} +% \end{macrocode} % \end{macro} % \end{macro} % @@ -4492,7 +4529,7 @@ % \end{macrocode} % % -% \subsection{The font substitution mechanism} +% \subsection{New font substitution mechanism} % % \textbf{Note:} This subsection contains (part of) a new implementation % of the font substitution mechanism, but it is uncertain whether it diff --git a/Master/texmf-dist/source/fontinst/base/fimapgen.dtx b/Master/texmf-dist/source/fontinst/base/fimapgen.dtx index fccdf30b5e2..0ebd1fe7d78 100644 --- a/Master/texmf-dist/source/fontinst/base/fimapgen.dtx +++ b/Master/texmf-dist/source/fontinst/base/fimapgen.dtx @@ -1,4 +1,4 @@ -% \CheckSum{876} +% \CheckSum{916} % \iffalse meta-comment % % Copyright 1999 the fontinst maintenance team and any individual @@ -95,10 +95,10 @@ % \end{quote} % The only real difference between |\fromafm| and |\frompl| at this % stage is that the former specifies the PS name of the font, but the -% latter do not. If you write a |\store|\-|map|\-|data| command yourself +% latter does not. If you write a |\store|\-|map|\-|data| command yourself % and want to supply the PS name then you should use |\fromafm| even if % you took the font metrics from a PL. -% There is a important difference between |\fromvpl| and the first three +% There is an important difference between |\fromvpl| and the first three % in that virtual fonts need no map file entry (and hence there should % not be any either). Besides some error checking, |\fromvpl| causes a % |\makemapentry| to do essentially nothing. @@ -829,10 +829,11 @@ % \end{quote} % \meta{postscript name} is the name by which the encoding is known to % the postscript interpreter, and \meta{action} lists any additional -% action that must be taken before the encoding can be used. So far the -% only action known is \DescribeMacro{\download}|\download|\marg{file}, -% which will cause code for downloading the file by the name \meta{file} -% (suffix included) to be inserted in the output. +% action that must be taken before the encoding can be used. +% ^^A So far the only actions known is +% ^^A \DescribeMacro{\download}|\download|\marg{file}, +% ^^A which will cause code for downloading the file by the name +% ^^A \meta{file} (suffix included) to be inserted in the output. % % \begin{macro}{\declarepsencoding} % Data is entered in a |\pse-|\meta{etx} macro using the @@ -842,6 +843,38 @@ % \end{quote} % \begin{macrocode} \def\declarepsencoding#1#2#3{\x_cs\gdef{pse-#1}{{#2}{#3}}} +%</map> +% \end{macrocode} +% In main \package{fontinst}, |\declarepsencoding| should be a noop so +% that it can appear in encoding files. It's probably a good idea to +% show it when typesetting as well. +% \changes{1.931}{2005/05/13}{Added main \package{fontinst} and +% \package{fontdoc} definitions. (LH)} +% \begin{macrocode} +%<pkg>\let\declarepsencoding=\gobble_three +%<*doc> +\def\declarepsencoding#1#2#3{\comment{% + This file corresponds to the \FD@typeset@string{#2} encoding vector.}} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\providepsencoding} +% This command is basically the same as |\declarepsencoding|, but it +% checks whether the encoding has already been set and does nothing +% if that is the case. It is used for autogenerated declarations, to +% allow the user to override the setting. +% \changes{1.931}{2005/05/13}{Command added. (LH)} +% \begin{macrocode} +%<*map> +\def\providepsencoding#1#2#3{ + \if_undefined{pse-#1}\then + \declarepsencoding{#1}{#2}{#3} + \fi +} +%</map> +%<pkg>\let\providepsencoding=\gobble_three +%<doc>\newcommand\providepsencoding[3]{} % \end{macrocode} % \end{macro} % @@ -849,6 +882,7 @@ % By default |\download| gobbles its argument. It should be redefined % when that is not the desired effect. % \begin{macrocode} +%<*map> \let\download=\gobble_one % \end{macrocode} % \end{macro} @@ -863,9 +897,19 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\encodingdownload} +% By default this defaults to being a synonym of |\download|, to +% simplify matters for drivers where the distinction is not relevant. +% They should be redefined when that is not the desired effect. +% \changes{1.931}{2005/05/04}{Command added. (LH)} +% \begin{macrocode} +\def\encodingdownload#1{\download{#1}} +% \end{macrocode} +% \end{macro} +% % Some encodings seem to always be present, so they can be declared here. % \begin{macrocode} -\declarepsencoding{8r}{TeXBase1Encoding}{\download{8r.enc}} +\declarepsencoding{8r}{TeXBase1Encoding}{\encodingdownload{8r.enc}} \declarepsencoding{8a}{StandardEncoding}{} % \end{macrocode} % \package{fontinst} must be told about other postscript encodings (if you @@ -924,6 +968,12 @@ % | \download{MinionMM.pfb}\download{zmnl8ac6.pro}%|\\ % |}| % \end{quote} +% (It should probably be remarked that the most common method of +% defining a multiple master font instance is not to explicitly +% create it as in this example, but to simply use it as any ordinary +% PS font and then rely on the PS \textsf{findfont} operator to +% automagically create it for you. This requires using a special +% naming scheme for instances of multiple master fonts.) % \item Fonts which do not fit any of the general naming schemes. % \end{itemize} % @@ -1299,19 +1349,27 @@ % \begin{macro}{\append_download} % The |\downloads_list| is a token list register which is especially % used for accumulating |\download| commands. Each driver maker which -% uses it should begin by emptying it. +% uses it should begin by emptying it. The command % \begin{quote} -% |\append_download|\marg{arg} +% |\append_download|\marg{cseq}\marg{string expression} % \end{quote} +% \changes{1.931}{2005/05/10}{New syntax (two arguments)! The second +% is expanded, whereas the first is protected by a \cs{noexpand}. +% (LH)} % appends % \begin{quote} -% |\download|\marg{arg} +% \meta{cseq}\marg{expanded string expression} % \end{quote} -% to |\downloads_list|. +% to |\downloads_list|. It overwrites |\a_macro|. % \begin{macrocode} \newtoks\downloads_list -\def\append_download#1{ - \downloads_list=\expandafter{ \the\downloads_list \download{#1} } +\def\append_download#1#2{ + \edef\a_macro{ + \downloads_list = + \noexpand\expandafter{ \noexpand\the \downloads_list + \noexpand#1 {#2} } + } + \a_macro } % \end{macrocode} % \end{macro}\end{macro} @@ -1323,13 +1381,17 @@ % mapfile entry is on one line, the entire entry is written at once. % The \meta{font transformations} is collected as explicit text in the % macro |\postscript_code|. The \meta{downloads} is collected as a -% sequence of |\download| commands in the |\downloads_list| token -% register. +% sequence of |\|\dots|download| commands in the |\downloads_list| +% token register. +% \changes{1.931}{2005/05/10}{Supporting \cs{fulldownload} and +% \cs{encodingdownload}. (LH)} % \begin{macrocode} \def\make_dvips{ \downloads_list={} \let\postscript_code\empty_command - \let\download\append_download + \def\download{\append_download\download} + \def\fulldownload{\append_download\fulldownload} + \def\encodingdownload{\append_download\encodingdownload} \ifx \reencode_etx\empty_command \else \if_undefined{pse-\reencode_etx}\then \etxtoenc{\reencode_etx}{\reencode_etx} @@ -1377,7 +1439,7 @@ \fi\fi \if_a_ \ifx \PS_font_file\unknown_str \get_PS_font_file \fi - \append_download{\PS_font_file} + \append_download\download{\PS_font_file} \ifx \PS_font_file\clueless_str \includewarning\warn_undecided_data \fi @@ -1390,6 +1452,8 @@ % expanding the |\the| with an |\expandafter|. % \begin{macrocode} \def\download##1{~<##1} + \def\fulldownload##1{~<<##1} + \def\encodingdownload##1{~<[##1} \pout_line\output_dvips{ \TeX_font_name\space\PS_font_name \expandafter\empty_command \the\downloads_list diff --git a/Master/texmf-dist/source/fontinst/base/fisource.dvi b/Master/texmf-dist/source/fontinst/base/fisource.dvi Binary files differindex 335361e6f20..0a564d8141d 100644 --- a/Master/texmf-dist/source/fontinst/base/fisource.dvi +++ b/Master/texmf-dist/source/fontinst/base/fisource.dvi diff --git a/Master/texmf-dist/source/fontinst/base/fisource.tex b/Master/texmf-dist/source/fontinst/base/fisource.tex index 8c684883f99..39f29a7f17b 100644 --- a/Master/texmf-dist/source/fontinst/base/fisource.tex +++ b/Master/texmf-dist/source/fontinst/base/fisource.tex @@ -87,7 +87,8 @@ \fi \title{The \package{fontinst} utility} -\author{Alan Jeffrey, Sebastian Rahtz, Ulrik Vieth, Lars Hellstr\"om} +\author{Alan Jeffrey\and David Carlisle\and Sebastian Rahtz\and + Ulrik Vieth\and Lars Hellstr\"om} \begin{document} \maketitle @@ -106,10 +107,14 @@ This document implements and describes version~1.9 of \subsection{Source files} -The source for \package{fontinst} is currently split on the six -source files \texttt{fibasics.dtx}, \texttt{ficommon.dtx}, -\texttt{fimain.dtx}, \texttt{ficonv.dtx}, \texttt{filtfam.dtx}, and -\texttt{fimapgen.dtx}. +The source for \package{fontinst} is currently split on the seven +source files \texttt{fibasics.dtx} (basic \TeX\ initialisation and +hackery), \texttt{ficommon.dtx} (commands for variables, integer +expressions, and the like), \texttt{fimain.dtx} (actually making +fonts), \texttt{fitrig.dtx} (trigonometry), \texttt{ficonv.dtx} +(conversions between file formats, font transformations), +\texttt{filtfam.dtx} (the \cs{latinfamily} command), and +\texttt{fimapgen.dtx} (mapfile generation). \subsection{Generated files} @@ -155,10 +160,6 @@ By running the \package{docstrip} installation script \texttt{csc2x.tex}, which only changes the names of digits. \end{description} -\texttt{fontinst.ins} also generates the file \texttt{trig.sty}, which -contains \index{Carlisle, David} David Carlisle's -\SortIndex{trig package}{\package{trig} package} \package{trig} -package, and puts it in the same place as \texttt{fontinst.sty}. \changes{1.914}{2000/05/14}{Generating \texttt{trig.sty} from source. (LH)} @@ -176,8 +177,8 @@ The source is split up on the following \package{docstrip} modules: \item[\Module{debug}, \texttt{filtfam}] Guards code in the |\latinfamily| section that writes \texttt{INFO>} messages. - \item[\Module{doc}, \texttt{fibasics}, \texttt{ficommon}, and - \texttt{fimain}] + \item[\Module{doc}, \texttt{fibasics}, \texttt{ficommon}, + \texttt{fimain}, and \texttt{fimapgen}] Guards code that is to go into \texttt{fontdoc.sty}. \item[\Module{driver}, all files] Guards the driver code---the short piece of \LaTeX\ code in the @@ -235,7 +236,7 @@ The source is split up on the following \package{docstrip} modules: \item[\Module{textcomp}, \texttt{filtfam}] Guards code in the |\latinfamily| section that generates text symbol (\texttt{TS1}\slash ``text companion'') fonts. - \item[\Module{underconstruction}, \texttt{main}] + \item[\Module{underconstruction}, \texttt{fimain}] Guards some code that is ``under construction''. \end{description} @@ -353,9 +354,12 @@ enhancements can be based. \section{About this \package{fontinst} release} -Several improvements, some of which fixes old bugs and some of which -introduces new features, have been made to in particular the generation -of fonts. The most important are: +Versions 1.9xx of \package{fontinst} represent a more-or-less +continuous evolution from 1999 to the present. Several improvements, +the extents of which are perhaps not clearly represented in the version +number increments, have been made in this series---sometimes as fixes +to old bugs, but more often to introduce new features. The most +important are: \begin{itemize} \item The old multiple |\setkern| bug, which resulted in pointless |KRN| instructions being written to (V)PL files have been fixed. @@ -393,8 +397,8 @@ of fonts. The most important are: \item Several \package{fontinst} commands that were previously missing have been added to the \package{fontdoc} package. The most significant are probably |\inputmtx| and |\inputetx|. - \item There is now a simple way of changing the names of glyphs in - metric files generated from AFM files. + \item There is now a way of automatically changing the names of + glyphs in metric files generated from AFM files. % See Subsection~\ref{Ssec:Reglyph} for further details. \item The implementation of font metrics transformations, as done by |\transformfont|, has been rewritten and \package{fontinst} now @@ -417,7 +421,7 @@ of fonts. The most important are: |\setscaled|\-|notglyph| which generalize the |\setraw|\-|glyph| and |\setnot|\-|glyph| commands. These commands are described in Subsection~\ref{Ssec:Glyph-info}. - \item The routines for converting metrics to (V)PL format has + \item The routines for converting metrics to (V)PL format have changed. As a result of this the metrics of fonts are likely to change (slightly), but the conversion is now more accurate than it used to be. A side-effect is that VPL files generated by @@ -514,6 +518,20 @@ of fonts. The most important are: | \Unicode{0069}{LATIN SMALL LETTER I}|\\ |}| \end{quote} + \item + There are now three `actions' for files needed for a font: + |\download|, |\fulldownload|, and |\encodingdownload|; + corresponding to the prefixes |<|, |<<|, and |<[| respectively + in a \package{dvips} map file. + \item + There is a documented way of turning off default substitutions: + Make a |\substitutesilent| or |\substitutenoisy| with the + \meta{from} argument also as \meta{to}. + \item + When ETX files are generated using |\enctoetx| then the original + encoding names (as PS object and as file) are recorded and this + information is made available to the map file writer when + necessary. \end{itemize} @@ -607,17 +625,22 @@ packages, see Section~\ref{Sec:Metric files}. \subsection{Word boundary ligatures and kerns} One of the new features added in \TeX~3 was that of ligatures and -kerns with word boundaries. \package{fontinst} has had an interface +kerns with word boundaries.\footnote{For purposes of ligatures and +kerning, a `word' is a consecutive string of characters from a +single font. These words thus typically include punctuation marks, +unlike the `words' considered in hyphenation.} +\package{fontinst} has had an interface for making such ligatures and kerns, but it has been completely redesigned in v\,1.9 and the old interface (setting the integer |boundarychar|) is no longer recognized by \package{fontinst}. Files which use the old interface can still be processed with \texttt{cfntinst.sty}, though. -Before considering the new commands, it is suitable to make a -distinction between proper glyphs and pseudoglyphs. A proper glyph has -been set using one of the commands |\setrawglyph|, |\setglyph|, and -|\resetglyph|. A pseudoglyph is any name used in the context of a +Before considering the new commands, it is suitable to define the +concepts of proper glyph and pseudoglyph. A \emph{proper glyph} has +been set using one of the commands |\setrawglyph|, +|\set|\-|scaled|\-|raw|\-|glyph|, |\setglyph|, and +|\reset|\-|glyph|. A pseudoglyph is any name used in the context of a glyph name which does not denote a proper glyph. If a pseudoglyph |g-not| was set using the |\setnotglyph| command, then |\ifisglyph{g-not}\then| will evaluate to true, but something can be @@ -630,7 +653,7 @@ specified using the commands |\setleftboundary| and |\endsetleftboundary|, which are syntactically identical to |\setslot| and |\endsetslot| respectively. One important difference is however that the argument to |\setslot| must be a proper glyph, while -the argument to |\setleftboundary| may be any glyph, hence any +the argument to |\setleftboundary| may be any glyph, hence a pseudoglyph will do just fine. |\ligature| commands between |\setleftboundary| and @@ -860,9 +883,8 @@ structure (comments not necessary, of course): The |\adddriver| command gives the order ``write map file entries for the \meta{driver name} DVI driver to the file \meta{output file}.'' The plan is that it should be possible to use the name of just about any -major driver (\texttt{dvips}, \texttt{xdvi},\footnote{Or -does that use the same map file as \texttt{dvips}? I heard somewhere -that it did. /LH} \texttt{pdftex},\footnote{pdf\TeX\ can read +major driver (\texttt{dvips}, \texttt{xdvi}, +\texttt{pdftex},\footnote{pdf\TeX\ can read the map files generated for \texttt{dvips}, but a separate driver is desirable because the formats are not completely identical.} \texttt{OzTeX}, etc.) here and get suitable map file entries for that @@ -2007,7 +2029,10 @@ implicitly use or set are listed below. bounding box. The \texttt{italicslant} integer provides the italic slant of the font. \item[Set by] Explicit commands in \textsf{fontinst} command - files. Defaults to $\max\{0, \mathit{right}-\mathit{width}\}$. + files. Defaults to + $$ + \max\{0, \mathit{right}-\mathit{width}\}. + $$ \item[Used by] The AFM-to-MTX converter. \end{smalldes} \item[stretchword] (integer denoting length) @@ -2223,6 +2248,7 @@ a user-defined macro; see \texttt{ltcmds.mtx} for examples. \DocInclude{fibasics} \DocInclude{ficommon} \DocInclude{fimain} +\DocInclude{fitrig} \DocInclude{ficonv} \DocInclude{filtfam} \DocInclude{fimapgen} diff --git a/Master/texmf-dist/source/fontinst/base/fitrig.dtx b/Master/texmf-dist/source/fontinst/base/fitrig.dtx new file mode 100644 index 00000000000..9d369b37720 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/fitrig.dtx @@ -0,0 +1,326 @@ +% \CheckSum{209} +% \iffalse meta-comment +% +% trig.dtx Copyright (C) 1993 1994 1995 1996 1997 1999 David Carlisle +% Inlined as fitrig.dtc 2005 Lars Hellstr"om +% +% This file is part of the fontinst system version 1.9. +% ----------------------------------------------------- +% +% It may be distributed under the terms of the LaTeX Project Public +% License, as described in lppl.txt in the base LaTeX distribution. +% Either version 1.1 or, at your option, any later version. +% +%%% From file: fitrig.dtx +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{fisource} +\title{The \textsf{trig} package inlined into \package{fontinst}} +\author{David Carlisle\\Edited by Lars Hellstr\"om} +\begin{document} +\maketitle +\DocInput{fitrig.dtx} +\end{document} +%</driver> +% \fi +% +% +% The predecessor of this file is v\,1.09 of \texttt{trig.dtx}, the +% source for the \package{trig} package in the standard \LaTeX\ +% ``graphics'' bundle. It has been inlined into the \package{fontinst} +% source mainly because archive maintainers never seem to tire of +% questioning the need to provide \texttt{trig.sty} with +% \package{fontinst}. +% +% \changes{1.930}{2005/02/06}{Inlined the \package{trig} package into +% \texttt{fontinst.sty} and friends. (LH)} +% +% +% \section{Trigonometrical functions} +% +% These macros implement the trigonometric functions, sin, cos and tan. +% In each case two commands are defined. For instance the command +% |\CalculateSin{33}| may be isued at some point, and then anywhere +% later in the document, the command |\UseSin{33}| will return the +% decimal expansion of $\sin(33^\circ)$. +% +% The arguments to these macros do not have to be whole numbers, +% although in the case of whole numbers, \LaTeX\ or plain \TeX\ counters +% may be used. In \TeX{}Book syntax, arguments must be of type: +% \meta{optional signs}\meta{factor} +% +% Some other examples are:\\ +% |\CalculateSin{22.5}|, |\UseTan{\int{myvar}}|, +% |\UseCos{\count@}|. +% +% Note that unlike the psfig macros, these save all previously +% computed values. This could easily be changed, but I thought that in +% many applications one would want many instances of the +% same value. (eg rotating all the headings of a table by the +% \emph{same} amount). +% +% I don't really like this need to pre-calculate the values, I +% originally implemented |\UseSin| so that it automatically calculated +% the value if it was not pre-stored. This worked fine in testing, until +% I remembered why one needs these values. You want to be able to say +% |\dimen2=\UseSin{30}\dimen0|. Which means that |\UseSin| must +% \emph{expand} to a \meta{factor}. +% +% \StopEventually{} +% +% +% \subsection{The Macros} +% +% \begin{macrocode} +%<*pkg> +% \end{macrocode} +% +% \begin{macro}{\nin@ty}\begin{macro}{\@clxxx} +% \changes{1.930}{2005/02/06}{Renamed this constant. There should be +% three \texttt{x}s in \cs{romannumeral} 180, but \package{trig} +% only had two. (LH)} +% \begin{macro}{\@lxxi}\begin{macro}{\@mmmmlxviii} +% Some useful constants for converting between degrees and radians. +% $$ +% \frac{\pi}{180}\simeq\frac{355}{113\times180}=\frac{71}{4068} +% $$ +% \begin{macrocode} +\chardef\nin@ty=90 +\chardef\@clxxx=180 +\chardef\@lxxi=71 +\mathchardef\@mmmmlxviii=4068 +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% The approximation to $\sin$. I experimented with various +% approximations based on Tchebicheff polynomials, and also some +% approximations from a SIAM handbook `Computer Approximations' However +% the standard Taylor series seems sufficiently accurate, and used by +% far the fewest \TeX\ tokens, as the coefficients are all rational. +% \begin{eqnarray*} +% \sin(x)& \simeq& +% x - (1/3!)x^3 + (1/5!)x^5 - (1/7!)x^7 + (1/9!)x^9\\ +% &\simeq& +% \frac{((((7!/9!x^2-7!/7!)x^2+7!/5!)x^2 +7!/3!)x^2+7!/1!)x}{7!}\\ +% &=& \frac{ ((((1/72x^2-1)x^2+42)x^2 +840)x^2+5040)x }{5040} +% \end{eqnarray*} +% The nested form used above reduces the number of operations required. +% In order to further reduce the number of operations, and more +% importantly reduce the number of tokens used, we can precompute the +% coefficients. Note that we cannot use $9!$ as the denominator as +% this would cause overflow of \TeX's arithmetic. +% +% \begin{macro}{\@coeffz} +% \begin{macro}{\@coeffa} +% \begin{macro}{\@coeffb} +% \begin{macro}{\@coeffc} +% \begin{macro}{\@coeffd} +% Save the coefficients as |\|(|math|)|char|s. +% \begin{macrocode} +\chardef\@coeffz=72 +%\chardef\@coefa=1 +\chardef\@coefb=42 +\mathchardef\@coefc=840 +\mathchardef\@coefd=5040 +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\TG@rem@pt} +% The standard trick of getting a real number out of a \meta{dimen}. +% This gives a maximum accuracy of approx.\ 5 decimal places, which +% should be sufficient. It puts a space after the number, perhaps it +% shouldn't. +% \changes{1.930}{2005/02/06}{Using \cs{lose_measure}. (LH)} +% \begin{macrocode} +\def\TG@rem@pt#1{\expandafter\lose_measure\the#1\space} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TG@term} +% Compute one term of the above nested series. Multiply the previous +% sum by $x^2$ (stored in |\@tempb|, then add the next coefficient, +% |#1|. +% \begin{macrocode} +\def\TG@term#1{ + \dimen@\@tempb\dimen@ + \advance\dimen@ #1\p@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TG@series} +% Compute the above series. The value in degrees will be in +% |\dimen@| before this is called. +% \begin{macrocode} +\def\TG@series{ + \dimen@\@lxxi\dimen@ + \divide \dimen@ \@mmmmlxviii +% \end{macrocode} +% |\dimen@| now contains the angle in radians, as a \meta{dimen}. +% We need to remove the units, so store the same value as a +% \meta{factor} in |\@tempa|. +% \begin{macrocode} + \edef\@tempa{\TG@rem@pt\dimen@} +% \end{macrocode} +% Now put $x^2$ in |\dimen@| and |\@tempb|. +% \begin{macrocode} + \dimen@\@tempa\dimen@ + \edef\@tempb{\TG@rem@pt\dimen@} +% \end{macrocode} +% The first coefficient is $1/72$. +% \begin{macrocode} + \divide\dimen@\@coeffz + \advance\dimen@\m@ne\p@ + \TG@term\@coefb + \TG@term{-\@coefc}% + \TG@term\@coefd +% \end{macrocode} +% Now the cubic in $x^2$ is completed, so we need to multiply by +% $x$ and divide by $7!$. +% \begin{macrocode} + \dimen@\@tempa\dimen@ + \divide\dimen@ \@coefd +} +% \end{macrocode} +% \end{macro} +% +% \changes{1.930}{2005/02/06}{Use \cs{x_cs} and \cs{if_undefined} where +% appropriate. (LH)} +% +% \begin{macro}{\CalculateSin} +% If this angle has already been computed, do nothing, else store +% the angle, and call |\TG@@sin|. Computed sines are stored in +% control sequences with names of the form +% \describecsfamily{sin(\meta{number})}|\sin(|\meta{number}|)|. +% \begin{macrocode} +\def\CalculateSin#1{{% + \if_undefined{sin(\number#1)}\then + \dimen@=#1\p@ + \TG@@sin + \x_cs\xdef{sin(\number#1)}{\TG@rem@pt\dimen@} + \fi +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\CalculateCos} +% As above, but use the relation $\cos(x) = \sin(90-x)$. Computed +% cosines are stored in control sequences with names of the form +% \describecsfamily{cos(\meta{number})}|\cos(|\meta{number}|)|. +% \begin{macrocode} +\def\CalculateCos#1{{% + \if_undefined{cos(\number#1)}\then + \dimen@=\nin@ty\p@ + \advance \dimen@ -#1\p@ + \TG@@sin + \x_cs\xdef{cos(\number#1)}{\TG@rem@pt\dimen@} + \fi +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TG@@sin} +% Repeatedly use one of the the relatations +% $\sin(x)=\sin(180-x)=\sin(-180-x)$ to get $x$ in the range +% $-90 \leq x\leq 90$. Then call |\TG@series|. +% \begin{macrocode} +\def\TG@@sin{% + \ifdim\TG@reduce>+% + \else\ifdim\TG@reduce<-% + \else\TG@series\fi\fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TG@reduce} +% Slightly cryptic, but it seems to work\ldots\space +% The first line is the condition for an |\ifdim|, the remaining +% lines constitutes the `then' branch of that conditional. +% \begin{macrocode} +\def\TG@reduce#1#2{ + \dimen@#1#2\nin@ty\p@ + \advance\dimen@#2-\@clxxx\p@ + \dimen@-\dimen@ + \TG@@sin +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\UseSin} +% \begin{macro}{\UseCos} +% Use a pre-computed value. +% \begin{macrocode} +\def\UseSin#1{\csname sin(\number#1)\endcsname} +\def\UseCos#1{\csname cos(\number#1)\endcsname} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% A few shortcuts to save space. +% \begin{macrocode} +\chardef\z@num\z@ +\x_cs\let{sin(0)} \z@num +\x_cs\let{cos(0)} \@ne +\x_cs\let{sin(90)} \@ne +\x_cs\let{cos(90)} \z@num +\x_cs\let{sin(-90)}\m@ne +\x_cs\let{cos(-90)}\z@num +\x_cs\let{sin(180)}\z@num +\x_cs\let{cos(180)}\m@ne +% \end{macrocode} +% +% \begin{macro}{\CalculateTan} +% Originally I coded the Taylor series for tan, but it seems to +% be more accurate to just take the ratio of the sine and cosine. +% This is accurate to 4 decimal places for angles up to +% $50^\circ$, after that the accuracy tails off, giving +% $57.47894$ instead of $57.2900$ for $89^\circ$. +% +% Computed tangents are stored in control sequences with names of the +% form \describecsfamily{tan(\meta{number})}|\tan(|\meta{number}|)|. +% \begin{macrocode} +\def\CalculateTan#1{{% + \if_undefined{tan(\number#1)}\then + \CalculateSin{#1}% + \CalculateCos{#1}% + \a_dimen\UseCos{#1}\p@ + \divide \a_dimen \@iv + \b_dimen\UseSin{#1}\p@ + \b_dimen\two@fourteen\b_dimen + \divide\b_dimen\a_dimen + \x_cs\xdef{tan(\number#1)}{\TG@rem@pt\b_dimen} + \fi +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\UseTan} +% Just like |\UseSin|. +% \begin{macrocode} +\def\UseTan#1{\csname tan(\number#1)\endcsname} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\two@fourteen} +% \begin{macro}{\@iv} +% Two constants needed to keep the division within \TeX's range. +% \begin{macrocode} +\mathchardef\two@fourteen=16384 +\chardef\@iv=4 +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% Predefine $\tan(\pm90)$ to be an error. +% \begin{macrocode} +\x_cs\def{tan(90)}{\errmessage{Infinite tan !}} +\expandafter\let + \csname tan(-90)\expandafter\endcsname \csname tan(90)\endcsname +%</pkg> +% \end{macrocode} +% +% \Finale +% +\endinput + diff --git a/Master/texmf-dist/source/fontinst/base/fontinst.ins b/Master/texmf-dist/source/fontinst/base/fontinst.ins index 7916a253328..fbde286b9d6 100644 --- a/Master/texmf-dist/source/fontinst/base/fontinst.ins +++ b/Master/texmf-dist/source/fontinst/base/fontinst.ins @@ -69,6 +69,7 @@ generated. \from{fibasics.dtx}{pkg}% \from{ficommon.dtx}{pkg}% \from{fimain.dtx}{pkg}% + \from{fitrig.dtx}{pkg}% \from{ficonv.dtx}{pkg}% \from{filtfam.dtx}{pkg,textcomp,debug}% \from{fimapgen.dtx}{pkg}% @@ -78,6 +79,7 @@ generated. \from{fibasics.dtx}{pkg}% \from{ficommon.dtx}{pkg}% \from{fimain.dtx}{pkg,boundaryCompability}% + \from{fitrig.dtx}{pkg}% \from{ficonv.dtx}{pkg}% \from{filtfam.dtx}{pkg,textcomp,debug}% \from{fimapgen.dtx}{pkg}% @@ -87,6 +89,7 @@ generated. \from{fibasics.dtx}{pkg}% \from{ficommon.dtx}{pkg}% \from{fimain.dtx}{pkg}% + \from{fitrig.dtx}{pkg}% \from{ficonv.dtx}{pkg}% \from{filtfam.dtx}{pkg,textcomp,debug,oldstyle}% \from{fimapgen.dtx}{pkg}% @@ -111,21 +114,22 @@ generated. \from{fibasics.dtx}{doc}% \from{ficommon.dtx}{doc}% \from{fimain.dtx}{doc}% + \from{fimapgen.dtx}{doc}% }% } -\OriginalAsk\answer{Do you wish to install trig.sty with fontinst? [y/n] } -\ifx \answer\y \let\answer\yes \fi -\ifx \answer\yes - -\usedir{tex/fontinst/base} -% From graphics.ins: -\preamble -\endpreamble - -\generate{\file{trig.sty}{\from{trig.dtx}{package}}} - -\fi +% \OriginalAsk\answer{Do you wish to install trig.sty with fontinst? [y/n] } +% \ifx \answer\y \let\answer\yes \fi +% \ifx \answer\yes +% +% \usedir{tex/fontinst/base} +% % From graphics.ins: +% \preamble +% \endpreamble +% +% \generate{\file{trig.sty}{\from{trig.dtx}{package}}} +% +% \fi \endbatchfile \endinput |