diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-11 23:03:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-11 23:03:17 +0000 |
commit | ecf966f305f6aeff2bbdf42c82d8425921aa9eda (patch) | |
tree | db606a57e3619610e4c35cae849d41cf4e0937d5 /Master/texmf-dist/source/fontinst | |
parent | ac3c55a3216b5988f0e48ba9414ddb059f19a699 (diff) |
source 1
git-svn-id: svn://tug.org/texlive/trunk@105 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/fontinst')
20 files changed, 29833 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/fontinst/base/CHANGES b/Master/texmf-dist/source/fontinst/base/CHANGES new file mode 100644 index 00000000000..481d5f3a34d --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/CHANGES @@ -0,0 +1,644 @@ +--- CHANGES --- + +This is the changes log for the fontinst font installation package. + +Feb 4 1993, v0.01: Created the file, wrote an afm and enc parser, + started on a vpl writer. + +Feb 10 1993, v0.02: Rewrote the enc parser, generally hacked around, + imported trig.tex to convert Adobe's italic slope (expressed in + angles!) into a font dimension (expressed as a ratio!) grrrrrr... + +Feb 12 1993, v0.03: Tidied up the comments a bit, moved the + \fontlist out of \readafm, added \writepl (as well as \writevpl). + Replaced \fake{CHARACTER} by having the .fd file give default + definitions for \char-CHARACTER. Added the \map and + \ligtable entries to \char-CHARACTER. Redefined \ligtable, + \map and \codingscheme as token lists. Moved the \kernpair's + into \ligtable. + +Feb 16 1993, v0.04: Added FontName, FullName, UnderlineThickness and + Notice. Added the source font encodings, and MAPFONT. + Discovered a seriousish bug---if a character exists in the afm + file but is not in the source encoding, then the fake character + is still overwritten, since we don't know what the source + encoding is going to be until later. Fixed this by reading in + the source encoding first, and looking to see if there is a + character in the source encoding for the one in the afm file. + Added \topaccent. + +17 Feb 1993, v0.05: Added the visual centre parameter to \topaccent, + and added \botaccent and \doublechar. Fixed a bug where the + default \missingchar had a horizontal rather than a vertical + rule. Added \settoken. + +19 Feb 1993, v0.06: Fixed a bug whereby a character which was in the + source encoding but not in the afm file overwrote it's faked + version. Changed the default \missingchar to be independent of + the values parsed from the afm file (so it doesn't matter when + you set a \missingchar). Added \parameter and \ligatures. Added + \kernalikes and \copykern, which meant I had to split \ligtable + back into \ligtable and \kerntable, since when you say \copykern + you only want the \kerntable copied, not the \ligtable. + Redefined \map so that it's more portable---the contents of \map + are allowed to assume they start in font \startfont, should move + and should finish having moved right by \charwd and in font + \stopfont. This makes it possible to have composite characters + within composite characters---for example to make <ffi> out of + <f><fi> and <fi> is in turn made out of <f><i>. + +23 Feb 1993, v0.07: Introduced the \character token list (previously + all of the variables had been set by \char-FOO). \botaccent, + \topaccent, etc are now commands to be used inside \defchar, so + you can say something like \defchar{FOO}{\ifblah ... \botaccent + ... \else ... \topaccent ... \fi}. Added \cramchar. Added + the shift-left argument to \doublechar. + +24 Feb 1993, v0.08: Replaced \charic by \leftbearing and + \rightbearing. Made the assingments in a \char-FOO command + global, so we can protect local variables. Fixed a bug with + \getchar{FOO} which used to end up calling \the\character. + However, \the\character may contain other \getchar{BAZ} calls, + which will override the values of \kernalike, \source, \target, + etc. So \getchar can't call \the\character. Added \shrinkfont. + Made all the AFM variables counts rather than dimens. Added + \afmunits, and did all the conversion between AFM units and TeX + units as late as possible (which means we can alter \afmunits + locally and perform scaling). Added \getfont so fonts are now + loaded dynamically, and can be scaled. Added \shrinkchar for + producing c&sc fonts. + +3 Mar 1993, v0.09: Added \fractionchar, \inferiorchar and + \superiorchar. No character is produced for characters called + .notdef in the target encoding. Produced a first bash at a + complement encoding to Cork, containing the Adobe standard and + Expert characters missing from Cork. + +9 Mar 1993, v0.10: A major spring clean. Introduced ATX and ETX + files, so the parser for AFM files now reads an AFM file and writes + out the same information in a TeX-friendly fashion as an ATX file. + Similarly, an ETX file contains the same information as an ENC file. + Introduced \inputatx, \inputetx and \inputenc to input an ATX, ETX + or ENC file if it already exists and to make it otherwise. + +14 Mar 1993, v0.11: A continuation of the spring clean. Redefined + \getchars to define everything locally. Redefined \writechars to + read the encoding from a .etx file. Discovered I'd used the command + \afmchar twice(!) so I redefined one of them to be \rawchar. + Rewrote the LIGTABLE section. + +15 Mar 1993, v0.12: Finished the spring clean of the file generation. + Redid \writevpl and \writepl. Read the FUD file in after the ATX + files, so the FUD file can use the parameters read in by the ATX + file. Fixed a bug with \afmchar that wrote incorrect values + to \charactersize in the ATX file. Rewrote \fontdimens to write the + PARAMETERs out immediately (since we are now writing the VPL file + when reading the FUD file). Finished the LIGTABLE section, redid + \copykern. + +22 Mar 1993, v0.13: Rewrote the generation of ATX files, so kern table + information is gathered together as in a LIGTABLE. Renamed + \defchars to \readafm. Renamed \writevpl to \makevpl ... \endvpl, + and rewrote it to cope with the new syntax of ATX files. + +24 Mar 1993, v0.14: Added \lkern and \rkern entries to ATX files, + replacing \copykern. Added kern copying to LIGTABLEs. + +29 Mar 1993, v0.15: Added \boundarychar, \nextlarger and \varchar. + Fixed a bug with \lrkern. + +30 Mar 1993, v0.16: Fixed a bug whereby FONTDIMENS was being output + rather than FONTDIMEN. Also \writepl was generating a VPL file. + And I discovered a bug with dvips that means that fonts generated + with designsize and designunits R 9.9945 cause a rounding error + and dvips complains about a design size mismatch. Grr... Fixed + a bug with outputting ligatures for characters without + kernings---previously I output a LABEL without checking that + there were actually going to be any LIG instructions (which there + might not be if, for example, it was a monoweight font). + +4 Apr 1993, v0.17: Added the interactive prompt. Generated the .fd + file. \makevpl and \makepl don't overwrite files any + longer---they give a message saying `FILENAME.(v)pl already + exists.' + +17 Apr 1993, v0.18: Added \makefamily, \maketexfont and \makerawfont. + +27 Apr 1993, v0.19: Fixed a bug with \finishligs, which caused + multiple LABEL instructions to be put down (I had a \labelfalse + where I should have had a \labeltrue). + +4 Aug 1993, v1.00: Ripped it up and started again... v1.00 is going + to be a fairly complete rewrite from the ground up. I can keep: + + * the AFM parser + * the ENC parser + * much of the VPL and PL writer + + but the fud engine is going to be replaced by the notion of a + glyphbase. The idea will be that all of the information kept in + the ATX and FUD files will be put into one file called a + `glyphbase'. Then we'll have two utilities: + + * \makerawfont{ENCODING}{AFMFILE}{FONTNAME} + will convert an AFM file into a glyphbase and a property list. + + * \maketexfont{ENCODING}{GLYPHBASES}{FONTNAME} + will convert a collection of glyphbases into a virtual font. + + For example: + + \makerawfont{adobe}{Times-Roman}{ptmr0} + \maketexfont{T1ulc}{ptmr0,cork}{ptmrq} + + makes the raw font ptmr0.pl, the glyphbase ptmr0.gly, and then + converts the glyphbases ptmr0 and cork into the font ptmrq. This + notion of glyphbase will also allow users to modify fonts easily, + for example you could write a little ptmhax glyphbase, which + would override the default cork glyphbase by saying: + + \maketexfont{T1ulc}{ptmr0,ptmhax,cork}{ptmrq} + + This will make it much easier to tweak fonts. I'll also specify + the glyphbase syntax, and do my best to make everything upwardly + compatible. + + On the 4th of August I started on the above. I wrote + \makeglyphbase, which converts an AFM file into a glyphbase, and + I wrote the glyphbase commands to store the glyphbase information + in TeX. The main thing that's missing is the PL and VPL writers, + and the ligature, nextlarger and varchar entries. + +10 Aug 1993, v1.01: Edited trig.tex to remove uses of \then. Separated + \maketexfont into \inputglyphbase and \makevirtualfont. Added the + ability to write CHARACTER instructions, (OK, but not the MAPFONTs + yet). + +11 Aug 1993, v1.02: Only output CHARDP, CHARHT and CHARIC when they + are positive. Added the MAPFONT and \mapfont instructions. + +12 Aug 1993, v1.03: Corrected a bug where I was calling \inputetx + *after* an \openout\outfile, which caused the \outfile to be closed, + if the etx file had to be generated. + +22 Aug 1993, v1.04: Added the concept of variable and number expression. + Included trig.tex as part of this file. Changed design size to an + integer. Renamed `glyphbase' to `metric file', and changed the + syntax of ETX files. Only write out SELECTFONT instructions when + necessary. + +23 Aug 1993, v1.05: Added the font dimensions. + +24 Aug 1993, v1.06: Made the slot of each glyph an int variable like + any other. Added dim variables. Made designsize a dim variable, + which should cure a bug that was causing design sizes not to match + up. Added the LIGTABLE. Fixed a bug with \inputetx and \inputmtx + which caused the redefinition of \relax to survive past the + \inputFOO command. Fixed a bug with \vplrule, since I'd got the + arguments to SETRULE the wrong way round (again!). + +25 Aug 1993, v1.07: Added the VARCHAR and NEXTLARGER entries. Added + the encoding documentation commands. Renamed the file to + fontinst.sty. + +26 Aug 1993, v1.08: Added the documentation of MTX files. + +27 Aug 1993, v1.09: Corrected a bug with \comment. Added \tfmtomtx. + Removed the SCALE argument to \setrawglyph. Added \convertafm to + convert integer AFM units to a dimen, trying to minimize rounding + errors whilst avoiding rounding errors. Renamed \leftkerning and + \rightkerning to \setleftkerning and \setrightkerning. + +30 Aug 1993, v1.10: Added \resetwidth, \resetheight, \resetdepth and + \resetitalic. Added the ability to use \width{GLYPH} etc. inside + \setglyph{GLYPH}. Added everyglyph and everyendglyph. + +10 Sep 1993, v1.11: Discovered a bug with the VPL glyphs which was + causing it never to write out a SELECTFONT instruction. + +13 Sep 1993, v1.12: Added the \familyinst...\endfamilyinst commands. + Added commands to zero the fonts between calls of \makefont, so + one document can make a large number of fonts. + +14 Sep 1993, v1.13: FIRST ALPHA-RELEASE OF V1. + Changed the syntax of \useafm and \useetx to use + the same parameters as LaTeX NFSS. Removed the prefix f0 from + the beginning of the font names, in a pathetic attempt to fit + MS-DOS 8+3 filenames. Added the \tempfile command. + +4 Oct 1993, v1.14: Removed a spurious \let in \docnextslot. Thanks + to Damian Cugley for spotting that one. Added \usetfm to \familyinst. + +5 Oct 1993, v1.15: Fixed a bug with \dotfm, which was causing it to + generate a PL file, even though the font was already in TFM + format! Thanks again to Damian. Also changed + \let\Input=\@@input to a catcode hack, just in case fontinst.sty + is read in by LaTeX when @ isn't a letter. That one was spotted + by Paul Thompson. + +6 Oct 1993, v1.16: Replaced Phil Taylor's trig macros with David + Carlisle's. Added the PL parser. Fixed a bug with the bug fix + for \dotfm, where I'd removed an \inputmtx command that was + needed... And I fixed a bug which was causing the VPL files to + be generated once for each font that contributed to the VPL file. + Damian got those ones as well. + +11 Oct 1993, v1.17: Added the SIZE argument to \useafm and \usepl, + and redid the FD generation to use the size info. This should + allow fonts like Malvern to be generated at different design + sizes and still have a sensible FD file. NOTE: This means old + fontinst files will no longer work! I also made \pltomtx create + a \setdim{designsize} command. + +13 Oct 1993, v1.18: Fixed a bug with \calculateitslant which caused + it to bomb if the italic angle didn't have a decimal... this was + caused by allowing extraneous spaces at the end of the angle. + These have now been stripped away. Thanks to Paul Thompson for + spotting that one! + +15 Oct 1993, v1.19: Discovered a bug with \familyinst, which caused + only one ETX file to be loaded. This one was introduced when I + added the SIZE arguments, since I reorganized the main + \endfamilyinst loop. Serves me right! This is now fixed, but + I'm left with the problem that the sensible order to generate VPL + files is not the sensible order to generate FD lines in. FD + files need the SIZE parameter inside the SERIES and SHAPE, + whereas if a font is contributing to a number of SERIES and + SHAPEs but only one SIZE, then it's sensible to have it outside + the SERIES and SHAPE parameters. Oh dear... + +19 Oct 1993, v1.20: Added the glyph `missingglyph' which is produced + whenever a glyph is missing. + +3 Nov 1993, v1.21: Corrected a bug with \kerning, which was causing + \kerning{A}{V} to give the kerning between V and A! And I added + the PL names for the math font parameters NUM1--AXISHEIGHT. + Damian spotted those ones. Rewrote the main loop as I said I + would have to in the note on v1.19, so there's no useless + regeneration of fonts now. + +17 Nov 1993, v1.22: Restored the final parameter to + \DeclareFontShape which had disappeared somehow! Rob Hutchings + spotted this one. And I stopped trying to be clever about + checking to see if a glyph has been defined before using it. + This means you get a horrible error message if you try to use an + undeclared glyph, but hey ho. Trying to trap this has caused so + many problems with other things breaking that I think I'll give + up :-) Added the \glyphwarning command, and removed the + `missingglyph' glyph. Docstripped David's trig.doc into + trig.sty, so I don't have to worry about trig.doc generating the + trig.sty file. Saved the catcodes of ` ', `@', `~' `_' and NL so I + so I can use @ and _ for internal macro names, space and NL + for ignored white space, and ~ for `real' white space. Renamed + all the internal commands (apart from the documentation ones) to + have _ in their names. + +29 Nov 1993, v1.23: Added a check that a glyph exists before writing + it to a (V)PL file... this was causing fontinst to crash if there + was a glyph missing from an AFM file. Yannis Haralambous and Paul + Thompson spotted this one. + +23 Dec 1993, v1.24: Removed the \familyinst...\endfamilyinst interface, + and replaced it by \installfonts ... \endinstallfonts, which makes + it easier to generate FD files that look like standard LaTeX2e FD + files. Removed (I'm not sure if this is a great idea) the ability + to specify an encoding for an AFM file, since I'm not sure every + dvi-to-ps converter can re-encode raw fonts. I added the + \declarefamily command to specify which encoding string corresponds + to which ETX file. + +24 Dec 1993, v1.25: Redid the \declare... commands, and replaced + everyglyh and everyendglyph by sidebearings. + +25 Dec 1993, v1.26: Drank a lot. + +26 Dec 1993, v1.27: Added \setcommand, \resetcommand and \ifiscommand. + +27 Dec 1993, v1.28: Bug-fixes in \setcommand and \resetcommand. Redid + \pltomtx so that it can read the encoding from the CODINGSCHEME line + in the file. Moved the documentation and tables into fontdoc and + fonttab.tex. + +28 Dec 1993, v1.29: Removed the fd-commands argument from \makefont, + since the FD syntax is to allow FD-commands dependent on + encoding/family/series/shape but not on size. This means we can't + generate font-specific FD-commands, but I've never seen those used, + so I'm not too worried... Fixed a bug with the CC commands, which + was producing a glyph with a different width than its horizontal + escapement, and I'm not sure what every DVI driver would do with + that. Replaced \etxtopl with \mtxtopl. Replaced the GLYPH COMMAND + \rawglyph with the MTX COMMAND \setrawglyph. + +29 Dec 1993, v1.30: Fixed a bug with \setrawglyph, which wasn't + checking to see if the glyph was already defined. Added + \unsetglyph. Corrected the spelling of `\immedaite' (sic) in + \vpl_nextlarger. + +3 Jan 1994, v1.301: The glyph warning message is now only produced when + the glyph is used, rather than when it is defined. And I've moved + over to three-digit version numbers, since I was going through the + two-digit ones quite rapidly. Added \bye, so fontinst documents can + run under LaTeX as well as plain TeX. Added \unsetint, \unsetstr, + \unsetdim and \unsetcommand. Renamed \makefont and \makefamily to + \installfont and \installfamily. + +4 Jan 1994, v1.302: Fixed a bug with the definition of \bye. + +6 Jan 1994, v1.303: Added the FONTNAME argument to \installfont. + Actually got rid of everyglyph. + +8 Jan 1994, v1.304: Added minimumkern and \resetglyph. Fixed a bug + with \vpl_kerning, which was swapping the left- and right-kerns. + Surprising I never spotted this before... + +9 Jan 1994, v1.305: Worked on the MTX and ETX files. + +10 Jan 1994, v1.306: Worked on the MTX and ETX files. + +12 Jan 1994, v1.307: Edited the documentation. + +20 Jan 1994, v1.308: Added the rawscale integer variable, and the + \setnotglyph command. Redid the way that CC instructions are + processed, to use the dimensions stored in the glyph-not variables. + Set all of the saved VPL commands to \relax so that they can be + \edef'ed on without having to protect them. Replaced some \def\foo{} + by \let\foo\empty_command's. Replaced a large definition that was + being made by \CHARACTER (when parsing PL files) by a \let. Redid + the datatype used to store kerning so it uses control sequences as a + compact representation of glyph names. All in all, fontinst now runs + in 79% of the time and 77% of the space that it did last week. + +21 Jan 1994, v1.309: Saved some more time and space on the kern table. + +22 Jan 1994, v1.310: Added the `FONT scaled AMOUNT', made \setkern take + account of \int{rawscale}. Moved the change log into a separate + CHANGES file. Redid \samesize and \resetwidth so that the width is + adjusted by a MOVERIGHT, so the glyph will have the correct horizontal + escapement. Corrected a typo which had renamed \resetint to \setint + (oops!). Corrected a typo of `itslant' rather than `italicslant'. + Added the \transformfont command and \mtxtomtx. Changed the + definition of \unfakable{foo} in latin.mtx to look to see if there's a + glyph <foo-not> to get the dimensions for. Added a fake <space> and a + fake <dotlessj> which is a missing glyph rule with the dimensions + combined from <j> and <dotlessi>. Changed the default interword + stretch to be 1/3 of interword space, rather than zero. Removed the + checks for the existence of <space> and <x> in OT1.etx and T1.etx, + since these are now faked in latin.mtx. Renamed the PS/CM math fonts, + after a discussion with Karl Berry, added the OMS and OMX math fonts. + Added the Greek letters, digits and other humanists to unsetalf.mtx. + Added the DEFAULTRULETHICKNESS and BIGOPSPACING commands to the PL + parser. Fixed a bug I'd introduced by giving \vartop, \varmid, + \varrep and \varbot no parameters. Oops. Created timesmat.sty and + testmath.tex. All in all, a reasonable day's work... + +23 Jan 1994, v1.311: Added some more tests to testmath.tex. Added the + new math sizes to timesmat.sty. Fixed a bug with fontstnd.tex which + was causing it to generate the wrong FD entry for italic fonts. Fixed + a bug with CHARACTER parsing in \pltomtx which wasn't resetting the + values of WIDTH, HEIGHT, DEPTH and CHARIC between glyphs. + +24 Jan 1994, v1.312: Added the SEVENBITSSAFE command to the PL parser. + +25 Jan 1994, v1.313: Restored the catcode of ~, which I'd left as 10. + Made /, < and > in zptmcmrm come from cmmi rather than ptmri. Added + zptmcmr to fontptcm.tex, which is Adobe Times with +, =, (, ), [ and ] + taken from CMR. This means that [...] and (...) in text is different + from in math, but means that the delimiters are the right size for + math setting with CM symbols, and match the growing delimiters in cmex. + Moved the files ptmcmhax.mtx and psycmhax.mtx to zrmhax.mtx and + zrvhax.mtx. + +27 Jan 1994, v1.314: Took the textstyle and displaystyle big operators + in zpsycmrv from cmex8 rather than cmex10, since they are more + suitably sized for the <summation> and <product> from Adobe Symbol. + Made all the accents in latin.mtx zero depth (which TeX's math accent + placement requires). Discovered that cmex8 doesn't have a + CODINGSCHEME, so I added one by hand to the PL file. + +30 Jan 1994, v1.315: Replaced cmex8 in zpsycmrv by cmex9. Added + <epsilon1>, <pi1> and <rho1> to unsethum.mtx. Added the \skewchar + declaration for zptmcmrm. Fixed a bug which was causing negative + mathchardefs. Finished off the skewchar kerns for zptcmrm. + Renamed timesmat.sty to mathptm.sty, since there's already a + timesmat.sty. + +7 Feb 1994, v1.316: Fixed the \ProvidesPackage line in mathptm.sty. + +8 Feb 1994, v1.317: Fixed a bug with fontptcm.tex where I'd put the + \skewchar command in the wrong argument! Made the `size' argument + to \installfont an FD size specification. Added fakes for <lslash> + and <Lslash> built from <lslashslash> to latin.mtx. Added a check + that a ligature glyph exists before writing out the LIGTABLE entry. + Edited the documentation a bit---thanks to Karl Berry for comments. + Added the fontcmro example, inspired by Norman Walsh. Fixed a bug + with .fd file generation which caused multiple \DeclareFontShape + entries to be produced. Added \unfakable{endash} and + \unfakable{emdash} to latin.mtx. Sebastian spotted that one. + +10 Feb 1994, v1.318: Added \unfakable{dotlessi} to latin.mtx. Karl + Berry pointed that one out. + +1 Mar 1994, v1.319: Added the HEADER. Karl Berry pointed that one out + too. + +6 Apr 1994, v1.320: Write out a LABEL BOUNDARYCHAR ligable entry where + necessary. Alan Hoenig pointed that one out. Rewrote mathptm.sty + to remove some of the nastier hacks. + +7 Apr 1994, v1.321: Added the ability to generate font substitutions + in the FD files. + +8 Apr 1994, v1.322: Fixed a bug with font substitution which was + causing the font substitutions to be written out before the real + fonts. Moved the mathptm package to standing on its own. + +17 Apr 1994, v1.323: Added the top-level \latinfamily commands, and + updated the example files and documentation to use them. Added + OT1ci.etx. Made the list of files in an \installfont command + expanded before running along the list, so you can have a macro + which expands out to a list of files now. Added substitutions for + semibold and demibold, for upright italic, and for sc to nc. Added + OT19.etx, OT1c9.etx, OT1ci9.etx, OT1i9.etx, T19.etx and T1c9.etx. + Removed OT1o.etx. + +19 Apr 1994, v1.324: Removed italic and oblique small caps. Fixed a + bug which was causing the latin.mtx file to be read in inside a + group if a latin family without an expert font was created. + +25 Apr 1994, v1.325: Removed a bug which caused sc fonts to have the + same names as u&lc fonts. Fixed a bug which was causing oblique + fonts not to be generated properly. Fixed a bug with FD + generation which was producing too few arguments for + DeclareFontShape for substitutions. + +27 May 1994, v1.326: Made fontinst.tex a 2e document. Fixed a bug + with generating slant which was generating slant in design size per + point rather than points per point. Sigh. Ciar\'an \'O Duibh\'in + spotted that one. Declared this to be the first full release. + +1 Jun 1994, v1.327: Fixed bug with filename parsing which was losing + variants. Rewrote the encoding files to use the OT1 tt encoding + whenever monoweight is set. Removed the f-liagatures from the T1 + encoding for monowidth fonts. Sebastian spotted that one. + +2 Jun 1994, v1.328: Fixed a bug with FD generation: I'd added the + extra argument for series substitutions but not shape + substitutions. Ta Sebastian again. + +3 Jun 1994, v1.329: Made Upsilon1 unfakable. + +15 Jun 1994, v1.330: Fixed a bug with font substitution which was + ignoring chains of substitutions such as bx -> b -> db. Added the + m->l substitution. Renamed the `mn' and `bn' series to `mc' and + 'bc'. Added the `k' and `m' series. + +16 Jun 1994, v1.331: Sebastian spotted another problem with + substitutions. If a font had both a series and a shape + substitution, the series was sometimes getting lost. + Steve Grathwohl pointed out that I'd forgotten to switch off + kerning before loading the math italic fonts in fontcmro. + +27 Jun 1994, v1.332: Added braces to \needsfontinstversion, which was + clobbering \a_dimen and \b_dimen. Fixed a bug with compwordmark + which was causing it to get letterspacing added to it. Added the + GLYPH-spacing variable to cope with this. These were + spotted by Constantin Kahn. + +29 Jun 1994, v1.333: Added \ProvidesFile line to the .fd files. + +16 Aug 1994, v1.334: Added \frompl, fixed bugs with \resetdim and + <ccedilla>---all reported by Constantin Kahn. + +9 Sep 1994, v1.335: Fixed a bug with NEXTLARGER and VARCHAR generation + which was causing the entries to be printed out for nonexistent + glyphs---spotted by Alan Hoenig. Updated the example installation + files for Times, Helvetica and Courier. Updated to a more recent + trig.sty, and added the hacks to allow trig.sty to be used outside + LaTeX2e. Made fontinst.sty initex processable, so you can save + memory by building your own fontinst format without plain. Fixed + the names of `narrow' fonts, which used to clobber the non-narrow + fonts---spotted by Peter Busk Laursen. + +12 Sep 1994, v1.336: Fixed a bug with fontcmro, which was listing the + 9pt font as being 10pt in the fd file---spotted by Steve Grathwohl. + +22 Sep 1994, v1.337: Corrected spelling mistake in \declareencoding in + error message of \CODINGSCHEME---spotted by Alan Hoenig. + +8 Oct 1994, v1.338: Corrected definition of \space in + fontinst.ini---spotted by Rob Hutchings. + +18 Nov 1994, v1.339: Added 8r.etx and 8r.enc from Sebastian. + Distributed a patched fontinst.rc file containing a reimplementation + of \latinfamily that uses the 8r encoding. + +21 Nov 1994, v1.400: Added missing \fi to 8r.etx---spotted by Steve + Grahthwohl. Added \mtxtopl for expert fonts in + \latinfamily---spotted by Rob Hutchings. + +29 Nov 1994, v1.401: Added hyphen+hyphenchar = hyphenchar lig to + T1.etx (so that foo-bar words can be hyphenated as foo<hyphenchar> + bar)---spotted by Frank Mittelbach. Made default stretch and + shrink 50% and 16.7% of <space> respectively. Added \everyjob to + fontinst.ini to load the fontinst.rc file---spotted by Rob + Hutchings. + +7 Dec 1994, v1.402: Corrected typos with 8r.etx---spotted by + Constantin Kahn. + +12 May 1995, v1.403: Mentioned the pl files in fontinst.tex, and added + the encoding TEX TEXT WITHOUT F-LIGATURES. Both spotted by John + Wells. + +16 Sep 1995, v1.500: Incorporated changes by SPQR and CK in their + fontinst.rc file. In detail... Added the \NOFILES debugging + option. Used SPQR and CK's complete reimplementation of + \latinfamily. Added the TEXBASE1ENCODING. Added \etxtopl and + \installrawfont. Added the setting of \errorcontextlines. Grabbed + T1i.etx from CTAN. Added the setting of \newlinechar (pointed out + by Constantin). Fixed bug with \resetcommand which stopped braces + around the csname from working (Contantin again). Removed the + contrib/zd directory at Constantin's request. Rewrote the + documentation. Added fontinst.cls. + +[16 Sep 1995, v1.500 on CTAN with fonts/psfonts/tools] + +21 Sep 1995, v1.501: Corrected some typos in the documentation. + Added kerns for ng, Ng and hyphenchar. Fixed spacing in faked + <FFsmall> and friends. Fixed kerning of <dotlessJ>. Raised the + <macron> in <dbar> to half-way between the xheight and the height of + <d>. Added fake <ng> -> <eng>. Made \cscbotaccent and + \csctopaccent look to see if both of the glyphs exist rather than just + the first. Thanks to Hilmar Schlegel for all these points. + +29 Sep 1995, v1.502: Renamed all the distributed afm files from + *0*.afm to *8a*.afm. Updated the file header on 8r.etx. + Renamed Karl's fontinst.rc to karl-fontinst.rc, to avoid it being + picked up by every punter. + All pointed out by Sebastian. + +24 Nov 1995, v1.503: Included Alan Hoenig's vfinst in contrib/vfinst. + +23 Jan 1996, v1.504: Included some of Sebastian's changes to OT1.etx: + upped stretch and shrink to .6 and .24 of space; reduced extra + space after . to .24 of space; removed <endash> + <hyphen> = + <emdash> ligature from OT1 monowidth; made \setslot{grave} + etc. into \setslot{\lc{Grave}{grave}} etc; fixed a bug with T1c + `monoweight' -> `monowidth' (!); implemented Rob's changes to + small caps and small accented caps; included fake kerning for + Udieresis; added hackery from spqr.rc for faking small caps and + faking widths. + +[28 Jan 1996, v1.504 on CTAN with:fonts/psfonts/tools] + +24 Jan 1996, v1.505: Updated fontptcm.tex to use ptmr8a rather than ptmr0. + +25 Jan 1996, v1.506: Added extra braces to \latinfamily to stop + setting of \digits in one run from affecting it in subsequent + runs. Spotted by Richard Walker. + +23 Feb 1996, v1.507: Replaced vpltovf by vptovf. Spotted by Sebastian. + +17 Jun 1996, v1.508: Added an \ifdim check to stop lots of MOVERIGHT R 0.0 + instructions being generated. Spotted by Sebastian. + +18 Jun 1996, v1.509: Allow real numbers in .afm files. Spotted by + Gintautas Grigelionis. Made spaces before ; optional, in order to + parse v2.0 afm files (spaces before ; were made compulsory in v3.0). + +20 Jun 1996, v1.510: Added 9d and 9o encodings for fonts with + old-style digits. + +21 Jun 1996, v1.511: Removed \endinput from the end of .fd files, so + that additions can be made more easily. + +24 Jul 1996, v1.512: Updated version of trig.sty. + +7 Aug 1996, v1.513: Moved unfakable glyphs eariler in latin.mtx so + that all-caps fonts will work. + +6 Feb 1997, v1.514: Added a zero-width rule to cwm in latin.mtx (to + stop the MAP entry from being empty). Made cwm 1ex high. + +--- Copyright 1993, 1994, 1995, 1996 Alan Jeffrey --- + +11 Feb 1997, unofficial v1.6 SPQR on CTAN:fonts/psfonts/tools + Derived from v1.504 with minor hacks and fixes (not documented). + +29 May 1998, unofficial v1.7 SPQR on CTAN:fonts/psfonts/tools + Derived from v1.6 with fixes by UV. Corrected mapping of weights. + Added code for 8r-encoded AFM files (intended to cope with ttf2afm + limitations, but taken out again after ttf2afm was updated). + +22 Jun 1998, unofficial v1.8 UV + Derived from v1.7 and v1.511. Many .etx/.mtx files touched up. + fontinst.sty and fontdoc.sty now generated from fontinst.dtx. + \textcompfamily integrated into \latinfamily. Reintroduced + oldstyle encodings (from v1.511). 8y.etx/8y.mtx added as an + alternative to 8r.etx/8r.mtx. ts1.etx and textcomp.mtx revised. + +30 Jun 1998, unofficial v1.800 UV on CTAN:fonts/utilities/fontinst + Several changes to examples/mathptm and examples/mathptmx. + +07 Jun 1998, v1.801: Fixed a bug when oldstyle small-caps fonts + are generated from <font>8r + <font>8x instead of <font>c8r. diff --git a/Master/texmf-dist/source/fontinst/base/fibasics.dtx b/Master/texmf-dist/source/fontinst/base/fibasics.dtx new file mode 100644 index 00000000000..9c459a075b6 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/fibasics.dtx @@ -0,0 +1,2273 @@ +% \CheckSum{1456} +% \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. +% +% 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: fibasics.dtx +% +%<*driver> +\documentclass{ltxdoc} +\title{The \package{fontinst} utility} +\author{Alan Jeffrey\and Sebastian Rahtz\and Ulrik Vieth\and + Lars Hellstr\"om} +\usepackage{fisource} +\begin{document} +\maketitle +\DocInput{fibasics.dtx} +\PrintIndex +\end{document} +%</driver> +% \fi +% +% \StopEventually{} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \begin{quote} +% ``Can't say I've ever been too fond of beginnings, myself. +% \emph{Messy} little things. Give me a good ending any time. +% You know where you \emph{are} with an ending.''\relax +% \nobreak\hskip 0pt plus 1fill\penalty0\hskip 2em\relax +% \vadjust{}\nobreak\hskip 1em plus 1fill\textemdash +% \ from \emph{The kindly ones} by \textsc{Neil Gaiman} et al.^^A +% \nobreak\hskip-\parfillskip\vadjust{} +% \end{quote} +% +% +% \section{The first and the last} +% +% \subsection{Version numbers} +% +% We start by making some default catcode assignments, in case we are +% using ini\TeX{}. +% \begin{macrocode} +%<*pkg> +\catcode`\{=1 +\catcode`\}=2 +\catcode`\#=6 +\catcode`\^=7 +%</pkg> +% \end{macrocode} +% +% \begin{macro}{\fontinstversion} +% If we are running under ini\TeX{} we cannot put the identification +% 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.927} +% \end{macrocode} +% \end{macro} +% +% If we are running under ini\TeX{} or \texttt{plain}, we have to get +% around the \LaTeX{}-specific |\ProvidesPackage| stuff. +% +% \begin{macrocode} +%<*pkg> +\ifx\ProvidesPackage\undefined + \def\NeedsTeXFormat#1{} + \def\ProvidesPackage#1[#2]{} +\fi +%</pkg> +% \end{macrocode} +% +% Now we can identify ourselves as usual. +% +% \begin{macrocode} +%<doc>\NeedsTeXFormat{LaTeX2e}[1995/06/01] +%<doc>\ProvidesPackage{fontdoc} +%<pkg>\ProvidesPackage{fontinst} +%<pkg|doc>[2004/08/07 v\fontinstversion\space +%<doc> fontinst documentation package] +%<pkg> fontinst installation package] +% \end{macrocode} +% +% While we're at version numbers anyway, we might as well define the +% command for testing them. Note however that the module name is not +% \Module{pkg} as above, but \Module{pkg2}. Code in the latter module +% ends up at the very end of \texttt{fontinst.sty}! +% +% \begin{macro}{\needsfontinstversion} +% The macro: +% \begin{quote} +% |\needsfontinstversion|\marg{number} +% \end{quote} +% checks the version number. +% +% \begin{macrocode} +%<*pkg2> +\def\needsfontinstversion#1{{ + \a_dimen=#1pt + \b_dimen=\fontinstversion~pt\x_relax + \ifnum\a_dimen>\b_dimen + \immediate\write16{} + \immediate\write16{Warning:~This~file~needs~fontinst~version~#1.} + \immediate\write16{Warning:~You~are~using~version~ + \fontinstversion.} + \immediate\write16{Warning:~This~may~cause~errors.} + \immediate\write16{} + \fi +}} +%</pkg2> +% \end{macrocode} +% +% In \package{fontdoc}, |\needsfontinstversion| is printed out as a +% comment. +% \changes{1.918}{2001/06/19}{Different formatting in encoding +% specification files. (LH)} +% \begin{macrocode} +%<*doc> +\newcommand*\needsfontinstversion[1]{% + \ifFD@spec@ + \comment{Automatic processing of this document as a data file + requires \textsf{fontinst} v\,#1 or higher.}% + \else + \Bheading{Needs fontinst v\thinspace#1}% + \fi +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Special catcodes and configuration file} +% +% \package{fontinst} uses some unusual, but convenient, settings of +% |\catcode|. |@| and |_| are made letters, |~| is made a space, and +% space and newline are ignored. Before setting those however, we save +% the current values of the catcodes, so that they can be restored at +% the end of \texttt{fontinst.sty}. +% +% \begin{macro}{\normalcc} +% \begin{macro}{\fontinstcc} +% \multchanges{\cs{fontinstcc}\cs{normalcc}}{1.915}{2000/08/09}^^A +% {Introduced commands for changing between \package{fontinst} +% internal catcodes and normal catcodes, as suggested by +% Karsten Tinnefeld. (LH)} +% The |\fontinstcc| command changes the catcodes of certain characters +% to what is used in the \package{fontinst} source and the |\normalcc| +% command changes them back; their use is analogous to that of the +% |\make|\-|at|\-|letter| and |\make|\-|at|\-|other| commands in +% \LaTeX. +% +% If, for some reason, you use other ``normal'' catcodes than +% \package{fontinst} does by default, you may have to redefine +% |\fontinstcc| and |\normalcc|. The easiest way to do this is +% probably to use the |\add_to| macro. +% +% \multchanges{\cs{spacecatcode}\cs{nlcatcode}\cs{atcatcode}^^A +% \cs{underscorecatcode}\cs{tildecatcode}}{1.915}{2000/08/09}^^A +% {Removed since the contents can just as well be stored in +% \cs{normalcc}. (LH)} +% \begin{macrocode} +%<*pkg> +\def\a_macro#1{\catcode\number`#1=\the\catcode`#1 } +\edef\normalcc{% + \a_macro{\ }\a_macro{\^^M}\a_macro{\@}\a_macro{\_}\a_macro{\~} +} +% \end{macrocode} +% The above definition makes the |\normalcc| macro end with a space. +% This is deliberate; the space is used to terminate the last number +% in the macro. +% +% \begin{macrocode} +\def\fontinstcc{% + \catcode`\ =9% + \catcode`\^^M=9% + \catcode`\@=11% + \catcode`\_=11% + \catcode`\~=10 +} +\fontinstcc +%</pkg> +% \end{macrocode} +% \end{macro}\end{macro} +% +% We input the \texttt{fontinst.rc} file, if it exists.\relax +% \changes{1.6}{1997/02/07}{\texttt{fontinst.rc} search order changed +% (Thierry Bouche).}\relax +% \SortIndex{fontinst.rc file}{\texttt{fontinst.rc} file} +% +% UV, 06/1998: What is this \texttt{fontinst.rc} file good for? +% It turns out that you can use it to do |\def\raw_encoding{8y}| +% if you prefer to install your fonts the other way. +% +% \begin{macrocode} +%<*pkg2> +%<*!misc> +\if_file_exists{fontinst.rc}\then + \primitiveinput fontinst.rc +\else + \immediate\write16{No~file~fontinst.rc.} +\fi +%</!misc> +% \end{macrocode} +% Use a different configuration file for \texttt{finstmsc.sty}.^^A +% \changes{1.905}{1999/06/21}{Different config file for +% \texttt{finstmsc.sty}. (LH)} +% \begin{macrocode} +%<*misc> +\if_file_exists{finstmsc.rc}\then + \primitiveinput finstmsc.rc +\else + \immediate\write16{No~file~finstmsc.rc.} +\fi +%</misc> +% \end{macrocode} +% +% At the end of \texttt{fontinst.sty}, we restore the catcodes we +% changed. +% \changes{1.910}{1999/11/01}{Catcodes restored \emph{after} reading +% \texttt{.rc} file. (LH\&UV)} +% +% \begin{macrocode} +\normalcc +%</pkg2> +% \end{macrocode} +% +% +% \subsection +% {Plain \TeX{} macros from \texttt{fontinst.ini}} +% ^^A \subsection{PlainTeX macros from fontinst.ini} +% +% If we're running in ini\TeX{} we input some definitions taken +% from \texttt{plain}. +% +% \begin{macrocode} +%<*pkg> +\ifx\@ne\undefined_command + \input fontinst.ini\relax +\fi +%</pkg> +% \end{macrocode} +% +% \begin{macrocode} +%<*ini> +\chardef\active=13 + +\chardef\@ne=1 +\chardef\tw@=2 +\chardef\thr@@=3 +\chardef\sixt@@n=16 +\chardef\@cclv=255 +\mathchardef\@cclvi=256 +\mathchardef\@m=1000 +\mathchardef\@M=10000 +\mathchardef\@MM=20000 + +\count10=22 % allocates \count registers 23, 24, ... +\count11=9 % allocates \dimen registers 10, 11, ... +\count15=9 % allocates \toks registers 10, 11, ... +\count16=-1 % allocates input streams 0, 1, ... +\count17=-1 % allocates output streams 0, 1, ... +\count20=255 % allocates insertions 254, 253, ... +\countdef\insc@unt=20 % the insertion counter +\countdef\allocationnumber=21 % the most recent allocation +\countdef\m@ne=22 \m@ne=-1 % a handy constant +\def\wlog{\immediate\write\m@ne} % write on log file (only) + +\countdef\count@=255 +\dimendef\dimen@=0 + +\outer\def\newcount{\alloc@0\count\countdef\insc@unt} +\outer\def\newdimen{\alloc@1\dimen\dimendef\insc@unt} +\outer\def\newtoks{\alloc@5\toks\toksdef\@cclvi} +\outer\def\newread{\alloc@6\read\chardef\sixt@@n} +\outer\def\newwrite{\alloc@7\write\chardef\sixt@@n} + +\def\alloc@#1#2#3#4#5{\global\advance\count1#1by\@ne + \ch@ck#1#4#2% make sure there's still room + \allocationnumber=\count1#1% + \global#3#5=\allocationnumber + \wlog{\string#5=\string#2\the\allocationnumber}} +\outer\def\newinsert#1{\global\advance\insc@unt by\m@ne + \ch@ck0\insc@unt\count + \ch@ck1\insc@unt\dimen + \ch@ck2\insc@unt\skip + \ch@ck4\insc@unt\box + \allocationnumber=\insc@unt + \global\chardef#1=\allocationnumber + \wlog{\string#1=\string\insert\the\allocationnumber}} +\def\ch@ck#1#2#3{\ifnum\count1#1<#2% + \else\errmessage{No~room~for~a~new~#3}\fi} + +\outer\def\newif#1{\count@\escapechar \escapechar\m@ne + \expandafter\expandafter\expandafter + \edef\@if#1{true}{\let\noexpand#1=\noexpand\iftrue}% + \expandafter\expandafter\expandafter + \edef\@if#1{false}{\let\noexpand#1=\noexpand\iffalse}% + \@if#1{false}\escapechar\count@} % the condition starts out false +\def\@if#1#2{\csname\expandafter\if@\string#1#2\endcsname} +{\uccode`1=`i \uccode`2=`f \uppercase{\gdef\if@12{}}} % `if' is required + +\newdimen\p@ \p@=1pt % this saves macro space and time +\newdimen\z@ \z@=0pt % can be used both for 0pt and 0 + +\def\space{~} +\let\bgroup={ +\let\egroup=} + +\def\loop#1\repeat{\def\body{#1}\iterate} +\def\iterate{\body \let\next\iterate \else\let\next\relax\fi \next} +\let\repeat=\fi % this makes \loop...\if...\repeat skippable + +\def\supereject{\par\penalty-\@MM} +\outer\def\bye{\par\vfill\supereject\end} +%</ini> +% \end{macrocode} +% The two last commands above also need to be defined if we're +% running under \LaTeX. In that case we need to be careful with |\bye| +% however, as no |\if|\textellipsis\ can skip over code that explicitly +% contains that control sequence, if it has been defined as above. +% \begin{macrocode} +%<*pkg> +\ifx\bye\undefined_command + \def\supereject{\par\penalty-\@MM} + \outer\expandafter\def \csname bye\endcsname + {\par\vfill\supereject\@@end} +\fi +%</pkg> +% \end{macrocode} +% +% \changes{1.910}{1999/11/01}{Make \cs{everyjob} code optional, and +% simplify it a little. (LH\&UV)} +% \begin{macrocode} +%<*ini&everyjob> +\everyjob{% + \if_file_exists{fontinst.rc}\then + \primitiveinput~fontinst.rc + \else + \immediate\write16{No~file~fontinst.rc.} + \fi +} +%</ini&everyjob> +% \end{macrocode} +% +% +% \section{Basic definitions} +% +% \subsection{Declaring variables and constants} +% +% Some temporary variables: +% +% \begin{macro}{\a_count} +% \begin{macro}{\b_count} +% \begin{macro}{\c_count} +% \begin{macro}{\d_count} +% \begin{macro}{\e_count} +% \begin{macro}{\f_count} +% \begin{macro}{\g_count} +% \begin{macrocode} +%<*pkg> +\newcount\a_count +\newcount\b_count +\newcount\c_count +\newcount\d_count +\newcount\e_count +\newcount\f_count +\newcount\g_count +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% \end{macro} +% \begin{macro}{\a_dimen} +% \begin{macro}{\b_dimen} +% \begin{macro}{\c_dimen} +% \begin{macro}{\d_dimen} +% \begin{macrocode} +\newdimen\a_dimen +\newdimen\b_dimen +\newdimen\c_dimen +\newdimen\d_dimen +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% \begin{macro}{\a_toks} +% \begin{macro}{\b_toks} +% \begin{macro}{\c_toks} +% \begin{macrocode} +\newtoks\a_toks +\newtoks\b_toks +\newtoks\c_toks +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{switch}{_a_} +% \changes{1.901}{1999/03/07}{Temporary switch added. (LH)} +% \begin{macrocode} +\newif\if_a_ +% \end{macrocode} +% \end{switch} +% +% \describecsfamily{\meta{letter}_macro} +% Besides these temporary variables that have to be declared, the family +% of control sequences with names of the form |\|\meta{letter}|_macro|, +% such as |\a_macro|, |\b_macro|, etc., should be used as ``macro valued'' +% temporary variables. +% \changes{1.903}{1999/05/13}{Introduced the +% \cs{\meta{letter}_macro} temporary variables, +% replaced \cs{temp_command}. (LH)} +% +% \begin{macro}{\out_file} +% Some global variables: +% \begin{macrocode} +\newwrite\out_file +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\one_thousand} +% \begin{macro}{\five_hundred} +% \begin{macro}{\one_hundred} +% \begin{macro}{\max_mathchardef} +% \begin{macro}{\two_thousand} +% \changes{1.913}{2000/03/11}{Constant added. (LH)} +% \begin{macro}{\half_point} +% \changes{1.913}{2000/03/04}{Constant added. (LH)} +% Some constants: +% \begin{macrocode} +\mathchardef\one_thousand=1000 +\mathchardef\five_hundred=500 +\mathchardef\one_hundred=100 +\mathchardef\max_mathchardef="7FFF +\mathchardef\two_thousand=2000 +\newdimen\half_point \half_point=0.5pt +% \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} +% +% +% \subsection +% {\package{fontdoc}-specific declarations} +% ^^A \subsection{fontdoc-specific declarations} +% +% As of v\,1.917, \package{fontdoc} has options, so we better start +% with declaration and processing of these. +% \changes{1.917}{2001/03/31}{Option processing added. (LH)} +% +% \begin{option}{specification} +% \begin{switch}{FD@spec@} +% The \texttt{specification} option tells \package{fontdoc} that the +% document is an encoding specification rather than a production +% file---this changes some minor details in the typesetting. The +% state of this option is recorded in the |FD@spec@| switch. +% \begin{macrocode} +%<*doc> +\newif\ifFD@spec@ +\FD@spec@false +\DeclareOption{specification}{\FD@spec@true} +% \end{macrocode} +% \end{switch}\end{option} +% +% \begin{option}{hypertex} +% \changes{1.918}{2001/06/17}{Option added. (LH)} +% \begin{option}{pdftex} +% \changes{1.920}{2001/09/24}{Option added. (LH)} +% \begin{macro}{\FD@codepoint} +% The \texttt{hypertex} and \texttt{pdftex} options tell +% \package{fontdoc} to include Hyper\TeX\ |\special|s and pdf\TeX\ +% annotations, in every code point number set using |\Unicode| or +% |\textunicode|, for links to glyph images on the Unicode +% consortium web site. The URLs to use are as follows: +% \begin{quote} +% \small +% To access the reference glyph for any Unicode character, +% you can use the new URL syntax like this: +% \begin{quote} +% \texttt{http://www.unicode.org/cgi-bin/refglyph?}^^A +% \meta{XX}\texttt{-}\meta{nnnn} +% \end{quote} +% where \meta{XX} is the point size and \meta{nnnn} is the +% hexadecimal codepoint. Please note however that only \texttt{24} +% is supported as a size parameter at this time. (We are +% reserving the possibility of providing other sizes in the +% future.) Here is an example of usage for \texttt{U+4E78}: +% \begin{quote} +% \texttt{http://www.unicode.org/cgi-bin/refglyph?24-4E78} +% \end{quote} +% (This supports up to 6 hex digits, so it can also be used +% with the supplementary characters.) +% \end{quote} +% +% \iffalse +% Documentation for a similar older service: +% \begin{quotation} +% \small +% You may embed references to the glyph images on the Unicode site +% in your own web pages. For example, to display a Euro sign +% (\texttt{U+20AC}) you can use the following HTML: +% \begin{quote} +% |<IMG SRC="http://charts.unicode.org/Glyphs/20/U20AC.gif">| +% \end{quote} +% The subdirectory to use within the \texttt{Glyphs/} directory +% is the first two hexadecimal digits of the Unicode code point. +% The set of glyphs available covers all of Unicode 3.0 with the +% exception of Han ideographs and Hangul syllables. +% +% However, you should only make occasional use of these glyphs. +% If there is too much web traffic the Unicode +% Consortium may be forced to discontinue this service. +% \end{quotation} +% \fi +% Coding this for Hyper\TeX\ is pretty straightforward. +% \begin{macrocode} +\DeclareOption{hypertex}{ + \providecommand*\FD@codepoint[1]{% + \uppercase{\edef\@tempa{#1}}% + \special{html:<a href="% + http://www.unicode.org/cgi-bin/refglyph?24-\@tempa + ">% + }% + \texttt{U+\@tempa}% + \special{html:</a>}% + }% +} +% \end{macrocode} +% The pdf\TeX\ implementation is easy too, but there is one +% complication: The key primitive is called |\pdfannotlink| in +% v\,0.13, but |\pdfstartlink| in v\,0.14. My thanks goes to H\`an +% Th\'{\^e} Th\`anh, who helped me sort that out. +% \begin{macrocode} +\DeclareOption{pdftex}{ + \providecommand*\FD@codepoint[1]{% + \mbox{% + \uppercase{\edef\@tempa{#1}}% + \ifx \pdfstartlink\@undefined + \pdfannotlink + \else + \pdfstartlink + \fi attr {/Border [0 0 0]} user {% + /Subtype /Link /A <<% + /S /URI /URI (% + http://www.unicode.org/cgi-bin/refglyph?24-\@tempa + )% + >>}% + \textcolor{blue}{\texttt{U+\@tempa}}% + \pdfendlink + }% + }% + \AtEndOfPackage{\RequirePackage[pdftex]{color}}% +} +% \end{macrocode} +% It would be quite possible to make these links according to some +% other standard (e.g.~\LaTeX\-to\-HTML) instead by including a suitable +% definition of |\FD@codepoint| in your \texttt{fontdoc.cfg} file. +% I could include code for those standards as well if someone sends +% it to me. +% +% I decided against using commands in the \package{hyperref} or +% \package{hyper} packages for this as these packages do so much more +% that I don't want. If some day a package providing a basic interface +% for making hyperlinks is included in required \LaTeX\ then this +% decision should certainly be reconsidered. +% \end{macro}\end{option}\end{option} +% +% Input a local configuration file, if it exists. +% \begin{macrocode} +\InputIfFileExists{fontdoc.cfg}{% + \typeout{*************************************^^J% + * Local config file fontdoc.cfg used^^J% + *************************************}% +}{} +% \end{macrocode} +% +% Finally process the options. +% \begin{macrocode} +\ProcessOptions\relax +% \end{macrocode} +% +% +% The \package{amstext} package is required, since the |\text| command +% is used in formatting some integer expressions. +% \changes{1.916}{2001/01/02}{Requiring the \package{amstext} package +% in \package{fontdoc}. (LH)} +% \begin{macrocode} +\RequirePackage{amstext} +% \end{macrocode} +% +% \begin{macro}{\a@count} +% \begin{macro}{\b@count} +% \changes{1.916}{2001/01/02}{Variable added. (LH)} +% \begin{macro}{\a@dimen} +% Three private variables: +% \begin{macrocode} +\newcount\a@count +\newcount\b@count +\newdimen\a@dimen +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% Some useful macros and constrol structures: +% +% \begin{macrocode} +\def\x@cs#1#2{\expandafter#1\csname#2\endcsname} +\def\FD@swap@two#1#2{#2#1} +% \end{macrocode} +% +% \begin{macro}{\Aheading} +% \changes{1.909}{1999/10/18}{Use \cs{addvspace} to make space +% above. (LH)} +% \changes{1.909}{1999/10/20}{Insert a \cs{penalty} for pagebreaking +% after an \cs{Aheading}. (LH)} +% \changes{1.920}{2001/10/19}{Encouraged page breaks before an +% \cs{Aheading}. (LH)} +% \begin{macro}{\Bheading} +% |\Aheading| and |\Bheading| are used to typeset various headings. +% \begin{macrocode} +\newcommand\Aheading[1]{% + \par\pagebreak[1]\addvspace\medskipamount + \noindent\textbf{#1}\vadjust{\penalty200}\par +} +\newcommand\Bheading[1]{\par\noindent\textbf{#1}} +% \end{macrocode} +% \end{macro}\end{macro} +% +% Some formating commands and a macro that comes in handy. It used to +% say |\raggedright| at this point as well, but that functionality has +% been moved into |\encoding| and |\metrics|. +% +% \definechange{raggedright}{1.920}{2001/09/16}{The body (between +% \cs{metrics} and \cs{endmetrics}, and \cs{encoding} and +% \cs{endencoding} respectively) of a \package{fontdoc} document is +% now typeset in a \texttt{flushleft} environment. It used to be that +% the entire document was typeset this way. (LH)} +% \usechange{raggedright} +% \changes{1.923}{2002/10/26}{Making sure \cs{lineskiplimit} is +% positive. (LH)} +% +% \begin{macrocode} +\raggedbottom +\ifdim 1sp>\lineskiplimit \lineskiplimit=0.5pt \fi +\newcommand\plain{\texttt{plain}} +% \end{macrocode} +% +% \begin{macro}{\plainint} +% \begin{macro}{\plaindiv} +% \begin{macro}{\plainmax} +% \begin{macro}{\plainmin} +% \package{fontdoc} saves away \LaTeX's |\int|, |\div|, |\max|, and +% |\min| as |\plainint|, |\plaindiv|, |\plainmax|, and |\plainmin|, +% since these control sequences are going to be used for other +% purposes. +% \begin{macrocode} +\let\plainint=\int +\let\plaindiv=\div +\let\plainmax=\max +\let\plainmin=\min +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\TypesetList} +% \changes{1.914}{2000/05/13}{Macro added. (LH)} +% \begin{macro}{\list@item@counter} +% The |\TypesetList| command typesets the \meta{arg}s in a sequence of +% |\do|\marg{arg} macros with separators depending on position in and +% length of the sequence. It is loosely based on a description of a +% similar command in the \package{amsref} package, but it has fewer +% features, and I don't know if there is any similarity between the +% implementations. +% +% The syntax is +% \begin{isyntax} +% |\TypesetList|\marg{left}\marg{onlysep}\marg{nonlastsep}\penalty0 +% \marg{lastsep}\penalty0\marg{right}\penalty0 +% \marg{empty}\penalty0\marg{wrap}\penalty0\marg{list} +% \end{isyntax} +% \meta{list} is the actual list of |\do|\marg{arg}s. If that is +% empty then \meta{empty} is typeset. Otherwise the typeset text +% begins with \meta{left}, ends with \meta{right}, and contains the +% formatted forms of every \meta{arg} in the list of |\do|\marg{arg}s. +% The formatting here consists of passing the \meta{arg} as the +% argument to \meta{wrap}, which is typically a one-argument macro. +% Between two ``formatted \meta{arg}s'' will \meta{onlysep}, +% \meta{nonlastsep}, or \meta{lastsep} be put, depending on the number +% of \meta{arg}s in the list and the position in the list. If the list +% has length two then \meta{onlysep} will be used for the only separator +% needed. If the list has length greater than two then \meta{nonlastsep} +% will be used for all separators but the last, and \meta{lastsep} will +% be used for the last. +% +% All of the arguments of |\TypesetList| must survive being passed +% through a |\def|. +% \begin{macrocode} +\newcount\list@item@counter +\newcommand\TypesetList[8]{% + \begingroup + \list@item@counter=\z@ + \def\do##1{\advance\list@item@counter\@ne}% + #8% + \ifcase \list@item@counter \or + \def\do##1{#1#7{##1}}% + \or + \def\do##1{% + \advance\list@item@counter\@ne + \ifnum \list@item@counter=\@ne #1\else #2\fi + #7{##1}% + }% + \else + \advance\list@item@counter\m@ne + \expandafter\def \expandafter\do \expandafter##\expandafter1% + \expandafter{\expandafter\ifnum \the\list@item@counter + =\list@item@counter + #4% + \else\ifnum \z@=\list@item@counter + #1% + \else + #3% + \fi\fi + \advance\list@item@counter\@ne + #7{##1}% + }% + \fi + \ifnum \z@=\list@item@counter + #6% + \else + \list@item@counter=\z@ + #8% + #5% + \fi + \endgroup +} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% +% \section +% {\TeX{} hackery} +% ^^A \section{TeX hackery} +% \changes{1.902}{1999/05/01}{Moved Section \thesection\space to +% \texttt{fibasics.dtx}. (LH)} +% +% \subsection{Utiltiy macros} +% +% \begin{macro}{\x_cs} +% \begin{macro}{\x_relax} +% \begin{macro}{\g_let} +% \begin{macrocode} +%<*pkg> +\def\x_cs#1#2{\expandafter#1\csname#2\endcsname} +\let\x_relax=\relax +\def\g_let{\global\let} +%</pkg> +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% \changes{1.900}{1999/02/07}{Replaced \cs{relax} by \cs{x_relax}. (LH)} +% +% \begin{macro}{\x@relax} +% \begin{macrocode} +%<doc>\let\x@relax=\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\empty_command} +% \begin{macro}{\gobble_one} +% \begin{macro}{\gobble_two} +% \begin{macro}{\gobble_three} +% \begin{macro}{\identity_one} +% \begin{macro}{\first_of_two} +% \begin{macro}{\second_of_two} +% \begin{macro}{\swap_two} +% \changes{1.912}{2000/02/16}{Macro added. (LH)} +% \begin{macro}{\first_of_three} +% \changes{1.914}{2000/05/30}{Macro added. (LH)} +% \begin{macrocode} +%<*pkg> +\def\empty_command{} +\def\gobble_one#1{} +\def\gobble_two#1#2{} +\def\gobble_three#1#2#3{} +\def\identity_one#1{#1} +\def\first_of_two#1#2{#1} +\def\second_of_two#1#2{#2} +\def\swap_two#1#2{#2#1} +\def\first_of_three#1#2#3{#1} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\hash_char} +% \begin{macro}{\percent_char} +% \begin{macro}{\left_brace_char} +% \begin{macro}{\right_brace_char} +% \begin{macrocode} +\bgroup + \catcode`\[=1 + \catcode`\]=2 + \catcode`\#=12 + \catcode`\%=12 + \catcode`\{=12 + \catcode`\}=12 + \gdef\hash_char[#] + \gdef\percent_char[%] + \gdef\left_brace_char[{] + \gdef\right_brace_char[}] +\egroup +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\first_char} +% Return the first character of a string. +% +% \begin{macrocode} +\def\first_char#1#2={#1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\add_to} +% Append one or more tokens to the replacement text of a +% parameterless macro. +% \begin{macrocode} +\def\add_to#1#2{ + \ifx#1\x_relax + \def#1{#2} + \else + \expandafter\def\expandafter#1\expandafter{#1#2} + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\prep_to} +% Prepend one or more tokens to the replacement text of a +% parameterless macro. Note that if more than one token is added then +% the second parameter must contain an |\expandafter| between every +% pair of tokens you actually mean to contribute. Thus if you want +% to prepend |abc| to |\next|, you must write +% \begin{quote} +% |\prep_to\next{a\expandafter b\expandafter c}| +% \end{quote} +% Also note that the second argument must not be empty. +% \begin{macrocode} +\def\prep_to#1#2{ + \ifx#1\x_relax + \expandafter\def\expandafter#1\expandafter{\expandafter#2} + \else + \expandafter\def\expandafter#1\expandafter{\expandafter#2#1} + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\never_do} +% The command |\do|, protected from expansion. +% +% \begin{macrocode} +\def\never_do{\noexpand\do} +%</pkg> +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Testing for \TeX\ extensions} +% \changes{1.914}{2000/05/13}{Added commands for testing for +% \protect\TeX\ extensions. (LH)} +% Some tasks can be done better (and usually with simpler code) if +% one can assume that certain features in some \TeX\ extensions, such as +% \eTeX, is available. Unfortunately one cannot generally make this +% assumption, but it is sometimes possible to provide two implementations +% of a macro and at runtime choose the one which best utilizes the +% available features. This subsection defines macros for making these +% tests. +% +% There is also a command |\needsTeXextension| which is used like +% |\needs|\-|fontinst|\-|version|, but which tests the \TeX\ rather than +% the version of \package{fontinst}. This ought to be of use for ETX files +% that describe 16 bit encodings,\footnote{At the time of writing, no +% such ETX files exist that I know of, but \package{fontinst} should +% not have any problem using them. /LH} as the current implementation +% of the (V)PL writer in this case requires the underlying \TeX\ to +% support 16 bit character codes. +% +% The normal operation of the extension-testing macros is to set the |_a_| +% switch to true if the requested extension is present, and to leave the +% switch as it was if it isn't present. This is so that one can easily +% test for a feature that has been added to several different extensions +% of \TeX\ simply by doing the tests in sequence. That, however, is what +% the testing macros do if the switch |_extensions_warning_| is set to +% false. When it is set to true they instead expand to a short piece of +% text suitable for inclusion in a warning message about the absence of +% a needed feature. +% +% \begin{switch}{_extensions_warning_} +% This switch controls whether extension-testing macros should +% actually do the test (false) or produce a warning (true). +% \begin{macrocode} +%<*pkg> +\newif\if_extensions_warning_ +\_extensions_warning_false +% \end{macrocode} +% \end{switch} +% +% +% \begin{macro}{\eTeX} +% The |\eTeX| command has the syntax +% \begin{quote} +% |\eTeX|\marg{version number} +% \end{quote} +% where the \meta{version number} is the complete version number +% (version number plus revision) of the \eTeX\ one wishes to test for. +% +% The code below is geared towards not letting unnecessary control +% sequences get tokenized, as they will then always occupy a position +% in \TeX's hash table, but it seems one cannot get around testing +% whether |\eTeXversion| is defined, so we start with that and then +% do a |\catcode| trick to prevent \TeX\ from seeing |\eTeXrevision|. +% \begin{macrocode} +\ifx \eTeXversion\undefined_command + \catcode`\~=14 % 14=comment +\fi +\def\eTeX#1{ + \if_extensions_warning_ + \space/\space e-TeX\space version\space #1 +~ \else +~ \ifdim \number\eTeXversion\eTeXrevision\p@ < #1\p@ \else +~ \_a_true +~ \fi + \fi +} +\catcode`\~=10 +%</pkg> +% \end{macrocode} +% \begin{macro}{\eTeXlogo} +% The |\eTeXlogo| command prints the \eTeX\ logo. +% \changes{1.923}{2002/10/20}{Added kern, to match +% \package{ltugboat} definition. (LH)} +% \begin{macrocode} +%<*doc> +\def\eTeX#1{\do{\eTeXlogo\nolinebreak[3] v\,#1}} +\def\eTeXlogo{\ensuremath{\varepsilon}-\kern-.125em\TeX} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \begin{macro}{\pdfTeX} +% The |\pdfTeX| command has the syntax +% \begin{quote} +% |\pdfTeX|\marg{version number}\marg{revision} +% \end{quote} +% where the \meta{version number} is the version number as returned +% by |\pdftexversion|, i.e., 100 times what it would normally be +% printed as, and the \meta{revision} is the revision code as returned +% by |\pdftexrevision|. To test for pdf\TeX\ 0.13c or newer, one would +% say |\pdfTeX{13}{c}|. +% +% The code below uses the same |\catcode| trick as that in |\eTeX|. +% \begin{macrocode} +%<*pkg> +\ifx \pdftexversion\undefined_command + \catcode`\~=14 % 14=comment +\fi +%</pkg> +%<*pkg|doc> +\def\pdfTeX#1#2{% +%<pkg> \if_extensions_warning_ +%<pkg> \space/\space pdfTeX\space version\space +%<doc> \do{pdf\TeX\nolinebreak[3] v\,% + \ifnum #1<100\space + 0.\ifnum #1<10\space 0\fi + \else +%<pkg> \expandafter\swap_two \expandafter. +%<doc> \expandafter\FD@swap@two \expandafter.% + \fi + #1#2% +%<doc> } +%<doc>} +%</pkg|doc> +%<*pkg> +% \end{macrocode} +% The above is not ideal, but it will do for now. +% \begin{macrocode} +~ \else +~ \ifdim #1>\pdftexversion \else +~ \ifnum \expandafter\expandafter \expandafter` +~ \expandafter\first_char \pdftexrevision= < +~ \expandafter` \first_char#2= +~ \else \_a_true \fi +~ \fi + \fi +} +\catcode`\~=10 +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\needsTeXextension} +% The |\needsTeXextension| command has the syntax +% \begin{quote} +% |\needsTeXextension|\marg{extension tests}\marg{who} +% \end{quote} +% If none of the extension tests set the |_a_| switch to true, then +% it prints a warning detailing the extensions tests which failed. +% \meta{who} is what should be listed as the originator of this +% message; it is typically the name of the file which contains the +% |\needsTeXextension| command. +% +% An example (assuming that there will be an |\Omega| test as well +% some time in the future; I haven't really looked into what that +% should look like, so maybe the arguments should be different): The +% command +% \begin{quote} +% |\needsTeXextension{\eTeX{1.2}\Omega{1.0}}{foobar.etx}| +% \end{quote} +% tests if the current \TeX\ is \eTeX\ verision 1.2 (or newer) +% \emph{or} Omega version 1.0 (or newer). The implied conjunction +% between the tests is always `or'. +% \begin{macrocode} +\def\needsTeXextension#1#2{ + \_a_false + #1 + \if_a_ \else + \_extensions_warning_true + \edef\a_macro{#1} + \_extensions_warning_false + \fontinstwarningnoline{#2}{ + This~file~needs:\messagebreak + \expandafter\second_of_two\a_macro + \iffalse + <no~sufficient~extensions~were~listed!!>\if_false + \fi + \messagebreak + You~are~not~using~any~of~them.~This~is~likely~to~cause~errors + } + \fi +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\def\needsTeXextension#1#2{% + \Bheading{Needs + \TypesetList{}{ or }{, }{, or }{}{(unspecified)}{\@firstofone}{#1}}% +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% +% \subsection{Writing to output files} +% +% \changes{1.901}{1999/03/04}{Pooled output file allocation added. (LH)} +% As of v\,1.901, there are two different output file +% models in \package{fontinst}. One has been along ``forever'' and is +% for writing output to files which are only open for a short period of +% time---every \package{fontinst} file command that opens a file in this +% model must also close it---and it can only be used for one file at at +% time. The other model offers pooled allocation of output files---as +% long as there is an unused \TeX\ output stream to open, you may open a +% new file, and it does not matter if files are not closed in the revese +% order of that in which they were opened. +% +% \begin{macro}{\open_out} +% \changes{1.901}{1999/03/04} +% {\cs{xdef} instead of \cs{def} on \cs{out_filename}. (LH)} +% \begin{macro}{\close_out} +% \begin{macro}{\out_line} +% \begin{macro}{\out_lline} +% \changes{1.908}{1999/08/25}{\cs{edef}, to save macro expansions +% later. (LH)} +% \begin{macro}{\out_llline} +% \changes{1.908}{1999/08/25}{\cs{edef} and don't use \cs{out_lline}, +% to save macro expansions later. (LH)} +% These macros implement the classical output file commands. +% \begin{macrocode} +%<*pkg> +\def\open_out#1{ + \immediate\openout\out_file=#1 \xdef\out_filename{#1}} +\def\close_out#1{ + \immediate\write16{#1~written~on~\out_filename.} + \immediate\closeout\out_file} +\def\out_line#1{\immediate\write\out_file{#1}} +\edef\out_lline#1{\noexpand\out_line{\space\space\space#1}} +\edef\out_llline#1{ + \noexpand\out_line{\space\space\space\space\space\space#1} +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% In the new model, the basic writing command +% \DescribeMacro{\pout_line}|\pout_line| takes two arguments: a file +% identifier control sequence and the token sequence to write. Thus its +% call looks like +% \begin{quote} +% |\pout_line|\meta{identifier}\marg{text} +% \end{quote} +% The \meta{identifier} is usually a chardef token whose number tells +% which input stream is used, but if \TeX\ runs out of output streams +% then it might be defined as a parameterless macro which expands to +% |\m@ne|. This has the effect of making all output to that ``file'' go +% to the log file, from which the data might be salvaged. +% +% The new model operates using the control sequence family +% \describecsfamily{out_filename-\meta{stream}}^^A +% |\out_filename-|\meta{stream} +% both for storing the name of the output file and for handling +% allocation of output streams. +% +% \begin{macro}{\TeX_terminal} +% \begin{macro}{\closed_stream} +% \begin{macro}{\out_filename-99} +% \begin{macro}{\out_filename--1} +% Output streams 16 and above always write to \TeX's terminal, and any +% output file that gets closed gets its identifier set to 99 so that +% any attempts to write to a closed file can be easily spotted. (99 +% is the character code for |c|.) Output stream --1 is the log file, and +% if another output stream cannot be allocated then attempts to write to +% the output file will be redirected to the log file. +% \begin{macrocode} +\def\TeX_terminal{\string\TeX\space terminal} +\chardef\closed_stream=99 +\x_cs\let{out_filename-99}=\TeX_terminal +\x_cs\def{out_filename--1}{\jobname.log} +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} \end{macro} +% +% \begin{macro}{\allocate_stream} +% \begin{macro}{\ch@ck} +% \begin{macrocode} +\def\allocate_stream{ + \a_count=\m@ne + \b_count=\m@ne + \loop \ifnum \count17>\a_count +% \end{macrocode} +% While |\a_count|${}<$ the number of the last allocated output +% stream \textellipsis +% \begin{macrocode} + \advance \a_count \@ne + \x_cs\ifx{out_filename-\the\a_count}\TeX_terminal +% \end{macrocode} +% If |\out_filename-|\meta{stream}, where \meta{stream} is the value +% of |\a_count|, is equal to |\TeX_terminal|, then output stream +% |\a_count| is allocated to the pool but is not used for any +% currently open file. Thus we've found a stream that can be used. +% \begin{macrocode} + \b_count=\a_count + \a_count=\count17 + \fi + \repeat + \ifnum \b_count=\m@ne +% \end{macrocode} +% In this case all streams allocated to the pool are currently in use, +% so try to allocate a new one. +% \begin{macrocode} + \global\advance\count17by\@ne + \ifnum \count17<\sixt@@n +% \end{macrocode} +% Then case: There was another output stream. +% \begin{macrocode} + \b_count=\count17 + \global\x_cs\let{out_filename-\the\b_count}\TeX_terminal + \wlog{\string\write\the\b_count\space allocated~to~the~pool.} + \else +% \end{macrocode} +% Else case: See to that the output stream allocation register holds +% at 16. +% \begin{macrocode} + \global\count17=\sixt@@n + \fi + \fi +} +% \end{macrocode} +% By now, if a new stream could be allocated then the number of that +% stream is in |\b_count|, and if it couldn't then |\b_count| is --1. +% +% All output streams up to and including that whose number is in +% |\count17| is checked to see if it is available. Many unsuccessful +% |\newwrite|s could therefore mean we have to do quite a lot of +% checking. What's more, output stream 99 would incorrectly be +% interpreted as being in the pool but not used. To guard against these +% (improbable) errors, |\ch@ck| is redefined to stop allocation +% |\count| registers at their limit value. +% \begin{macrocode} +\def\ch@ck#1#2#3{ + \ifnum \count1#1<#2 \else + \errmessage{No~room~for~a~new~#3} + \global\count1#1=#2 + \fi +} +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% \begin{macro}{\open_pout} +% \begin{macro}{\close_pout} +% The syntax for |\open_pout| is +% \begin{quote} +% |\open_pout|\meta{identifier}\marg{name} +% \end{quote} +% \meta{name} is the name of the output file one wishes to open. +% \meta{identifier} is a control sequence which will be redefined +% (globally) to act as an identifier of the file. +% \begin{macrocode} +\def\open_pout#1#2{ + \allocate_stream + \ifnum \b_count=\m@ne + \immediate\write\sixt@@n{fontinst~is~out~of~output~streams.^^J + Output~file~#2~cannot~be~opened.^^J + Writes~will~be~redirected~to~the~log~file. + } + \gdef#1{\m@ne} + \else + \immediate\openout\b_count=#2\x_relax + \x_cs\xdef{out_filename-\the\b_count}{#2} + \global\chardef#1=\b_count + \fi +} +% \end{macrocode} +% +% The syntax for |\close_pout| is +% \begin{quote} +% |\close_pout|\meta{identifier}\marg{what} +% \end{quote} +% \meta{identifier} is the output stream identifier which should have +% been defined in an earlier call of |\open_pout|. \meta{what} is a +% string which describes what has been written to the output file, +% e.g.\ |Metrics| or |Raw~font|. It will be used to write a message on +% the terminal. +% \begin{macrocode} +\def\close_pout#1#2{ + \ifnum #1=\closed_stream + \errmessage{Output~file~\string#1~(#2)~not~closed,^^J + since~it~was~not~open} + \else + \immediate\write\sixt@@n{#2~written~on~ + \csname out_filename-\the#1\endcsname.} + \ifnum #1=\m@ne \else + \immediate\closeout#1 + \global\x_cs\let{out_filename-\the#1}=\TeX_terminal + \fi + \global\chardef#1=\closed_stream + \fi +} +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% \begin{macro}{\pout_line} +% The syntax for |\pout_line| is +% \begin{quote} +% |\pout_line|\meta{identifier}\marg{text} +% \end{quote} +% \meta{identifier} is the output stream identifier which should have +% been defined in an earlier call to |\open_pout|. \meta{text} is +% what will be written to the file. +% \begin{macrocode} +\def\pout_line#1#2{\immediate\write#1{#2}} +% \end{macrocode} +% +% \begin{macro}{\pout_lline} +% \changes{1.904}{1999/06/15}{Command added. (LH)} +% \changes{1.908}{1999/08/25}{\cs{edef}, to save macro expansions +% later. (LH)} +% \begin{macro}{\pout_llline} +% \changes{1.904}{1999/06/15}{Command added. (LH)} +% \changes{1.908}{1999/08/25}{\cs{edef} and don't use \cs{pout_lline}, +% to save macro expansions later. (LH)} +% There relate to |\pout_line| as |\out_lline| and |\out_llline| to +% |\out_line|. +% \begin{macrocode} +\edef\pout_lline#1#2{\noexpand\pout_line#1{\space\space\space#2}} +\edef\pout_llline#1#2{ + \noexpand\pout_line#1{\space\space\space\space\space\space#2} +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% \begin{macro}{\tempfileprefix} +% \begin{macro}{\temp_prefix} +% Selecting the directory for temporary files. +% +% \begin{macrocode} +\def\tempfileprefix#1{\def\temp_prefix{#1}} +\tempfileprefix{} +%</pkg> +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% \subsection{Conditionals} +% +% \subsubsection +% {Conditionals in \package{fontinst}} +% ^^A \subsubsection{Conditionals in fontinst} +% +% \begin{macro}{\then} +% \begin{macro}{\if_true} +% \begin{macro}{\if_false} +% In order to write macros that expand out to nested |\if|-statements, +% I say: +% \begin{quote} +% |\ifblah| \textellipsis\ |\then| \textellipsis\ |\else| +% \textellipsis\ |\fi| +% \end{quote} +% In order to match the |\fi|, |\then| has to be an |\if|. +% +% \begin{macrocode} +%<pkg|doc>\let\then=\iffalse +%<*pkg> +\def\if_false{\iffalse} +\def\if_true{\iftrue} +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} +% +% \begin{macro}{\if_defined} +% \begin{macro}{\if_undefined} +% \multchanges{\cs{if_defined}\cs{if_undefined}}{1.912} +% {2000/02/10}{Macro added. (LH)} +% These two macros are used as +% \begin{quote} +% |\if_defined|\marg{control sequence name}|\then|\\ +% |\if_undefined|\marg{control sequence name}|\then| +% \end{quote} +% The latter is functionally equivalent to +% \begin{quote} +% |\x_cs\ifx|\marg{control sequence name}|\x_relax| +% \end{quote} +% but it is shorter (1--3 tokens, depending on whether the +% unnecessary braces around \meta{control sequence name} are included +% or not). The former tests the same thing, but has true and false +% cases reversed. +% +% Apart from that it is shorter, another important reason for +% introducing these macros is that the \eTeX\ primitives +% |\ifcsname| and |\unless| provide a much better implementation than +% what is possible in normal \TeX. Therefore it is desirable to use +% these commands as much as possible, and by introducing these macros +% one can achieve this without having double definitions for more +% than these two macros. +% +% To avoid trouble with mismatched ifs and tokenizing control +% sequences special for \eTeX, |~| is temporarily made a comment +% character. I'm not sure |\ifcsname| and |\unless| weren't available +% in \eTeX\ versions before 2.0, but that's the oldest version I have +% a manual for. +% \multchanges{\cs{if_defined}\cs{if_undefined}}{1.914}{2000/05/13} +% {Automatically selecting between \protect\TeX\ and \eTeX\ +% definitions. (LH)} +% \multchanges{\cs{if_defined}\cs{if_undefined}}{1.927}{2003/12/11} +% {Modified \eTeX\ definitions to make them work with the +% crufty old ``unset is \cs{let} to \cs{relax}'' tradition +% of \package{fontinst} implementation. (LH) This was found +% to be a show-stopper for using v\,1.926 with \eTeX; +% Heiko Oberdiek found the cause of it.} +% \changes{1.927}{2004/08/07}{Fixed problem with \cs{unless}. (LH)} +% \begin{macrocode} +\_a_false\eTeX{2.0} +\if_a_\else \catcode`\~=14\x_relax \fi +% \end{macrocode} +% The following use of |\if| is a trick I learnt from the +% implementation of \package{docstrip}. |\if| will expand any amount of +% material until it has two unexpandable tokens to compare, hence one +% can use it to evaluate arbitrary boolean expressions in a single +% \TeX\ conditional, by expressing the expression as something which +% expands in \TeX's mouth to the value of the expression (either |0| +% or |1|). In this case the expression is ``the control sequence is +% defined and that definition is not \cs{relax}''. +% \begin{macrocode} +~ \def\if_defined#1\then{ +~ \if +~ \ifcsname#1\endcsname +~ \expandafter\ifx \csname#1\endcsname \x_relax +~ 0 +~ \else +~ 1 +~ \fi +~ \else +~ 0 +~ \fi +~ 1 +~ } +~ \def\if_undefined{\expandafter\unless\if_defined} +% \end{macrocode} +% \begin{macrocode} +\catcode`\~=\if_a_ 14 \else 10 \fi \x_relax +% \end{macrocode} +% \begin{macrocode} +~ \def\if_defined#1\then{ +~ \expandafter\ifx \csname#1\endcsname\x_relax +~ \expandafter\if_false +~ \else +~ \expandafter\if_true +~ \fi +~ } +~ \def\if_undefined#1\then{ +~ \expandafter\ifx \csname#1\endcsname\x_relax +~ } +% \end{macrocode} +% \begin{macrocode} +\catcode`\~=10\x_relax +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\gobble_if} +% It is sometimes best to skip both the then-part and +% the else-part of a conditional. |\gobble_if| does this by using the +% fact that expanding |\else| skips everything until the next matching +% |\fi| without looking for other |\else|s. +% \changes{1.900}{1998/12/11}{Macro added. (LH)} +% \changes{1.913}{2000/03/03}{Macro redefined; it now works entirely +% in the mouth. (LH)} +% \begin{macrocode} +\def\gobble_if{\iftrue\else} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\if_or} +% \begin{macro}{\or_else} +% |\if_or| \textellipsis\ |\or_else| \textellipsis\ |\then| gives the +% disjunction of two booleans. +% \begin{macrocode} +\def\if_or#1\or_else#2\then{ + #1\then + \expandafter\if_true + \else + #2\then + \expandafter\expandafter\expandafter\if_true + \else + \expandafter\expandafter\expandafter\if_false + \fi + \fi +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\if_equal} +% The |\if_equal| macro is a \textellipsis|\then|-style wrapper around the +% |\ifx| primitive. Its calling syntax is +% \begin{quote} +% |\if_equal|\meta{token1}\meta{token2}|\then| +% \end{quote} +% \changes{1.912}{2000/02/23}{Macro added. (LH)} +% \begin{macrocode} +\def\if_equal#1\then{\ifx#1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\if_file_exists} +% |\if_file_exists| checks to see if a file exits, using |\openin|. +% +% \begin{macrocode} +\def\if_file_exists#1\then{ + \immediate\openin1=#1\x_relax + \ifeof1\x_relax + \immediate\closein1 + \expandafter\if_false + \else + \immediate\closein1 + \expandafter\if_true + \fi +} +%</pkg> +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection +% {Conditionals in \package{fontdoc}} +% ^^A \subsubsection{Conditionals in fontdoc} +% +% \changes{1.909}{1999/10/16}{System for documenting both branches of +% \texttt{if} statements in ETX and MTX files added. (LH)} +% In order to get a reasonable documentation of branches in an ETX or +% MTX file, the code in both branches must be typeset and the positions +% of the if, the else, and the fi must be clearly marked. There seems to +% be no reasonable way to achieve this if the standard names for the +% else and fi are used. Therefore the alternative names |\Else| and +% |\Fi| for |\else| and |\fi| have been introduced, to be used as in +% for example +% \begin{quote} +% |\ifisint{monowidth}\then|\\ +% \vadjust{}\quad\meta{then-part}\\ +% |\Else|\\ +% \vadjust{}\quad\meta{else-part}\\ +% |\Fi| +% \end{quote} +% +% \begin{macro}{\Else} +% \begin{macro}{\Fi} +% By default, these are identical to their lowercase counterparts. +% \begin{macrocode} +%<*pkg|doc> +\let\Else=\else +\let\Fi=\fi +%</pkg|doc> +% \end{macrocode} +% \end{macro}\end{macro} +% +% The interesting part begins if the ETX or MTX file gives the command +% |\showbranches|, since this means (i) that it wants the branches to be +% shown and (ii) that it complies to a simple rule about where to use +% |\Else| and |\Fi|. The rule is as follows: If an \texttt{if} statement +% is of \package{fontinst} form (it uses |\then|), then it must be +% terminated by |\Fi|, and a possible else in the statement must be an +% |\Else|. If an \texttt{if} statement is \emph{not} of \package{fontinst} +% form (it has no |\then|), then it must be terminated by |\fi|, and a +% possible else in the statement must be an |\else|. Only the +% \package{fontinst} form \texttt{if} statements are affected by +% |\showbranches|. +% +% \begin{macro}{\showbranches} +% \begin{macro}{\generic@if} +% The |\showbranches| command changes the definitions of +% |\generic@if|, |\then|, |\Else|, and |\Fi| so that the branches of +% \texttt{if} statements will be made visible. |\generic@if| is used +% to implement all the \package{fontinst} form \texttt{if} statements +% in \package{fontdoc}. It is called as +% \begin{quote} +% |\generic@if|\marg{description} +% \end{quote} +% and this will by default expand to |\iftrue|, but after executing +% |\showbranches| it will instead typeset +% \begin{quote} +% If \meta{description} then +% \end{quote} +% and do a bit of additional housekeeping. +% +% \begin{macrocode} +%<*doc> +\def\generic@if#1{\iftrue} +% \end{macrocode} +% \begin{macrocode} +\newcommand\showbranches{% + \let\generic@if=\branches@if + \let\then=\x@relax + \let\Else=\branches@else + \let\Fi=\branches@fi +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\saved@slot@number} +% The |\saved@slot@number| is used for storing the value of +% |\slot@number| at the \texttt{if} until the |\Else|. Unlike +% |\slot@number|, it is always set locally. +% \begin{macrocode} +\newcount\saved@slot@number +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\branches@if} +% \begin{macro}{\branches@else} +% \begin{macro}{\branches@fi} +% \changes{1.916}{2001/01/25}{Commented out test which concatenates +% consecutive \cs{Fi}s, since that doesn't work together with the +% \texttt{IfBranch} environment. (LH)} +% \begin{macro}{\branches@type} +% \begin{macro}{\branches@par} +% The macros |\branches@if|, |\branches@else|, and |\branches@fi| +% contain the definitions of |\generic@if|, |\Else|, and |\Fi| +% respectively that are used when branches are to be shown. Their +% basic task is to typeset the texts |If #1 then|, |Else|, and |Fi| in +% an appropriate style and with appropriate spacing around. A +% complicating matter is however that |\slot@number| must have the +% same value at the beginning of the \textit{else} part as at the +% beginning of the \textit{then} part. To achieve this, the value of +% |\slot@number| is saved in |\saved@slot@number| at the \textit{if} +% and copied back at the \textit{else}. To make this work even with +% nested \textit{if}s, both the \textit{then} branch and the +% \textit{else} branch are enclosed in groups and +% |\saved@slot@number| is assigned locally. +% +% There are still some formatting issues to solve, however. In some +% cases it works best to put the text of adjacent \textit{if}, +% \textit{else}, or \textit{fi} in the same paragraph, and it must be +% possible to recognize those cases. This is done by looking at the +% macro |\branches@type|, which should expand to +% \begin{enumerate} +% \item[\texttt{0}] if the preceeding item was an \textit{if}, +% \item[\texttt{1}] if the preceeding item was an \textit{else} +% preceeded by an \textit{if}, +% \item[\texttt{2}] if the preceeding item was an \textit{else} +% not preceeded by an \textit{if}, +% \item[\texttt{3}] if the preceeding item was a \textit{fi}, +% \item[\texttt{4}] if it was anything else. +% \end{enumerate} +% |\branches@par| is used for resetting |\branches@type| to \texttt{4}. +% It is an auto-resetting definition of |\par|. +% +% \begin{macrocode} +\def\branches@if#1{% + \ifnum \branches@type=\tw@ + \begin{IfBranchDummy}% + \textit{ if #1 then}% + \else + \par + \ifFD@tight@\else \addvspace\medskipamount \fi + \noindent\textit{If #1 then}% + \fi + \saved@slot@number=\slot@number + \gdef\branches@type{0}% + \let\par=\branches@par +} +% \end{macrocode} +% \begin{macrocode} +\def\branches@else{% + \ifnum \branches@type=\z@ + \textit{ relax else}% + \gdef\branches@type{1}% + \else + \par + \end{IfBranch}% + \noindent\textit{Else}% + \gdef\branches@type{2}% + \fi + \global\slot@number=\saved@slot@number + \let\par=\branches@par +} +% \end{macrocode} +% \begin{macrocode} +\def\branches@fi{% + \ifnum \branches@type=\thr@@ + \expandafter\end \expandafter{\@currenvir}% + \expandafter\gdef \expandafter\FD@saved@fis + \expandafter{\FD@saved@fis \space fi}% + \else + \end{IfBranch}% + \gdef\FD@saved@fis{Fi}% + \fi + \gdef\branches@type{3}% + \let\par=\branches@par +} +% \end{macrocode} +% \begin{macrocode} +\gdef\branches@type{4} +% \end{macrocode} +% \begin{macrocode} +\def\branches@par{% + \@restorepar + \ifnum \branches@type=\thr@@ + \noindent\textit{\FD@saved@fis}\par + \else + \begin{IfBranch}% + \fi + \gdef\branches@type{4}% +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{environment}{IfBranch} +% \changes{1.916}{2001/01/09}{Environment added. (LH)} +% \changes{1.920}{2001/09/16}{Removed assignment to \cs{listparindent}. +% I don't know why it was there in the first place. (LH)} +% \begin{switch}{FD@tight@} +% \changes{1.916}{2001/01/09}{Switch added. (LH)} +% The branches of a conditional that is being shown are put in an +% \texttt{IfBranch} environment, to emphasize the branches as logical +% units in the file. Depending on the value of the \texttt{FD@tight@} +% switch, there are two different ways that the branches can be +% distinguished. In the non-tight setting (\texttt{FD@tight@} false), +% there is one |\medskip|\-|amount| of vertical space before and after +% the branch, but no indentation. In the tight setting (which is used +% for \meta{glyph commands} and \meta{slot commands}), there is no +% extra vertical space around the branch, instead it is indented by +% $1\,\mathrm{em}$. +% \begin{macrocode} +\newif\ifFD@tight@ +\newenvironment{IfBranch}{% + \list{}{% + \ifFD@tight@ + \setlength\topsep{\z@skip}% + \@beginparpenalty=\z@ + \@endparpenalty=\z@ + \setlength\leftmargin{1em}% + \else + \setlength\topsep{\medskipamount}% + \@beginparpenalty=-10% + \@endparpenalty=\@beginparpenalty + \setlength\leftmargin{\z@}% + \fi + \setlength\partopsep{\z@skip}% + \setlength\itemsep{\z@skip}% + \setlength\parsep{\z@ plus\p@}% + \setlength\rightmargin{\z@}% + \setlength\itemindent{\z@}% + }% + \item[]% +}{\endlist} +% \end{macrocode} +% \end{switch}\end{environment} +% +% \begin{environment}{IfBranchDummy} +% \changes{1.916}{2001/01/25}{Environment added. (LH)} +% In order to get the nesting right, each |\branches@else| command has +% to |\begin| a new environment, but if it is immediately followed by +% a |\branches@if| then that environment should not cause an +% indentation. In these cases the \texttt{IfBranchDummy} environment +% is used instead of \texttt{IfBranch}. +% \begin{macrocode} +\newenvironment{IfBranchDummy}{}{} +%</doc> +% \end{macrocode} +% \end{environment} +% +% +% \subsubsection{Miscellanea} +% +% \begin{macro}{\primitiveinput} +% +% If |\@@input| is defined, I'll assume it's the \LaTeX{} version +% of the \TeX{} |\input| primitive. I need this so that I can say +% |\expandafter\foo\primitiveinput|, which doesn't work with the +% \LaTeX{} version of |\input|. +% +% \begin{macrocode} +%<*pkg> +\x_cs\ifx{@@input}\x_relax + \let\primitiveinput=\input +\else + \let\primitiveinput=\@@input +\fi +% \end{macrocode} +% \end{macro} +% +% +% \DescribeMacro{\process_csep_list} +% The macro +% \begin{quote} +% |\process_csep_list|\marg{pretext}\meta{comma-sep~list}^^A +% |,\process_csep_list,| +% \end{quote} +% executes \meta{pretext}\marg{item} for every item in the +% \meta{comma-sep~list}. +% +% \begin{macro}{\process_csep_list} +% \begin{macrocode} +\def\process_csep_list#1#2,{ + \ifx\process_csep_list#2 + \expandafter\gobble_one + \else + \expandafter\identity_one + \fi{ + #1{#2} + \process_csep_list{#1} + } +} +%</pkg> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\print@csep@list} +% \textit{Use of this macro is now deprecated; use \cs{TypesetList} +% instead wherever possible.} The macro call +% \begin{quote} +% |\print@csep@list|\marg{format}\marg{list} +% \end{quote} +% prints the comma-separated list \meta{list} in math mode. +% \meta{format} can be used to set the style in which the list is +% printed, since it is executed in the beginning of the same group as +% in which the list is printed. +% +% The formating is based on changing the |\mathcode| of comma to +% |"8000| so that the comma can be used as if it was an active character +% without actually having to be one. +% \begin{macrocode} +%<*doc> +\begingroup + \catcode`\,=13 + \gdef\print@csep@list#1#2{% + $% + \ifnum "8000=\mathcode`\,\else + \mathchardef\private@comma=\mathcode`\,% + \mathcode`\,="8000\x@relax + \fi + #1% + \let,=\active@comma + #2% + $% + } +\endgroup +\def\active@comma{\private@comma \penalty\binoppenalty} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% +% \subsection{Real numbers} +% +% \TeX's \meta{number}s are merely integers, but \package{fontinst} +% needs to store and calculate with numerical entities (most of which +% are lengths) that are intrinsically real numbers. Most of the time, +% \package{fontinst} does this by using a representation of real numbers +% by integers in which a real number $x$ is represented by the integer +% that $1000x$ gets rounded to. This representation has proved +% sufficiently precise for most purposes. +% +% There are however a few cases in which real numbers must be delt with +% in a more general fashion. Generic routines for this appear in this +% subsection. +% +% \begin{macro}{\make_factor} +% \changes{1.903}{1999/05/13}{Macro added. (LH)} +% The |\make_factor| macro is meant to be used in the context +% \begin{quote} +% |\make_factor|\marg{number} +% \end{quote} +% where \meta{number} can be any legal \TeX\ number. It expands to +% the same number divided by 1000, with decimals, so that what it +% expands to matches the regular expression +% \begin{quote} +% |-?[0-9]+\.[0-9][0-9][0-9]| +% \end{quote} +% +% More specifically, |\make_factor| has two tasks to perform: it takes +% care of the sign, so that its subsidary macros need only work with +% unsigned numbers, and it converts the \meta{number} (which could +% well be a countdef or mathchardef token) to a sequence of digits. +% \begin{macrocode} +%<*pkg> +\def\make_factor#1{ + \ifnum #1<\z@ + -\expandafter\make_factor_i\expandafter{\number-#1} + \else + \expandafter\make_factor_i\expandafter{\number#1} + \fi +} +% \end{macrocode} +% +% \begin{macro}{\make_factor_i} +% |\make_factor_i| distinguishes between the two main cases of +% numbers that in absolute value are less than 1000 and numbers that +% in absolute value are greater than or equal to 1000. In the former +% case, zeros need to be inserted. In the latter case, some number +% of digits need to be stepped over before the decimal point can be +% inserted. +% \begin{macrocode} +\def\make_factor_i#1{ + \ifnum #1<\one_thousand + \make_factor_ii{#1} + \else + \make_factor_iii #1 + \fi + #1 +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\make_factor_ii} +% |\make_factor_ii| inserts extra zeros, in the extent it is +% needed. +% \begin{macrocode} +\def\make_factor_ii#1{ + 0. + \ifnum #1<\one_hundred + 0 + \ifnum #1<10~ 0\fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\make_factor_iii} +% |\make_factor_iii| steps over one digit and checks if this is the +% correct position for the decimal point. Note that |#2#3| is +% exactly the digits in the number that has not been stepped over. +% Also note that comparision with |#2#3| would not work, since |#2| +% can be |0|. +% \begin{macrocode} +\def\make_factor_iii#1#2#3\fi#4{ + \fi + #4 + \ifnum 1#3<\one_thousand + . + \else + \make_factor_iii#2#3 + \fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% It also happens that real numbers are represented by dimens, in the +% common way that the number 1 is represented by the dimen 1\,pt. For +% those cases the following macro is indispensable. +% +% \begin{macro}{\lose_measure} +% Get rid of a trailing |pt| when converting dimension. +% \begin{macrocode} +{ + \catcode`\p=12 + \catcode`\t=12 + \gdef\lose_measure#1pt{#1} +} +%</pkg> +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Error, warning, and info messages} +% +% The code in this subsection is an adaptation of code from the +% \LaTeX\ kernel---more precisely from the source file +% \texttt{lterror.dtx}---and the same is true for some of the comments. +% As authors of that code are listed Johannes Braams, David Carlisle, +% Alan Jeffrey, Leslie Lamport, Frank Mittelbach, Chris Rowley, and +% Rainer Sch\"opf. The original source can be found in the file +% \texttt{lterror.dtx} in the \texttt{macros}\slash\texttt{latex}\slash +% \texttt{base} directory in any of the Comprehensive \TeX\ Archive +% Network FTP sites.\footnote{As if anyone who has managed to get this +% far didn't already know that!} +% +% That should have fulfilled the conditions in the LPPL.^^A +% \changes{1.906}{1999/07/23}{Adaptation of \LaTeX's message system +% completed. (LH)} +% \par\bigskip +% +% +% \subsubsection{General commands} +% +% \begin{macro}{\messagebreak} +% This command prints a new-line inside a message, followed by a +% continuation whose exact appearence may depend on the context. +% Normally this command is defined to be |\relax|, but inside messages +% it gets redefined to a linebreak (|^^J|) followed by the appropriate +% continuation. +% \changes{1.909}{1999/10/16}{New name for \cs{message_break}. (LH)} +% \begin{macrocode} +%<pkg>\let\messagebreak\x_relax +%<doc>\let\messagebreak\space +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\generic_info} +% This takes two arguments: a continuation and a message, and sends +% the result to the log file. +% \begin{macrocode} +%<*pkg> +\def\generic_info#1#2{ + \begingroup + \def\messagebreak{^^J#1} + \immediate\write\m@ne{#2\on_line.} + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\generic_warning} +% This takes two arguments: a continuation and a message, and sends +% the result to the screen. +% \begin{macrocode} +\def\generic_warning#1#2{ + \begingroup + \def\messagebreak{^^J#1} + \immediate\write\closed_stream{^^J#2\on_line.^^J} + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\generic_error} +% ``This macro takes four arguments: a continuation, +% an error message, where to go for further information, and the help +% information. It displays the error message, and sets the error help +% (the result of typing |h| to the prompt), and does a horrible hack +% to turn the last context line (which by default is the only context +% line) into just three dots. This could be made more efficient.'' +% +% Thus far the \LaTeX\ comments, but the horrible hack it mensions +% has been removed since it just makes things look strange when +% |\errorcontextlines| is larger than one. +% ^^A What the hack actually does is that it turns +% ^^A as much as possible of the topmost context line to spaces. It has +% ^^A two ways of achieving this. The first is to make the context line +% ^^A too long to display in full, by ending the argument of |\errmessage| +% ^^A with the control sequence +% ^^A \begin{quote} +% ^^A \tiny\verb*+\@err@ +^^A +% ^^A \verb*+ + +% ^^A \end{quote} +% ^^A As its name ends with a long sequence of spaces, it won't be visible; +% ^^A the |@err@| appears in the |...| part of the line. The other method +% ^^A it uses is to turn every token in the context line that is not part +% ^^A of a control sequence name to spaces (as characters, not in +% ^^A category) through a |\lowercase| trick. The only characters that +% ^^A cannot be turned into spaces this way are the three continuation +% ^^A dots. +% The ``where to go for further information'' message is currently not +% used (it is commented out in |\fontinsterror| below), since there +% is no good place to refer to anyway. If the documentation is ever +% improved in this respect, it would of course be best to reinsert +% this message. Note however that unlike the case in \LaTeX, this +% message should end with a |^^J|. +% +% A complication is that \TeX\ versions older than 3.141 have a bug +% which causes |^^J| to not force a linebreak in |\message| and +% |\errmessage| commands. So for these old \TeX's we use a |\write| to +% produce the message, and then have an empty |\errmessage| command. +% This causes an extra line of the form +%\begin{verbatim} +%! . +%\end{verbatim} +% to appear on the terminal, but if you do not like it, you can always +% upgrade your \TeX! +% +% Since I don't think many \package{fontinst} users use such old +% \TeX s, I removed \LaTeX's test for \TeX\ version at this point. The +% code for old \TeX s is still there, but it lies in a \package{docstrip} +% module of its own. +% +% First the `standard case'. +% \begin{macrocode} +%<*!oldTeX> +\def\generic_error#1#2#3#4{ + \begingroup + \immediate\write\closed_stream{} + \def\messagebreak{^^J} + \edef\a_macro{{#4}} + \errhelp\a_macro + \def\messagebreak{^^J#1} + \errmessage{#2.^^J^^J#3 + Type~\space H~<return>~\space for~immediate~help + } + \endgroup +} +%</!oldTeX> +% \end{macrocode} +% +% Secondly the version for old \TeX's. +% \begin{macrocode} +%<*oldTeX> +\def\generic_error#1#2#3#4{% + \begingroup + \immediate\write\closed_stream{} + \def\messagebreak{^^J} + \edef\a_macro{{#4}} + \errhelp\a_macro + \def\messagebreak{^^J#1} + \immediate\write\closed_stream{!~#2.^^J^^J#3^^J + Type~\space H~<return>~\space for~immediate~help. + } + \errmessage{} + \endgroup +} +%</oldTeX> +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\fontinsterror} +% \changes{1.909}{1999/10/16}{New name for \cs{fontinst_error}. (LH)} +% \begin{macro}{\fontinstwarning} +% \changes{1.909}{1999/10/16}{New name for \cs{fontinst_warning}. (LH)} +% \begin{macro}{\fontinstwarningnoline} +% \changes{1.909}{1999/10/16}{New name for +% \cs{fontinst_warning_no_line}. (LH)} +% \begin{macro}{\fontinstinfo} +% \changes{1.909}{1999/10/16}{New name for \cs{fontinst_info}. (LH)} +% These commands are intended for giving a uniformed, and for the +% programmers hopefully simplified, form of error, warning, and info +% messages. The syntax is: +% \begin{quote} +% |\fontinsterror|\marg{subsystem}\marg{error}\marg{help}\\ +% |\fontinstwarning|\marg{subsystem}\marg{warning}\\ +% |\fontinstwarningnoline|\marg{subsystem}\marg{warning}\\ +% |\fontinstinfo|\marg{subsystem}\marg{info} +% \end{quote} +% A \meta{subsystem} in this context is intended to be some piece of +% text which identifies some functionally clearly defined part of +% \package{fontinst}. Examples of \meta{subsystem}s could be +% \texttt{PL to MTX converter}, \texttt{Ligful (V)PL writer}, and +% \texttt{Latin family}. +% +% The |\fontinsterror| command prints the \meta{error} message, and +% presents the interactive prompt; if the user types |h|, then the +% \meta{help} information is displayed. The |\fontinstwarning| +% command produces a warning but does not present the interactive +% prompt. The |\fontinstwarningnoline| command does the same, but +% doesn't print the input line number. The |\fontinstinfo| command +% writes the message to the |log| file. Within the messages, the +% command |\messagebreak| can be used to break a line and |\space| is +% a space, for example: +% \begin{verbatim} +% \def\foo{FOO} +% \fontinstwarning{Hungarian}{ +% Your~hovercraft~is~full~of~eels,\messagebreak +% and~\string\foo\space is~\foo} +% \end{verbatim} +% produces: +% \begin{verbatim} +% Hungarian warning: +% Your hovercraft is full of eels, +% and \foo is FOO on input line 54. +% \end{verbatim} +% +% \begin{macrocode} +\def\fontinsterror#1#2#3{ + \generic_error{ + \four_spaces\four_spaces + }{ + #1~error:\messagebreak #2 + }{ +% See~the~#1~package~documentation~for~explanation.^^J + }{#3} +} +% \end{macrocode} +% \begin{macrocode} +\def\fontinstwarning#1#2{ + \generic_warning{ + \four_spaces\four_spaces + }{ + #1~warning:\messagebreak #2 + } +} +% \end{macrocode} +% \begin{macrocode} +\def\fontinstwarningnoline#1#2{ + \fontinstwarning{#1}{#2\gobble_one} +} +% \end{macrocode} +% \begin{macrocode} +\def\fontinstinfo#1#2{ + \generic_info{ + \four_spaces\four_spaces + }{ + #1~info:\messagebreak #2 + } +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\def\fontinsterror#1#2#3{% + \Bheading{Error} observed by #1:% + \begin{quote}#2.\end{quote}% +} +% \end{macrocode} +% \begin{macrocode} +\def\fontinstwarning#1#2{ + \Bheading{Warning} from #1:% + \begin{quote}#2.\end{quote}% +} +% \end{macrocode} +% \begin{macrocode} +\let\fontinstwarningnoline=\fontinstwarning +% \end{macrocode} +% \begin{macrocode} +\def\fontinstinfo#1#2{ + \Bheading{Info} from #1:% + \begin{quote}#2.\end{quote}% +} +%</doc> +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\on_line} +% The message ` on input line~$n$'. \LaTeX\ has special code for +% \TeX~2, but since \package{fontinst} has assumed the existence of +% the |\errorcontextlines| parameter since v\,1.500, the removal of +% that code shouldn't cause problems for anyone who wasn't already +% having related problems. +% +% \begin{macrocode} +%<*pkg> +\def\on_line{~on~input~line~\the\inputlineno} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\four_spaces} +% Four spaces. Using |\edef| (rather than |\def| as in \LaTeX) to +% save some macro expansions. +% \begin{macrocode} +\edef\four_spaces{\space\space\space\space} +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{Specific errors} +% +% \begin{macro}{\error_help_a} +% \begin{macro}{\error_help_c} +% \begin{macro}{\error_help_d} +% \begin{macro}{\error_help_e} +% \changes{1.912}{2000/02/12}{Macro added. (LH)} +% The more common error help messages. The first three are called +% |\@eha|, |\@ehc|, and |\@ehd| in \LaTeX. |\@ehb| is of no use for +% \package{fontinst}, so it has been omitted. |\error_help_e| is a +% new one for \package{fontinst}. +% \begin{macrocode} +\gdef\error_help_a{ + Your~command~was~ignored.\messagebreak + Type~\space I~<command>~<return>~\space to~replace~it~ + with~another~command,\messagebreak + or~\space <return>~\space to~continue~without~it.} +\gdef\error_help_c{ + Try~typing~\space <return>~ + \space to~proceed.\messagebreak + If~that~doesn't~work,~type~\space X~<return>~\space to~quit.} +\gdef\error_help_d{ + You're~in~trouble~here.~\space\error_help_c} +\def\error_help_e#1{You~can~continue,~but~the~#1~wrong.} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% +% \subsubsection{\TeX\ parameters} +% +% \multchanges{\cs{newlinechar}\cs{errorcontextlines}}{1.914} +% {2000/05/20}{Moved to error message subsection. (LH)} +% \begin{macro}{\newlinechar} +% Set |\newlinechar| for |\errhelp| messages. +% \begin{macrocode} +\newlinechar=`\^^J +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\errorcontextlines} +% By default, show as much error info as you can. +% (We assume \package{fontinst} users are \TeX{}perts.) +% \begin{macrocode} +\errorcontextlines=999 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tracinglostchars} +% \changes{1.915}{2000/07/31}{Added setting this parameter. (LH)} +% Make |\tracinglostchars| positive---this will simplify catching +% bugs, as many \package{fontinst} bugs show up in that output is +% being generated, but that used to disappear silently when +% \package{fontinst} was run under Ini\TeX. +% \begin{macrocode} +\tracinglostchars=1 +%</pkg> +% \end{macrocode} +% \end{macro} +% +% \Finale +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/source/fontinst/base/ficommon.dtx b/Master/texmf-dist/source/fontinst/base/ficommon.dtx new file mode 100644 index 00000000000..3127c25cbe5 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/ficommon.dtx @@ -0,0 +1,2415 @@ +% \CheckSum{2283} +% \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. +% +% 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.2 or, at your option, any later version. +% +%%% From file: ficommon.dtx +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{fisource} +\title{The \package{fontinst} utility} +\author{Alan Jeffrey, Sebastian Rahtz, Ulrik Vieth, Lars Hellstr\"om} +\begin{document} +\maketitle +\tableofcontents +\DocInput{ficommon.dtx} +\end{document} +%</driver> +% \fi +% +% \StopEventually{} +% +% +% \section{General commands} +% \changes{1.916}{2000/12/27}{Moved Section \thesection\ to +% \texttt{ficommon.dtx}. (LH)} +% +% \changes{1.916}{2001/01/02}{\emph{Major} overhaul of \package{fontdoc} +% mechanisms for integer and string expressions completed. (LH)} +% There are roughly five types of arguments that \package{fontinst} +% commands can take. These are +% \begin{itemize} +% \item integer expressions, +% \item string expressions, +% \item dimensions, +% \item commands (i.e., \TeX\ control sequences), and +% \item other (pretty much ``none of the above''). +% \end{itemize} +% The most common form of an integer expression is simply a \TeX\ +% \meta{number} and the most common form of a string expression is +% simply a sequence of character tokens, but there are more complicated +% forms. Dimensions are simply \TeX\ \meta{dimen}s; their use is rather +% limited. Common to integer expressions, string expressions, and +% dimensions is that these argument types get expanded during +% evaluation (in the case of string expressions, this expansion +% \emph{is} the evaluation), which means one can use macros in +% arguments of these types. +% +% Command arguments do not get expanded---they are mainly used with +% commands that modify the definitions of other commands. As for the +% ``other'' arguments one cannot give any rules: they might get +% expanded, but it could also happen that they won't. +% +% +% \subsection{String expressions} +% +% The first problem with string expressions is to typeset the values. +% The character strings that appear in ETX and MTX files usually consist +% only of immediately printable characters, but there are a few +% characters (such as underscore) which may be used even though they +% aren't directly printable. This subsection defines commands which deal +% with this problem by replacing non-printable characters by commands. +% The implementation is based on the implementation of the +% |\MakeHarmless| command in the \package{xdoc} package. +% +% \subsubsection{Typesetting problematic characters} +% +% \begin{macro}{\PrintChar} +% \begin{macro}{\InvisibleCharPrefix} +% \begin{macro}{\InvisibleCharSuffix} +% The |\PrintChar| command has the syntax +% \begin{quote} +% |\PrintChar|\marg{8-bit number} +% \end{quote} +% where \meta{8-bit number} is a \TeX\ number in the range 0--255. +% For arguments in the range 0--31, |\PrintChar| prints +% `\textit{\ttfamily\string^\string^@}'--`\textit{\ttfamily +% \string^\string^_}'. For an argument in the range 32--126, +% |\PrintChar| calls |\Print|\-|Visible|\-|Char| which typesets the +% corresponding ASCII character (similar to |\char|, but it takes the +% path via the \LaTeX\ internal representation so that it works with +% non-typewriter \texttt{OT1} fonts); in particular, |\PrintChar{32}| +% prints a ``visible space'' character. |\PrintChar{127}| prints +% `\textit{\ttfamily\string^\string^?}'. For arguments in the range +% 128--255, |\PrintChar| prints +% `\textit{\ttfamily\string^\string^80}'--`\textit{\ttfamily +% \string^\string^ff}'. +% The |\PrintChar| command is robust. +% +% The macros |\InvisibleCharPrefix| and |\InvisibleCharSuffix| begin +% and end a |^^|-sequence. |\InvisibleCharPrefix| should print the +% actual |^^|, but it may also for example select a new font for +% the |^^|-sequence (such font changes are restored at the end of +% |\PrintChar|). +% \begin{macrocode} +%<*doc> +\DeclareRobustCommand\PrintChar[1]{% + \leavevmode + \begingroup + \count@=#1\relax + \ifnum \@xxxii>\count@ + \advance \count@ 64% + \InvisibleCharPrefix + \PrintVisibleChar\count@ + \InvisibleCharSuffix + \else\ifnum 127>\count@ + \PrintVisibleChar\count@ + \else + \InvisibleCharPrefix + \ifnum 127=\count@ \PrintVisibleChar{63}\else + \@tempcnta=\count@ + \divide \count@ \sixt@@n + \@tempcntb=\count@ + \multiply \count@ \sixt@@n + \advance \@tempcnta -\count@ + \advance \@tempcntb \ifnum 9<\@tempcntb 87\else 48\fi + \advance \@tempcnta \ifnum 9<\@tempcnta 87\else 48\fi + \char\@tempcntb \char\@tempcnta + \fi + \InvisibleCharSuffix + \fi\fi + \endgroup +} +% \end{macrocode} +% \begin{macrocode} +\newcommand\InvisibleCharPrefix{% + \/\em + \PrintVisibleChar{`\^}\PrintVisibleChar{`\^}% +} +\newcommand\InvisibleCharSuffix{\/} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\PrintVisibleChar} +% The |\PrintVisibleChar| command should print the visible ASCII +% character whose character code is given in the argument. The +% definition given here translates every character code to the +% corresponding \LaTeX\ internal representation, which is necessary +% if the current font is e.g.\ an \texttt{OT1}-encoded non-typewriter +% font. If the current font is known to be \texttt{T1}-encoded then +% one can do just as well with |\char#1 | as the replacement text. +% \begin{macrocode} +\newcommand\PrintVisibleChar[1]{% + \ifcase #1% + \or\or\or\or\or\or\or\or \or\or\or\or\or\or\or\or + \or\or\or\or\or\or\or\or \or\or\or\or\or\or\or\or + % "20 + \textvisiblespace \or!\or\textquotedbl \or\#\or\textdollar + \or\%\or\&\or\textquoteright\or(\or)\or*\or+\or,\or-\or.\or/% + \or % "30 + 0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or:\or;\or + \textless\or=\or\textgreater\or?% + \or % "40 + @\or A\or B\or C\or D\or E\or F\or G\or + H\or I\or J\or K\or L\or M\or N\or O% + \or % "50 + P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\or [\or + \textbackslash \or]\or\textasciicircum \or\textunderscore + \or % "60 + \textquoteleft \or a\or b\or c\or d\or e\or f\or g\or h\or + i\or j\or k\or l\or m\or n\or o% + \or % "70 + p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\or + \textbraceleft \or\textbar \or\textbraceright \or\textasciitilde + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\textvisiblespace} +% The |\textvisiblespace| command, which is heavily used in names of +% coding schemes, unfortunately has a default definition which lacks +% leading on the right side. This redefinition attempts to improve +% things. +% \changes{1.921}{2002/03/27}{Redefinition added. (LH)} +% \begin{macrocode} +\DeclareTextCommandDefault{\textvisiblespace}{% + \makebox[\fontdimen\tw@\font]{% + \hfil + \vrule \@height.3ex% + \vbox{\hrule \@width .66\fontdimen\tw@\font}% + \vrule \@height.3ex% + \hfil + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\FD@quoted@PrintChar} +% One sometimes wants to use a printable character string as part of a +% control sequence name. If the normal definition of |\PrintChar| is +% in force at such times then each |\PrintChar| in the string would +% produce lots of errors, which is why |\FD@quoted@PrintChar| has +% been defined. This macro is an alternative definition of +% |\PrintChar| which expands to |"|\meta{number}|"|, which can be part +% of a macro name. +% \begin{macrocode} +\def\FD@quoted@PrintChar#1{"\number#1"} +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{Converting character strings} +% +% Replacing all problematic characters with |\PrintChar| calls certainly +% makes the strings easier to manage, but actually making those +% replacements is a rather complicated task. This subsubsection +% contains the macros necessary for doing these replacements. +% +% The first problem is how to efficiently recognise the problematic +% characters. One might think that it is sufficient to look at their +% |\catcode|, but that will fail for characters like |<| whose normal +% catcode is 12 but do not appear in the \texttt{OT1} encoding. Because +% of this, I have chosen a brute strength solution: build a table +% (indexed by character code) that gives the printable form of +% every character. This table is stored in the +% \describecsfamily{FD@printable@\meta{code}}^^A +% |\FD@printable@|\meta{code} family of control sequences, where the +% \meta{code} is in the range |32|--|126|. The printable form of +% characters outside this range is always the |\PrintChar| form. +% \begin{macrocode} +\count@=32 +\begingroup + \catcode\z@=12\relax + \@firstofone{% +\endgroup + \loop + \if \ifnum 11=\catcode\count@ 1\else \ifnum 12=\catcode\count@ + 1\else 0\fi\fi 1% + \uccode\z@=\count@ + \uppercase{\def\@tempa{^^@}}% + \else + \edef\@tempa{\noexpand\PrintChar{\the\count@}}% + \fi + \x@cs\let{FD@printable@\the\count@}=\@tempa + \advance \count@ \@ne + \ifnum 127>\count@ \repeat +} +% \end{macrocode} +% This loop hasn't caught all non-printable characters, so a few +% entries have to be set explicitly. +% \begin{macrocode} +\@namedef{FD@printable@34}{\PrintChar{34}} % " +\@namedef{FD@printable@60}{\PrintChar{60}} % < +\@namedef{FD@printable@62}{\PrintChar{62}} % > +% \end{macrocode} +% +% +% \begin{macro}{\MakePrintable} +% To render a character string harmless, you do +% \begin{quote} +% |\MakePrintable|\marg{macro}\marg{flag}\marg{string} +% \end{quote} +% This locally assigns to \meta{macro} the printable character string +% which corresponds to \meta{string}. Furthermore the control sequence +% |\if|\meta{flag} is locally let to |\iftrue| or |\iffalse| +% depending on whether the printable string is simple (only consists +% of character tokens and |\PrintChar| commands) or not. +% +% During the conversion the converted part of the string is stored in +% |\toks@| and the |@tempswa| switch keeps track of whether the string +% so far is simple (yes when |false|), but those are both local to +% |\MakePrintable|. +% \begin{macrocode} +\def\MakePrintable#1#2#3{% + \begingroup + \toks@={}% + \escapechar=`\\% + \@tempswafalse + \FD@printable@#3\protect\FD@printable@ + \toks@=\expandafter{% + \expandafter\let \csname if#2\expandafter\endcsname + \csname if\if@tempswa false\else true\fi \expandafter\endcsname + \expandafter\def \expandafter#1\expandafter{\the\toks@}% + }% + \expandafter\endgroup \the\toks@ +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\FD@printable@iii} +% \begin{macro}{\FD@printable@iv} +% \begin{macro}{\FD@printable@v} +% \begin{macro}{\FD@printable@vi} +% What one has to be most careful about when making strings printable +% are the space tokens, since many of \TeX's primitives gladly +% snatches an extra space (or more) where you don't want them to in +% this case. Macro parameters can be particularly dangerous, as \TeX\ +% will skip any number of spaces while looking for the replacement +% text for an undelimited macro argument. Therefore the algorithm for +% rendering a character token harmless consists begins +% (|\FD@printable@iii|) with |\string|ing the next token in the +% string---this preserves the character code and sets the category to +% 12 for all characters except the ASCII space, which gets category 10 +% (space)---and then |\futurelet| is used to peek at the next token. If +% it is a space token (|\FD@printable@iv|) then the character code +% is 32 and the actual space can be gobbled (|\FD@printable@v|), and +% if it isn't then the next token can be grabbed in a undelimited macro +% argument (|\FD@printable@vi|). In either case, the harmless form +% is given by the |\FD@printable@|\meta{code} table entry +% (in |\FD@printable@v| or |\FD@printable@vi|). +% \begin{macrocode} +\def\FD@printable@iii{% + \expandafter\futurelet \expandafter\@let@token + \expandafter\FD@printable@iv \string +} +% \end{macrocode} +% \begin{macrocode} +\def\FD@printable@iv{% + \ifx \@let@token\@sptoken + \expandafter\FD@printable@v + \else + \expandafter\FD@printable@vi + \fi +} +% \end{macrocode} +% ^^A Hack: +% \begingroup +% \expandafter\def \expandafter\MakePrivateLetters \expandafter{^^A +% \MakePrivateLetters +% \catcode`3=11 +% \catcode`2=11 +% } +% \begin{macrocode} +\begingroup + \catcode`3=\catcode`a + \catcode`2=\catcode`a + \@firstofone{\gdef\FD@printable@v} {% + \toks@=\expandafter{\the \expandafter\toks@ \FD@printable@32}% + \FD@printable@ + } +\endgroup +% \end{macrocode} +% \endgroup +% \begin{macrocode} +\def\FD@printable@vi#1{% + \if \ifnum `#1<\@xxxii 1\else \ifnum `#1>126 1\else 0\fi\fi 1% + \toks@=\expandafter{\the\expandafter\toks@ + \expandafter\PrintChar \expandafter{\number`#1}% + }% + \else + \toks@=\expandafter{\the\expandafter\expandafter\expandafter\toks@ + \csname FD@printable@\number`#1\endcsname}% + \fi + \FD@printable@ +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\FD@printable@} +% \begin{macro}{\FD@printable@i} +% \begin{macro}{\FD@printable@ii} +% \begin{macro}{\FD@printable@vii} +% But that is not all |\MakePrintable| can do. One must also deal +% with things in the string that are not simply characters, but more +% complex items (for example |\str| and |\strint| constructions). When +% control sequences that start such complex items are fed to +% |\MakePrintable| they must be preceeded by a |\protect| (they will +% be if the original command is defined using \LaTeX's +% |\Declare|\-|Robust|\-|Command| command and the string has been fed +% through a |\protected@edef|, which happens to be the case); this +% |\protect| is taken as a signal that the next token should get +% special processing. Control sequences that are not preceeded by a +% |\protect| are simply |\string|ed. +% +% To accommodate for this, |\FD@printable@| (which is the first step +% in converting a token) always begins by checking (in |\FD@|\-^^A +% |printable@i|) whether the next token is a control sequence. If it +% is and that control sequence is |\protect| then it is checked (in +% |\FD@printable@ii|) whether the control sequence +% \describecsfamily{FD@printable\PrintChar{`\\}\meta{cs-name}}^^A +% |\FD@printable\|\meta{cs-name}, where \meta{cs-name} is the name +% without |\| (and with any spaces removed) of the control sequence +% encountered, is defined. If it is defined then control is handed +% over to |\FD@printable\|\meta{cs-name} which should process the +% arguments (if any) of |\|\meta{cs-name} and add a suitable +% representation to |\toks@|, but if |\FD@printable\|\meta{cs-name} +% isn't defined then this is considered to be an error. +% +% If the next token isn't a control sequence then control is handed +% over to |\FD@printable@ii|. If the next token is a control sequence +% but not |\protect| then that token is |\string|ed (in +% |\FD@printable@vii|) and control is handed over to +% |\FD@printable@vi|. +% \begin{macrocode} +\def\FD@printable@{\futurelet\@let@token \FD@printable@i} +% \end{macrocode} +% \begin{macrocode} +\def\FD@printable@i{% + \csname FD@printable@% + \ifcat \noexpand\@let@token \noexpand\FD@printable@ + \ifx \@let@token\protect ii\else vii\fi + \else iii\fi + \endcsname +} +% \end{macrocode} +% \begin{macrocode} +\def\FD@printable@ii\protect#1{% + \@ifundefined{FD@printable\expandafter\zap@space\string#1 \@empty}{% + \PackageError{fontdoc}{Command \protect#1 not allowed in string}% + \@eha + }{\csname FD@printable\expandafter\zap@space\string#1 \@empty + \endcsname}% +} +% \end{macrocode} +% \begin{macrocode} +\def\FD@printable@vii{\expandafter\FD@printable@vi \string} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\FD@printable\FD@printable@} +% A control sequence |\FD@printable\|\meta{cs-name} is responsible for +% interpreting the string item that begins with the control sequence +% |\|\meta{cs-name} and appending a printable representation of it to +% |\toks@|. Normal |\FD@printable\|\meta{cs-name} control sequences +% must also end by inserting |\FD@printable@| in front of what remains +% of the string after the complex string item has been removed. This +% sees to that the rest of the string is also made printable. The only +% such control sequence which does not insert |\FD@printable@| is +% |\FD@printable\FD@printable@|, but that is as it should be since +% |\MakePrintable| itself appends a |\FD@printable@| to every character +% string it should convert to mark the end of it. +% \begin{macrocode} +\expandafter\let + \csname FD@printable\string\FD@printable@\endcsname \@empty +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\FD@printable\PrintChar} +% It is occasionally convenient to use a |\PrintChar| command as part +% of a string that is to be made harmless instead of using the raw +% character. The definition is very similar to that of +% |\FD@printable@vi|. +% \begin{macrocode} +\@namedef{FD@printable\string\PrintChar}#1{% + \if \ifnum #1<\@xxxii 1\else \ifnum #1>126 1\else 0\fi\fi 1% + \toks@=\expandafter{\the\expandafter\toks@ + \expandafter\PrintChar \expandafter{\number#1}% + }% + \else + \toks@=\expandafter{\the\expandafter\expandafter\expandafter\toks@ + \csname FD@printable@\number#1\endcsname}% + \fi + \FD@printable@ +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\ExpandAndMakePrintable} +% The |\ExpandAndMakePrintable| command is an abbreviation for a +% common use of |\MakePrintable|, namely to first feed the string +% through a |\protected@edef| to get rid of all the simple macros. +% \begin{macrocode} +\newcommand*\ExpandAndMakePrintable[3]{% + \protected@edef\@tempa{{#2}{#3}}% + \expandafter\MakePrintable \expandafter#1\@tempa +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{Evaluating string expressions} +% +% In string expressions, the only available operation is juxtaposition +% (fancy name for putting things next to each other) and thus the +% syntax for a string expression is +% \begin{quote} +% \meta{string expression} \(\longrightarrow\) $\emptyset \mid$ +% \meta{string atom}\meta{string expression} +% \end{quote} +% where $\emptyset$ denotes the empty string. A \meta{string atom} is +% one of +% \begin{quote} +% \meta{character token}\\ +% |\str|\marg{string expression}\\ +% |\strint|\marg{string expression} +% \end{quote} +% The meaning of a \meta{character token} is explained +% in~\cite{TeXbook}. The |\str| and |\strint| forms of +% \marg{string atom} refer to the respective values of the string and +% integer variables (see Subsection~\ref{Ssec:Variables}) whose names +% are given in the argument of |\str| or |\strint| respectively. Since +% the names of variables are themselves string expressions, |\str| and +% |\strint| may themselves be used in names of variables. +% +% It should be noted that most of \package{fontinst}'s string +% expressions sooner or later end up between a |\csname| and the +% corresponding |\endcsname|. This places significant restrictions on +% what may occur in string expressions. +% +% \begin{macro}{\str} +% \begin{macro}{\strint} +% \changes{1.909}{1999/10/19}{Change to stop it from gobbling a +% following space if the integer is stored in a macro. (LH)} +% In \package{fontinst} the only macros needed for dealing with string +% expressions are |\str| and |\strint|. +% \begin{macrocode} +%<*pkg> +\def\str#1{\csname~s-#1\endcsname} +\def\strint#1{\expandafter\identity_one\expandafter{\number\int{#1}}} +%</pkg> +% \end{macrocode} +% \end{macro}\end{macro} +% +% \package{fontdoc} mainly uses \TeX's text mode for typesetting string +% expressions because not all characters are available in math mode; +% it's easier to switch to text mode than to augment the math setup. One +% kind of material is however typeset in math mode, namely +% ``string-valued functions'': the name and functional parenthesis of +% such material is typeset in math mode to get a mathematical look. +% +% \begin{macro}{\FD@string@func} +% The |\FD@string@func| macro has the syntax +% \begin{quote} +% |\FD@string@func|\marg{name}\marg{argument} +% \end{quote} +% It is used for typesetting the \meta{name}$($\meta{argument}$)$ of a +% string-valued function (e.g.\ the value-of-string-variable function +% $\mathrm{s}$). It should only be used in horizontal mode. +% +% |\FD@string@func| includes a bit of extra spacing around the typeset +% text, but not at the beginning or end of a string and neither +% between two string-valued functions. As a flag for this is used +% that the value of |\spacefactor| is 1; when it is one should proceed +% as if this extra spacing is already present. +% \begin{macrocode} +%<*doc> +\def\FD@string@func#1#2{% + \relax + \ifnum \spacefactor=\@ne $\mkern1mu\else$\fi + \mathrm{#1}($% + #2% + \ifnum \spacefactor=\@ne $\mkern-1mu\else $\fi)\mkern1mu$% + \spacefactor=\@ne +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TypesetStringExpression} +% \begin{macro}{\FD@typeset@string} +% \begin{macro}{\ifFD@swa} +% In \package{fontdoc} the string expressions must be typeset, and +% that is not trivial due to that (i) not all character tokens have +% catcode 11 or 12 and (ii) not all characters are available in all +% fonts. Furthermore the non-character string atoms should be given +% special treatment in character strings! +% +% Because of this, string expressions that are to be typeset are +% handed to a special command |\TypesetStringExpression|, which takes +% the string to typeset as its only argument. This string may contain +% user-defined macros. +% \begin{macrocode} +\newcommand\TypesetStringExpression[1]{% + \protected@edef\@tempa{% + \noexpand\MakePrintable \noexpand\@tempa {FD@swa}{#1}% + }% + \@tempa + \FD@typeset@string{\@tempa}% +} +% \end{macrocode} +% Actually typesetting the string is handled in |\FD@typeset@string|, +% but strings handed to this macro must be preprocessed by a full +% protected expansion and a |\MakeHarmless|. +% \begin{macrocode} +\def\FD@typeset@string#1{% + \mbox{% + \normalfont\ttfamily + \spacefactor=\@ne + #1% + \ifnum \spacefactor=\@ne $\mkern-1mu\m@th$\fi + }% +} +% \end{macrocode} +% The |\ifFD@swa| control sequence is often |\let| to |\iftrue| or +% |\iffalse| by |\Make|\-|Printable|, and then it is used as a +% conditional. Since that assignment sometimes takes place in +% conditional text however, one must make sure that |\ifFD@swa| +% always is some conditional. +% \begin{macrocode} +\let\ifFD@swa\iffalse +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\str} +% \begin{macro}{\FD@printable\str} +% The processing of the |\str| macro in \package{fontdoc} is far from +% straightforward. |\str| has to be robust, but apart from that its +% defintion has no effect on how its argument is processed. That is +% instead controlled by |\FD@printable\str|, which happens to use +% |\str| as an auxiliary formatting macro. +% +% Most of the complexity below is however due to the processing +% needed to determine whether the string variable accessed has been +% assigned a value. See |\Set|\-|String|\-|Variable| for more +% information. +% \begin{macrocode} +\DeclareRobustCommand\str[1]{\FD@string@func{s}{#1}} +\@namedef{FD@printable\string\str}#1{% + \MakePrintable\@tempa{FD@swa}{#1}% + \begingroup + \let\PrintChar=\FD@quoted@PrintChar + \if \ifFD@swa \@ifundefined{FD@s-\@tempa}{0}{1}\else 0\fi 1% + \expandafter + \endgroup + \csname FD@s-\@tempa\endcsname + \else + \endgroup + \toks@=\expandafter{\the\expandafter\toks@ + \expandafter\str \expandafter{\@tempa}}% + \@tempswatrue + \fi + \FD@printable@ +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \begin{macro}{\strint} +% \begin{macro}{\FD@printable\strint} +% |\strint| is handled similarly to |\str|. +% \begin{macrocode} +\DeclareRobustCommand\strint[1]{\FD@string@func{int}{#1}} +\@namedef{FD@printable\string\strint}#1{% + \MakePrintable\@tempa{FD@swa}{#1}% + \protected@edef\@tempa{% + \ifFD@swa \protect\FD@simple@int \else \strint \fi{\@tempa}% + } + \toks@=\expandafter{\the\expandafter\toks@ \@tempa}% + \@tempswatrue + \FD@printable@ +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\macroparameter} +% \changes{1.916}{2001/01/06}{Command added. (LH)} +% \begin{macro}{\FD@printable\macroparameter} +% The |\macroparameter| command can be used in string and integer +% expressions as a sort of ``macro parameter placeholder''. It is not +% defined in \package{fontinst}, but in \package{fontdoc} one +% occationally writes comments which say things like ``XXX is short +% for ASDFSKADN'', and in those cases one can use |\macroparameter| +% as a placeholder for an argument. The syntax is +% \begin{quote} +% |\macroparameter|\marg{digit} +% \end{quote} +% where \meta{digit} should be a decimal digit between |1| and |9| +% inclusive. +% +% The definition in |\macroparameter| handles uses of the command in +% integer expressions, whereas |\FD@printable\macroparameter| takes +% care of uses in string expressions. +% \begin{macrocode} +\DeclareRobustCommand\macroparameter[1]{% + \gdef\FD@expression{\text{\normalfont\itshape\##1}}% + \global\chardef\FD@priority=5% + \global\FD@bracket@level=\z@ + \FD@evaluate@false +} +\@namedef{FD@printable\string\macroparameter}#1{% + \toks@=\expandafter{\the\toks@\textrm{\emph{\##1}}}% + \@tempswatrue + \FD@printable@ +} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% +% \subsection{Integer expressions} +% +% An \meta{integer expression} is one of the following: +% \begin{quote} +% \meta{number}\\ +% |\int|\marg{string expression}\\ +% |\neg|\marg{integer expression}\\ +% |\add|\marg{integer expression}\marg{integer expression}\\ +% |\sub|\marg{integer expression}\marg{integer expression}\\ +% |\max|\marg{integer expression}\marg{integer expression}\\ +% |\min|\marg{integer expression}\marg{integer expression}\\ +% |\mul|\marg{integer expression}\marg{integer expression}\\ +% |\div|\marg{integer expression}\marg{integer expression}\\ +% |\half|\marg{integer expression}\\ +% |\otherhalf|\marg{integer expression}\\ +% |\scale|\marg{integer expression}\marg{integer expression}\\ +% |\width|\marg{string expression}\\ +% |\height|\marg{string expression}\\ +% |\depth|\marg{string expression}\\ +% |\italic|\marg{string expression}\\ +% |\kerning|\marg{string expression}\marg{string expression} +% \end{quote} +% \meta{number} is any \TeX\ number, as defined in~\cite{TeXbook}. The +% \meta{string expression} in the argument of |\int| must be the name of +% an integer variable which is currently set, i.e., the condition +% \begin{quote} +% |\ifisint|\marg{string expression}|\then| +% \end{quote} +% must evaluate to true. Likewise the \meta{string expression} in the +% argument of |\width|, |\height|, |\depth|, and |\italic| must be the +% name of a glyph which is currently set, i.e., the condition +% \begin{quote} +% |\ifisglyph|\marg{string expression}|\then| +% \end{quote} +% must evaluate to true. +% +% \begin{macro}{\eval_expr} +% \begin{macro}{\eval_expr_to} +% \begin{macro}{\g_eval_expr_to} +% \begin{macro}{\result} +% The only thing \package{fontinst} does with integer expressions is +% evaluating them. The macro +% \begin{quote} +% |\eval_expr|\marg{integer expression} +% \end{quote} +% globally assigns |\result| to the value of +% \meta{integer expression}, and changes the value of no other +% counters. +% +% The macro +% \begin{quote} +% |\eval_expr_to|\marg{\TeX\ integer variable}^^A +% \marg{integer expression} +% \end{quote} +% locally assigns the value of \meta{integer expression} to +% \meta{\TeX\ integer variable} (which is an integer variable as +% defined in~\cite{TeXbook}). +% |\g_eval_expr_to| does the same globally. +% +% \begin{macrocode} +%<*pkg> +\newcount\result +\def\eval_expr#1{\global\result=#1\x_relax} +\def\eval_expr_to#1#2{\eval_expr{#2}#1=\result} +\def\g_eval_expr_to#1#2{\eval_expr{#2}\global#1=\result} +%</pkg> +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% +% \begin{macro}{\TypesetIntegerExpression} +% In \package{fontdoc} the main task is instead to typeset the +% expression as a mathematical formula, but in some cases one wants to +% know its value as well (if possible). Therefore things get a bit +% more complex in that context. The top-level command there is +% \begin{quote} +% |\TypesetIntegerExpression|\marg{integer expression} +% \end{quote} +% which typesets the \meta{integer expression} by first forming (in the +% |\FD@expression| macro) code for typesetting the integer expression. +% |\Typeset|\-|Integer|\-|Expression| should be only be used in math +% mode. +% +% Most of the work in |\TypesetIntegerExpression| is carried out by +% the |\FD@eval@expr| macro and hence |\TypesetIntegerExpression| sets +% a couple of other variables as explained below. Apart from the fact +% that |\FD@eval@expr| doesn't actually typeset anything, the main +% difference between it and |\Typeset|\-|Integer|\-|Expression| is that +% the latter also accepts code that after expansion will become integer +% expressions, whereas the former requires that all such macros have +% first been expanded. +% \begin{macrocode} +%<*doc> +\newcommand\TypesetIntegerExpression[1]{% + \protected@edef\@tempa{#1}% + \expandafter\FD@eval@expr \expandafter{\@tempa}% + \FD@expression +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\FD@expression} +% \begin{macro}{\FD@result} +% \begin{macro}{\FD@priority} +% \begin{macro}{\FD@bracket@level} +% \begin{switch}{FD@evaluate@} +% The |\FD@expression| macro, |\FD@result| and |\FD@bracket@level| +% count registers, the |\FD@priority| chardef token, and the +% |FD@evaluate@| switch are used by \package{fontdoc} when formatting +% and evaluating an integer expression. They are all assigned globally. +% +% The |\FD@expression| macro contains code for typesetting an +% expression. |\FD@priority| is a chardef token whose numerical value +% specifies the priority of the outermost operation in +% |\FD@expression| according to the following table: +% \begin{enumerate} +% \item[0] +% Outermost operation is $+$ or $-$. +% \item[1] +% Outermost operation is explicit multiplication ($\cdot$) or +% division $/$. If it is one of the factors in a product then +% that multiplication must be explicit. +% \item[2] +% Outermost operation is explicit multiplication. If it is to be +% the right factor in a product, then the multiplication must be +% made explicit too. +% \item[3] +% Outermost operation is explicit multiplication. It +% does not need to be explicitly multiplied. +% \item[4] +% Outermost operation is implicit multiplication (juxtaposition), +% unary prefix (unary $-$) or something which is bracketed anyway. +% If it is to be the right factor in a product, then that +% multiplication should be made explicit too. A typical example +% of this kind of thing is an explicit negative number. +% \item[5] +% Outermost operation is implicit multiplication (juxtaposition) +% or something which is bracketed anyway. It does not need to be +% explicitly multiplied. +% \item[6] +% The expression is an explicit non-negative number. If it is to +% be the right factor in a product, then the multiplication +% should be made explicit. +% \end{enumerate} +% |\FD@bracket@level| keeps track of what parenthesis size one must +% use to cover the expression in |\FD@expression|: 0 is the normal +% size, 1 is |\big| size, 2 is |\Big| size, etc. The |FD@evaluate@| +% switch specifies whether |\FD@eval@expr| should try to (upon entry) +% or managed to (after it is completed) evaluate the integer +% expression (true is evaluate, false is don't bother). When the value +% has been evaluated, it is returned in |\FD@result|. +% \begin{macrocode} +\newcount\FD@result +\newcount\FD@bracket@level +\def\FD@evaluate@true{\global\let\ifFD@evaluate@\iftrue} +\def\FD@evaluate@false{\global\let\ifFD@evaluate@\iffalse} +\FD@evaluate@false +% \end{macrocode} +% \end{switch}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\FD@eval@expr} +% The |\FD@eval@expr| macro has the syntax +% \begin{quote} +% |\FD@eval@expr|\marg{integer expression} +% \end{quote} +% It puts code for typesetting the \meta{integer expression} in the +% |\FD@expression| macro, sets |\FD@bracket@level| to the +% corresponding value, and if |FD@evaluate@| is true it also tries to +% evaluate the expression and put the result in |\FD@result|. +% +% More precisely, |\FD@eval@expr| only handles the \meta{\TeX~number} +% cases of integer expression. In the other cases the first token in +% the integer expression is a robust command which should take care of +% building the expression as needed. +% \begin{macrocode} +\def\FD@eval@expr#1{% + \expandafter\expandafter \expandafter\ifx + \expandafter\@car#1\x@relax\@nil \protect + #1% + \else\ifcat \expandafter\noexpand \@car#1\x@relax\@nil 0% + \global\FD@result=#1\x@relax + \xdef\FD@expression{\the\FD@result}% + \global\chardef\FD@priority=\ifnum \FD@result<\z@ 4\else 6\fi + \global\FD@bracket@level=\z@ + \else + \begingroup + \MakePrintable\@tempa{FD@swa}{#1}% + \global\FD@bracket@level=\ifFD@swa\z@\else\@ne\fi + \protected@xdef\FD@expression{\protect\mbox{\texttt{\@tempa}}}% + \endgroup + \global\chardef\FD@priority=5% + \FD@evaluate@false + \fi\fi +} +%</doc> +% \end{macrocode} +% Note: It is important that all groups that are started or ended +% during the evaluation of an integer expression are of |\begingroup| +% type, since |\bgroup| groups affect spacing in math mode. +% \end{macro} +% +% \begin{macro}{\add} +% The |\add| command has the syntax +% \begin{quote} +% |\add|\marg{integer expression}\marg{integer expression} +% \end{quote} +% It represents the sum of the two \meta{integer expression}s. +% \begin{macrocode} +%<*pkg> +\def\add#1#2{ + #1 + \bgroup + \a_count=\result + \eval_expr{#2} + \global\advance \result \a_count + \egroup +} +%</pkg> +%<*doc> +\DeclareRobustCommand\add[2]{% + \begingroup + \FD@eval@expr{#1}% + \let\@tempa=\FD@expression + \ifFD@evaluate@ \a@count=\FD@result \fi + \b@count=\FD@bracket@level + \FD@eval@expr{#2}% + \protected@xdef\FD@expression{\@tempa+\FD@expression}% + \ifFD@evaluate@ \global\advance \FD@result \a@count \fi + \ifnum \FD@bracket@level<\b@count + \global\FD@bracket@level=\b@count + \fi + \global\chardef\FD@priority=\z@ + \endgroup +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sub} +% The |\sub| command has the syntax +% \begin{quote} +% |\sub|\marg{integer expression}\marg{integer expression} +% \end{quote} +% It represents the difference between the two \meta{integer +% expression}s. +% \begin{macrocode} +%<*pkg> +\def\sub#1#2{ + #1 + \bgroup + \a_count=\result + \eval_expr{#2} + \advance \a_count -\result + \global\result=\a_count + \egroup +} +%</pkg> +%<*doc> +\DeclareRobustCommand\sub[2]{% + \begingroup + \FD@eval@expr{#1}% + \let\@tempa=\FD@expression + \ifFD@evaluate@ \a@count=\FD@result \fi + \b@count=\FD@bracket@level + \FD@eval@expr{#2}% + \ifnum \FD@priority<\@ne \FD@bracket@expression \fi + \protected@xdef\FD@expression{\@tempa-\FD@expression}% + \ifFD@evaluate@ + \advance \a@count -\FD@result + \global\FD@result=\a@count + \fi + \ifnum \FD@bracket@level<\b@count + \global\FD@bracket@level=\b@count + \fi + \global\chardef\FD@priority=\z@ + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\FD@subexpression} +% \begin{macro}{\FD@commapenalty} +% The |\FD@subexpression| macro has the syntax +% \begin{quote} +% |\FD@subexpression|\marg{math mode material} +% \end{quote} +% It should only be used in math mode and produces results very +% similar to \meta{math mode material}, but it locally increases all +% the math-related penalties by |\FD@commapenalty| for when the math +% mode material is converted to a horizontal list. This allows +% linebreaking to take notice of logical nesting in expressions. +% +% |\FD@commapenalty| is used as a companion of |\relpenalty| and +% |\binoppenalty|, but which is used after commas (where \TeX\ doesn't +% insert penalties automatically). +% \begin{macrocode} +\def\FD@subexpression#1{${% + \advance \binoppenalty \FD@commapenalty + \advance \relpenalty \FD@commapenalty + \advance \FD@commapenalty \FD@commapenalty + $#1$}$% +} +\newcount\FD@commapenalty +\FD@commapenalty=\binoppenalty +\advance \FD@commapenalty \relpenalty +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\FD@bracket@expression} +% The |\FD@bracket@expression| brackets the expression currently in +% |\FD@expression| by the suitable size of parentheses and updates +% |\FD@bracket@level| and |\FD@priority| accordingly. +% \begin{macrocode} +\def\FD@bracket@expression{% + \protected@xdef\FD@expression{% + \ifcase\FD@bracket@level \or \protect\bigl \or \protect\Bigl \or + \protect\biggl \else \protect\Biggl \fi (% + \protect\FD@subexpression{\FD@expression}% + \ifcase\FD@bracket@level \or \protect\bigr \or \protect\Bigr \or + \protect\biggr \else \protect\Biggr \fi )% + }% + \global\chardef\FD@priority=5% + \global\advance \FD@bracket@level \@ne +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\int} +% \changes{1.909}{1999/10/19}{\package{fontdoc} implementation +% changed to using \cs{typeset@integer}. (LH)} +% \begin{macro}{\FD@simple@int} +% The |\int| command has the syntax +% \begin{quote} +% |\int|\marg{string expression} +% \end{quote} +% It is used to represent the value of the \package{fontinst} integer +% whose name is the value of the \meta{string expression} in integer +% expressions. +% +% The |\FD@simple@int| macro take the printable string form of the +% name of an integer variable as its argument and typesets the +% printed representation of this integer, but it should only be used +% when the argument is a simple string expression. When the argument +% is not a simple string expression, |\FD@integer@func| should be +% used instead. |\FD@simple@int| should only be called in horizontal +% mode. +% \begin{macrocode} +%<pkg>\def\int#1{\csname i-#1 \endcsname} +%<*doc> +\DeclareRobustCommand\int[1]{% + \begingroup + \MakePrintable\@tempa{FD@swa}{#1}% + \protected@xdef\FD@expression{% + \ifFD@swa + \text{\protect\FD@simple@int{\@tempa}}% + \else + \protect\FD@integer@func{int}{\@tempa}% + \fi + }% + \global\chardef\FD@priority=5% + \global\FD@bracket@level=\ifFD@swa\z@\else\@ne\fi + \FD@evaluate@false + \endgroup +} +\def\FD@simple@int#1{{\normalfont\itshape #1\/}} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\FD@integer@func} +% The |\FD@integer@func| macro has the syntax +% \begin{quote} +% |\FD@integer@func|\marg{name}\marg{argument} +% \end{quote} +% It is used for typesetting the \meta{name}$($\meta{argument}$)$ +% of an integer-valued function which takes a string expression as +% argument (e.g.\ the width-of-glyph function $\mathrm{w}$). It +% should only be used in math mode. +% +% The empty group in the argument of |\mathop| is there to ensure +% that the nucleus of the mathop atom isn't simply a symbol, since +% \TeX\ in that case centers it vertically. +% \begin{macrocode} +\def\FD@integer@func#1#2{% + \mathop{\mathrm{#1}{}}(\text{\FD@typeset@string{#2}})% +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\neg} +% The |\neg| command has the syntax +% \begin{quote} +% |\neg|\marg{integer expression} +% \end{quote} +% It represents the negative of the \meta{integer expression}. +% \begin{macrocode} +%<pkg>\def\neg#1{#1 \global\result=-\result} +%<*doc> +\DeclareRobustCommand\neg[1]{% + \FD@eval@expr{#1}% + \ifnum 5>\FD@priority \FD@bracket@expression \fi + \protected@xdef\FD@expression{-\FD@expression}% + \global\chardef\FD@priority=4% + \ifFD@evaluate@ \global\FD@result=-\FD@result \fi +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mul} +% The |\mul| command has the syntax +% \begin{quote} +% |\mul|\marg{integer expression}\marg{integer expression} +% \end{quote} +% It represents the product of the two \meta{integer expression}s. +% \begin{macrocode} +%<*pkg> +\def\mul#1#2{ + #1 + \bgroup + \a_count=\result + \eval_expr{#2} + \global\multiply \result \a_count + \egroup +} +%</pkg> +% \end{macrocode} +% +% The main problem in the \package{fontdoc} definition of |\mul| is +% to determine whether the multiplication should be made explicit or +% not, and what priority code the resulting expression should be +% given. It turns out that if the right factor has priority 1 (it is +% a quotient or a product that ends with a quotient) then the +% combined expression will be too, whereas if it isn't but the left +% factor has priority 1 then the combined expression will get +% priority 2. The remaining cases will be explicit or implicit +% depending on the parity of the priority of the right expression, and +% priority will be odd or even depending on the parity of the priority +% of the left expression. +% \begin{macrocode} +%<*doc> +\DeclareRobustCommand\mul[2]{% + \begingroup + \FD@eval@expr{#1}% + \ifnum \FD@priority<\@ne \FD@bracket@expression \fi + \let\@tempa=\FD@expression + \ifFD@evaluate@ \a@count=\FD@result \fi + \b@count=\FD@bracket@level + \let\FD@left@priority=\FD@priority + \FD@eval@expr{#2}% + \ifnum \FD@priority<\@ne \FD@bracket@expression \fi + \protected@xdef\FD@expression{% + \@tempa + \if \ifnum \FD@left@priority=\@ne e% + \else\ifnum \FD@priority<\thr@@ e% + \else\ifodd \FD@priority i\else e\fi\fi\fi e% + \cdot + \fi + \FD@expression + }% + \ifFD@evaluate@ \global\multiply \FD@result \a@count \fi + \ifnum \FD@bracket@level<\b@count + \global\FD@bracket@level=\b@count + \fi + \a@count=% + \ifnum \FD@priority=\@ne 1% + \else\ifnum \FD@left@priority=\@ne 2% + \else\ifodd\FD@left@priority + \ifodd\FD@priority 5\else 3\fi + \else + \ifodd\FD@priority 4\else 2\fi + \fi\fi\fi + \global\chardef\FD@priority=\a@count + \endgroup +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\div} +% The |\div| command has the syntax +% \begin{quote} +% |\div|\marg{integer expression}\marg{integer expression} +% \end{quote} +% It represents the quotient of the two \meta{integer expression}s, as +% computed by \TeX's |\divide| command: non-integer quotients are +% rounded towards zero. +% \begin{macrocode} +%<*pkg> +\def\div#1#2{ + #1 + \bgroup + \a_count=\result + \eval_expr{#2} + \divide \a_count \result + \global\result=\a_count + \egroup +} +%</pkg> +%<*doc> +\DeclareRobustCommand\div[2]{% + \begingroup + \FD@eval@expr{#1}% + \ifnum \FD@priority<\@ne \FD@bracket@expression \fi + \let\@tempa=\FD@expression + \ifFD@evaluate@ \a@count=\FD@result \fi + \b@count=\FD@bracket@level + \FD@eval@expr{#2}% + \ifnum 4>\FD@priority \FD@bracket@expression \fi + \ifnum \FD@bracket@level<\b@count + \global\FD@bracket@level=\b@count + \fi + \protected@xdef\FD@expression{% + \@tempa + \ifcase\FD@bracket@level \or \protect\big \or \protect\Big \or + \protect\bigg \else \protect\Bigg \fi /% + \FD@expression + }% + \ifFD@evaluate@ + \divide \a@count \FD@result + \global\FD@result=\a@count + \fi + \global\chardef\FD@priority=\@ne + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\FD@eval@spec@expr} +% The |\FD@eval@spec@expr| macro has the syntax +% \begin{isyntax} +% |\FD@eval@spec@expr|\marg{integer expression}^^A +% \discretionary{}{}{}\marg{spec-command}^^A +% \discretionary{}{}{}\marg{rep-command} +% \end{isyntax} +% It does pretty much the same thing as |\FD@eval@expr|, but if the +% first token in the \meta{integer expression} is the +% \meta{spec-command} then it will do +% \begin{quote} +% \meta{rep-command}\meta{integer expression} +% \end{quote} +% instead of the normal activities. This is useful for operations that +% are normally denoted as $n$-ary operations rather that binary ones, +% i.e., for |\max| and |\min|. +% \begin{macrocode} +\def\FD@eval@spec@expr#1#2#3{% + \expandafter\ifx \@car#1\x@relax\@nil #2% + #3#1% + \else + \FD@eval@expr{#1}% + \fi +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\max} +% The |\max| command has the syntax +% \begin{quote} +% |\max|\marg{integer expression}\marg{integer expression} +% \end{quote} +% It represents the maximum of the two \meta{integer expression}s. +% \begin{macrocode} +%<*pkg> +\def\max#1#2{ + #1 + \bgroup + \a_count=\result + \eval_expr{#2} + \ifnum \a_count>\result \global\result=\a_count \fi + \egroup +} +%</pkg> +%<*doc> +\DeclareRobustCommand\max[2]{% + \begingroup + \toks@={}% + \a@count=-\maxdimen + \b@count=\z@ + \FD@eval@spec@expr{\max{#1}{#2}}{\max}{\FD@maxmin@comma}% + \ifnum \a@count>\FD@bracket@level + \global\FD@bracket@level=\a@count + \fi + \protected@xdef\FD@expression{% + \protect\plainmax + \ifcase\FD@bracket@level \protect\@firstofone \or \protect\bigl + \or \protect\Bigl \or \protect\biggl \else \protect\Biggl + \fi{\{}% + \the\toks@ + \protect\FD@subexpression{\FD@expression}% + \ifcase\FD@bracket@level \protect\@firstofone \or \protect\bigl + \or \protect\Bigl \or \protect\biggl \else \protect\Biggl + \fi{\}}% + }% + \ifFD@evaluate@ + \ifnum \a@count>\FD@result \global\FD@result=\a@count \fi + \fi + \global\chardef\FD@priority=5% + \global\advance \FD@bracket@level \@ne + \endgroup +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\min} +% The |\min| command has the syntax +% \begin{quote} +% |\min|\marg{integer expression}\marg{integer expression} +% \end{quote} +% It represents the minimum of the two \meta{integer expression}s. +% \begin{macrocode} +%<*pkg> +\def\min#1#2{ + #1 + \bgroup + \a_count=\result + \eval_expr{#2} + \ifnum \a_count<\result \global\result=\a_count \fi + \egroup +} +%</pkg> +%<*doc> +\DeclareRobustCommand\min[2]{% + \begingroup + \toks@={}% + \a@count=\maxdimen + \b@count=\z@ + \FD@eval@spec@expr{\min{#1}{#2}}{\min}{\FD@maxmin@comma}% + \ifnum \a@count>\FD@bracket@level + \global\FD@bracket@level=\a@count + \fi + \protected@xdef\FD@expression{% + \protect\plainmin + \ifcase\FD@bracket@level \protect\@firstofone \or \protect\bigl + \or \protect\Bigl \or \protect\biggl \else \protect\Biggl + \fi{\{}% + \the\toks@ + \protect\FD@subexpression{\FD@expression}% + \ifcase\FD@bracket@level \protect\@firstofone \or \protect\bigl + \or \protect\Bigl \or \protect\biggl \else \protect\Biggl + \fi{\}}% + }% + \ifFD@evaluate@ + \ifnum \a@count<\FD@result \global\FD@result=\a@count \fi + \fi + \global\chardef\FD@priority=5% + \global\advance \FD@bracket@level \@ne + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\FD@maxmin@comma} +% The |\FD@maxmin@comma| macro does most of the work for |\max| and +% |\min| in \package{fontdoc}. In some sense it inserts the commas +% between the operands, but it also takes care of evaluating the +% maximum\slash minimum and determining the proper bracketing level. +% +% The sequence of arguments (separated by commas) is compiled in +% |\toks@|. The greatest\slash least value of an argument found so +% far is kept in |\a@count|, and the greatest bracketing level found +% is kept in |\b@count|. +% \begin{macrocode} +\def\FD@maxmin@comma#1#2#3{% + \FD@eval@spec@expr{#2}{#1}{\FD@maxmin@comma}% + \toks@=\expandafter{\the\expandafter\toks@ + \expandafter\protect \expandafter\FD@subexpression + \expandafter{\FD@expression}% + ,\penalty\FD@commapenalty\,% + } + \ifFD@evaluate@ + \ifnum \a@count \ifx\max#1<\else>\fi \FD@result + \a@count=\FD@result + \fi + \fi + \ifnum \b@count<\FD@bracket@level \b@count=\FD@bracket@level \fi + \FD@eval@spec@expr{#3}{#1}{\FD@maxmin@comma}% +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\half} +% \begin{macro}{\otherhalf} +% \multchanges{\cs{half}\cs{otherhalf}}{1.916}{2000/12/31}{Macros +% added. (LH)} +% The |\half| and |\otherhalf| macros have the syntaxes +% \begin{quote} +% |\half|\marg{integer expression}\\ +% |\otherhalf|\marg{integer expression} +% \end{quote} +% They both represent one half of the \meta{integer expression}, but +% they don't round it the same way. |\half| does rounding as +% specified in~\cite[p.~237]{TAOCP2} (towards even integers) whereas +% |\otherhalf| does it the other way (towards odd integers). This +% means that +% \begin{quote} +% |\add{\half{|\meta{IE}|}}{\otherhalf{|\meta{IE}|}}| +% \end{quote} +% will always sum up to precisely the same as the \meta{IE} integer +% expression. +% \begin{macrocode} +%<*pkg> +\def\half#1{ + #1\x_relax + \ifodd\result + \global\advance \result \@ne + \global\divide \result \tw@ + \ifodd\result \global\advance \result \m@ne \fi + \else + \global\divide \result \tw@ + \fi +} +\def\otherhalf#1{ + #1\x_relax + \ifodd\result + \global\advance \result \@ne + \global\divide \result \tw@ + \ifodd\result \else \global\advance \result \m@ne \fi + \else + \global\divide \result \tw@ + \fi +} +%</pkg> +%<*doc> +\DeclareRobustCommand\half[1]{% + \begingroup + \FD@eval@expr{#1}% + \ifnum \FD@priority<\@ne \FD@bracket@expression \fi + \a@count=% + \ifnum \FD@priority=\@ne 1% + \else\ifodd\FD@priority 5% + \else 3\fi\fi + \global\chardef\FD@priority=\a@count + \protected@xdef\FD@expression{% + \protect\frac{1}{2}% + \ifnum \FD@priority>\thr@@ \else \cdot \fi + \FD@expression + }% + \ifFD@evaluate@ + \ifodd \FD@result + \global\advance \FD@result \@ne + \global\divide \FD@result \tw@ + \ifodd\FD@result \global\advance \FD@result \m@ne \fi + \else + \global\divide \FD@result \tw@ + \fi + \fi + \endgroup +} +\DeclareRobustCommand\otherhalf[1]{% + \begingroup + \FD@eval@expr{#1}% + \ifnum \FD@priority<\@ne \FD@bracket@expression \fi + \a@count=% + \ifnum \FD@priority=\@ne 1% + \else\ifodd\FD@priority 5% + \else 3\fi\fi + \global\chardef\FD@priority=\a@count + \protected@xdef\FD@expression{% + \protect\frac{1}{2}% + \ifnum \FD@priority>\thr@@ \else \cdot \fi + \FD@expression + }% + \ifFD@evaluate@ + \ifodd \FD@result + \global\advance \FD@result \@ne + \global\divide \FD@result \tw@ + \ifodd\FD@result\else \global\advance \FD@result \m@ne \fi + \else + \global\divide \FD@result \tw@ + \fi + \fi + \endgroup +} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\scale} +% The |\scale| command has the syntax +% \begin{quote} +% |\scale|\marg{integer expression}\marg{integer expression} +% \end{quote} +% It represents the result of multiplying the first \meta{integer +% expression} by as many thousands as is specified by the second +% \meta{integer expression}. In practice, |\scale|\marg{ie1}\marg{ie2} +% is very similar to +% \begin{quote} +% |\div{\mul|\marg{ie1}\marg{ie2}|}{1000}| +% \end{quote} +% but |\scale| also tries to do proper rounding (note however that +% |\scale|ing by 500 is not rounded properly; use |\half| instead). +% \begin{macrocode} +%<*pkg> +\def\scale#1#2{ + #1 + \bgroup + \a_count=\result + \eval_expr{#2} + \global\multiply \result \a_count + \rounded_thousandths + \egroup +} +%</pkg> +% \end{macrocode} +% +% The second (scaling factor) argument of |\scale| is usually very +% simple, and in that case the |\scale| will be formatted as a +% fraction (containing the second argument) multiplied by the first +% argument. +% \begin{macrocode} +%<*doc> +\DeclareRobustCommand\scale[2]{% + \begingroup + \FD@eval@expr{#1}% + \ifnum \FD@priority<\@ne \FD@bracket@expression \fi + \let\@tempa=\FD@expression + \ifFD@evaluate@ \a@count=\FD@result \fi + \b@count=\FD@bracket@level + \let\FD@left@priority=\FD@priority + \FD@eval@expr{#2}% + \if \ifnum \FD@bracket@level<\@ne \ifnum \FD@priority>\thr@@ + 1\else 0\fi\else 0\fi 1% + \protected@xdef\FD@expression{% + \protect\frac{\FD@expression}{1000}% + \if \ifnum \FD@left@priority<\thr@@ e\else + \ifodd \FD@left@priority i\else e\fi\fi e% + \cdot + \fi + \@tempa + } + \global\chardef\FD@priority=% + \ifnum \FD@left@priority=\@ne 1\else + \ifodd\FD@left@priority 5\else 3\fi\fi + \global\FD@bracket@level=\b@count + \else + \ifnum \FD@priority<\@ne \FD@bracket@expression \fi + \protected@xdef\FD@expression{% + \@tempa + \if \ifnum \FD@left@priority=\@ne e% + \else\ifnum \FD@priority<\thr@@ e% + \else\ifodd \FD@priority i\else e\fi\fi\fi e% + \cdot + \fi + \FD@expression + \ifcase\FD@bracket@level \or \protect\big \or \protect\Big + \or \protect\bigg \else \protect\Bigg \fi /1000% + }% + \ifnum \FD@bracket@level<\b@count + \global\FD@bracket@level=\b@count + \fi + \global\chardef\FD@priority=\@ne + \fi + \ifFD@evaluate@ + \global\multiply \FD@result \a@count + \global\divide \FD@result 500 + \ifodd \FD@result + \global\advance \FD@result \ifnum 0>\FD@result - \fi \@ne + \fi + \global\divide \FD@result \tw@ + \fi + \endgroup +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rounded_thousandths} +% \changes{1.901}{1999/03/06}{Macro added. \cs{scale} changed to +% use it. (LH)} +% \begin{macro}{\l_rounded_thousandths} +% The |\rounded_thousandths| macro divides |\result| +% by 1000 and rounds the result to the nearest integer. This is +% different from +% \begin{quote} +% |\global\divide \result \one_thousand| +% \end{quote} +% since the latter always rounds positive numbers downwards and +% negative numbers upwards. +% +% |\l_rounded_thousandths| does the same thing, but to the register +% passed as parameter \#1 and is assigned locally. +% \changes{1.913}{2000/03/04}{Macro added. (LH)} +% \begin{macrocode} +%<*pkg> +\def\rounded_thousandths{ + \global\divide \result \five_hundred + \ifodd \result + \global\advance \result by \ifnum 0>\result - \fi 1 + \fi + \global\divide \result \tw@ +} +% \end{macrocode} +% \begin{macrocode} +\def\l_rounded_thousandths#1{ + \divide #1 \five_hundred + \ifodd #1 + \advance #1 by \ifnum 0>#1 - \fi\@ne + \fi + \divide #1 \tw@ +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\l_inv_scale} +% \changes{1.913}{2000/03/11}{Macro added. (LH)} +% The |\l_inv_scale| takes two arguments: as \#1 a count register, +% and as \#2 a \TeX\ number. |\l_inv_scale| scales \#1 by the inverse +% of \#2, if the value in \#1 is $n$ and the value in \#2 is $m$ then +% |\l_inv_scale| computes +% $$ +% \left[ \frac{1000n}{m} \right] \mbox{,} +% $$ +% where the brackets denote rounding to the nearest integer, and +% assigns this number to \#1 locally. +% \begin{macrocode} +\def\l_inv_scale#1#2{ + \multiply #1 \two_thousand + \divide #1 #2\x_relax + \ifodd#1 \advance #1 \ifnum 0>#1 - \fi\@ne \fi + \divide #1 \tw@ +} +% \end{macrocode} +% \end{macro} +% +% \multchanges{\cs{priority}}{1.909}{1999/10/20}{Changed condition for +% \cs{ifnum}, so that expressions with equal priority will not get +% bracketed when nested. (LH)} +% \multchanges{\cs{expression}\cs{priority}\cs{identity}^^A +% \cs{bracket}}{1.916}{2001/01/01}{Macros removed. (LH)} +% +% \begin{macro}{\ifnumber} +% \changes{1.900}{1999/02/15}{Command added. (LH)} +% The call +% \begin{quote} +% |\ifnumber|\marg{integer expression}\meta{rel}^^A +% \marg{integer expression}|\then| +% \end{quote} +% can be used to compare the two integer expressions. \meta{rel} may +% be |<|, |=|, or |>|. +% \begin{macrocode} +\def\ifnumber#1#2#3\then{ + \eval_expr_to\a_count{#1} + \eval_expr{#3} + \ifnum \a_count#2\result + \expandafter\if_true + \else + \expandafter\if_false + \fi +} +%</pkg> +% \end{macrocode} +% +% Like the other conditionals, |\ifnumber| is treated as being true by +% \package{fontdoc}. +% \begin{macrocode} +%<*doc> +\def\ifnumber#1#2#3\then{% + \FD@evaluate@false + \generic@if{% + $\TypesetIntegerExpression{#1}#2\TypesetIntegerExpression{#3}$% + }% +} +%</doc> +% \end{macrocode} +% \end{macro} +% + + +% \subsection{Setting variables} +% \label{Ssec:Variables} +% +% \meta{int}, \meta{str}, and \meta{dim} below are string expressions. +% \meta{command} can be any control sequence. +% +% \DescribeMacro{\setint} +% \DescribeMacro{\setstr} +% \DescribeMacro{\setdim} +% \DescribeMacro{\setcommand} +% The macros: +% \begin{quote} +% |\setint|\marg{int}\marg{integer expression}\\ +% |\setstr|\marg{str}\marg{string}\\ +% |\setdim|\marg{dim}\marg{dimension}\\ +% |\setcommand|\meta{command}\meta{definition} +% \end{quote} +% define new macros +% \describecsfamily{i-\meta{int}}|\i-|\meta{int}, +% \describecsfamily{s-\meta{str}}|\s-|\meta{str}, +% \describecsfamily{d-\meta{dim}}|\d-|\meta{dim}, or +% \meta{command}. +% +% \DescribeMacro{\resetint} +% \DescribeMacro{\resetstr} +% \DescribeMacro{\resetdim} +% \DescribeMacro{\resetcommand} +% The macros: +% \begin{quote} +% |\resetint|\marg{int}\marg{integer expression}\\ +% |\resetstr|\marg{str}\marg{string}\\ +% |\resetdim|\marg{dim}\marg{dimension}\\ +% |\resetcommand|\meta{command}\meta{definition} +% \end{quote} +% redefine the macros |\i-|\meta{int}, |\s-|\meta{str}, |\d-|\meta{dim} or +% \meta{command}. +% +% \DescribeMacro{\int} +% \DescribeMacro{\str} +% \DescribeMacro{\dim} +% The macros: +% \begin{quote} +% |\int|\marg{int}\\ +% |\str|\marg{str}\\ +% |\dim|\marg{dim}\\ +% \meta{command} +% \end{quote} +% return the values of |\i-|\meta{int}, |\s-|\meta{str}, |\d-|\meta{dim}, +% or \meta{command}. +% +% \DescribeMacro{\strint} +% The macro +% \begin{quote} +% |\strint|\marg{int} +% \end{quote} +% returns the value of |\i-|\meta{int} as a string. +% +% \DescribeMacro{\ifisint} +% \DescribeMacro{\ifisstr} +% \DescribeMacro{\ifisdim} +% \DescribeMacro{\ifiscommand} +% The macros: +% \begin{quote} +% |\ifisint|\marg{int}|\then|\\ +% |\ifisstr|\marg{str}|\then|\\ +% |\ifisdim|\marg{dim}|\then|\\ +% |\ifiscommand|\meta{command}|\then| +% \end{quote} +% return |\if_true| if |\i-|\meta{int}, |\s-|\meta{str}, +% |\d-|\meta{dim}, or \meta{command} respectively have been defined, +% and |\if_false| otherwise. +% +% \DescribeMacro{\unsetint} +% \DescribeMacro{\unsetstr} +% \DescribeMacro{\unsetdim} +% \DescribeMacro{\unsetcommand} +% The macros: +% \begin{quote} +% |\unsetint|\marg{int}\\ +% |\unsetstr|\marg{str}\\ +% |\unsetdim|\marg{dim}\\ +% |\unsetcommand|\meta{command} +% \end{quote} +% undefine |\i-|\meta{int}, |\s-|\meta{str}, |\d-|\meta{dim}, or +% \meta{command}. +% +% \DescribeMacro{\x_setint} +% \DescribeMacro{\x_resetint} +% \DescribeMacro{\x_setstr} +% The macros |\x_setint|, |\x_resetint|, and |\x_setstr| are ``private'' +% versions of |\setint|, |\resetint|, and |\setstr| respectively. They +% have been included to reduce the problems in case a user turns off one +% of these commands and forgets to turn it on again. +% +% \changes{1.900}{1999/02/07}{Replaced internal \cs{setint}, +% \cs{resetint}, and \cs{setstr} by \cs{x_setint}, \cs{x_resetint}, +% and \cs{x_setstr} respectively, to make the public versions +% possible to turn off. (LH)} +% +% Integers are kept as |\mathchardef|s if possible; a comparision of +% doing this versus not doing this appears in +% Subsection~\ref{Ssec: ASAJ tests}. +% +% \begin{macro}{\setsomething_global} +% The |\setsomething_global| control sequence should be either +% |\relax| or |\global|. It appears before the central assignments in +% all the |\set|\textellipsis, |\reset|\textellipsis, and +% |\unset|\textellipsis\ commands. The normal value is |\relax|, so +% that these assignments are local. +% +% When there is counter-intuitive grouping, and it could seem that +% \TeX\ should not be inside a group at all---i.e., between +% |\installfonts| and |\endinstallfonts|---one can make the basic +% assignment commands act more logical by setting +% |\setsomething_global| to |\global|. +% +% \changes{1.912}{2000/01/15}{Control sequence introduced and added +% to all \cs{set}\dots, \cs{reset}\dots, and \cs{unset}\dots\ +% commands, as well as \cs{offcommand} and \cs{oncommand}. (LH)} +% \begin{macrocode} +%<*pkg> +\let\setsomething_global=\x_relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\x_setint} +% \begin{macro}{\setint} +% \begin{macro}{\x_setstr} +% \begin{macro}{\setstr} +% \begin{macro}{\setdim} +% \begin{macro}{\setcommand} +% \changes{1.909}{1999/10/17}{Since \package{fontdoc} adds some +% grouping, \cs{setcommand} must set its argument globally there. +% (LH)} +% \changes{1.912}{2000/01/15}{Settings of a command already defined +% is diverted to \cs{a_macro}; it used to be \cs{a_command}. Saves +% one hash table position. (LH)} +% +% \begin{macrocode} +\def\x_setint#1#2{ + \x_cs\ifx{i-#1}\x_relax + \x_resetint{#1}{#2} + \fi +} +\let\setint=\x_setint +\def\x_setstr#1#2{ + \x_cs\ifx{s-#1}\x_relax + \setsomething_global\x_cs\edef{s-#1}{#2} + \fi +} +\let\setstr=\x_setstr +\def\setdim#1#2{ + \x_cs\ifx{d-#1}\x_relax + \a_dimen=#2\x_relax + \setsomething_global\x_cs\edef{d-#1}{\the\a_dimen} + \fi +} +\def\setcommand#1{ + \ifx#1\undefined_command + \setsomething_global \expandafter\def \expandafter#1 + \else + \expandafter\def \expandafter\a_macro + \fi +} +%</pkg> +% \end{macrocode} +% +% In \package{fontdoc}, |\setint|, |\setstr|, and |\setdim| print +% headings. There is no need for the private forms |\x_setint| and +% |\x_setstr|. |\setcommand|, finally, does the same thing as in +% \package{fontinst}; the assignment is global because of grouping +% not present in \package{fontinst}. +% \begin{macrocode} +%<*doc> +\newcommand\setint[2]{% + \Bheading{Default} \(\TypesetIntegerExpression{\int{#1}}\) = + \(\TypesetIntegerExpression{#2}\)% +} +\newcommand\setstr[2]{% + \Bheading{Default} \TypesetStringExpression{\str{#1}} = + \TypesetStringExpression{#2}% +} +\newcommand\setdim[2]{% + \a@dimen=#2\relax + \Bheading{Default} \TypesetStringExpression{#1} dimen = \the\a@dimen +} +\def\setcommand#1{\ifx#1\undefined@command + \expandafter\gdef\expandafter#1\else + \expandafter\gdef\expandafter\a@command\fi} +%</doc> +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} +% \end{macro} +% +% \begin{macro}{\x_resetint} +% \begin{macro}{\resetint} +% \begin{macro}{\resetstr} +% \begin{macro}{\resetdim} +% \begin{macro}{\resetcommand} +% \changes{1.909}{1999/10/17}{Since \package{fontdoc} adds some +% grouping, \cs{resetcommand} must set its argument globally there. +% (LH)} +% \begin{macrocode} +%<*pkg> +\def\x_resetint#1#2{ + \eval_expr{#2} + \setsomething_global + \ifnum\result<\max_mathchardef + \ifnum 0>\result + \x_cs\edef{i-#1}{\the\result} + \else + \x_cs\mathchardef{i-#1}=\result + \fi + \else + \x_cs\edef{i-#1}{\the\result} + \fi +} +\let\resetint=\x_resetint +\def\resetstr#1#2{\setsomething_global\x_cs\edef{s-#1}{#2}} +\def\resetdim#1#2{ + \a_dimen=#2 + \setsomething_global\x_cs\edef{d-#1}{\the\a_dimen} +} +\def\resetcommand#1{\setsomething_global\def#1} +%</pkg> +% \end{macrocode} +% +% In \package{fontdoc}, |\resetint|, |\resetstr|, and |\resetdim| +% print headings. There is no need for the private form |\x_resetint|. +% |\resetcommand|, finally, does the same thing as in +% \package{fontinst}. +% +% \begin{macrocode} +%<*doc> +\newcommand\resetint[2]{% + \Bheading{Value} \(\TypesetIntegerExpression{\int{#1}}\) = + \(\TypesetIntegerExpression{#2}\)% +} +\newcommand\resetstr[2]{% + \Bheading{Value} \TypesetStringExpression{\str{#1}} = + \TypesetStringExpression{#2}% +} +\newcommand\resetdim[2]{% + \a@dimen=#2\relax + \Bheading{Value} \TypesetStringExpression{#1} dimen = \the\a@dimen +} +\def\resetcommand#1{\gdef#1} +%</doc> +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} +% +% +% \begin{macro}{\dim} +% \begin{macrocode} +%<pkg>\def\dim#1{\csname~d-#1\endcsname} +% \end{macrocode} +% \missing{doc}{\dim} +% \end{macro} +% +% \multchanges{\cs{typeset@integer}\cs{typeset@string}^^A +% \cs{typeset@dimen}}{1.916}{2000/01/02}{Macros removed. (LH)} +% +% \begin{macro}{\ifisint} +% \begin{macro}{\ifisstr} +% \begin{macro}{\ifisdim} +% \multchanges{\cs{ifisint}\cs{ifisstr}\cs{ifisdim}}{1.912} +% {2000/02/10}{Reimplemented using \cs{if_defined}. (LH)} +% \begin{macro}{\ifiscommand} +% \begin{macrocode} +%<*pkg> +\def\ifisint#1\then{\if_defined i-#1\then} +\def\ifisstr#1\then{\if_defined s-#1\then} +\def\ifisdim#1\then{\if_defined d-#1\then} +\def\ifiscommand#1\then{ + \ifx#1\undefined_command + \expandafter\if_false + \else + \expandafter\if_true + \fi +} +%</pkg> +% \end{macrocode} +% +% In \package{fontdoc}, all conditionals are handled through +% |\generic@if|, which by default expands to |\iftrue|. +% \changes{1.909}{1999/10/17}{Changed one fontdoc definition of +% \cs{ifisglyph} to a definition of \cs{ifiscommand}, which was +% missing from fontdoc.} +% \begin{macrocode} +%<*doc> +\def\ifisint#1\then{% + \generic@if{integer $\TypesetIntegerExpression{\int{#1}}$ set}% +} +\def\ifisstr#1\then{% + \generic@if{string \TypesetStringExpression{#1} set}% +} +\def\ifisdim#1\then{% + \generic@if{dimension \TypesetStringExpression{#1} set}% +} +\def\ifiscommand#1\then{% + \generic@if{command \normalfont{\ttfamily\string#1} set}% +} +%</doc> +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\unsetint} +% \begin{macro}{\unsetstr} +% \begin{macro}{\unsetdim} +% \begin{macro}{\unsetcommand} +% \begin{macrocode} +%<*pkg> +\def\unsetint#1{\setsomething_global\x_cs\let{i-#1}\x_relax} +\def\unsetstr#1{\setsomething_global\x_cs\let{s-#1}\x_relax} +\def\unsetdim#1{\setsomething_global\x_cs\let{d-#1}\x_relax} +\def\unsetcommand#1{\setsomething_global\let#1=\undefined_command} +%</pkg> +% \end{macrocode} +% \missing{doc}{\unsetint} +% \missing{doc}{\unsetstr} +% \missing{doc}{\unsetdim} +% \missing{doc}{\unsetcommand} +% \begin{macrocode} +%<*doc> +%</doc> +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\offcommand} +% \begin{macro}{\oncommand} +% \multchanges{\cs{offcommand}\cs{oncommand}}{1.900}{1999/02/07} +% {Commands added. (LH)} +% The calls +% \begin{quote} +% |\offcommand|\meta{command}\\ +% |\oncommand|\meta{command} +% \end{quote} +% can be used to turn a command off (make it simply absorb its +% arguments but expand to nothing) or on (return it to normal) +% respectively. Their primary use is for ignoring some of the +% commands in \texttt{.mtx} files that \package{fontinst} generates +% from \texttt{.afm}, \texttt{.pl}, or other \texttt{.mtx} files. +% +% \describecsfamily{saved-\meta{\textbackslash command}} +% The normal definition of a command that has been turned off +% is saved as the control sequence |\saved-|\meta{command}. If the +% syntax of a command is tricky---not all arguments are read by the +% base command or its parameter text contains tokens that are not +% parameters---or if simply making it do nothing is not the expected +% `off' behaviour, then the automatic off-turning may not work. In such +% cases a handtooled off definition of the command \meta{command} +% may be provided as the control sequence |\off-|\meta{command}.^^A +% \describecsfamily{off-\meta{\textbackslash command}} +% +% Nothing happens if |\offcommand| is called for a command that is +% not on. Nothing happens if |\oncommand| is called for a command +% that is not off. +% \begin{macrocode} +%<*pkg> +\def\offcommand#1{ + \x_cs\ifx{saved-\string#1}\x_relax + \setsomething_global\x_cs\let{saved-\string#1}#1 + \x_cs\ifx{off-\string#1}\x_relax + \generate_off_command{#1} + \else + \setsomething_global \expandafter\let \expandafter#1 + \csname off-\string#1\endcsname + \fi + \fi +} +% \end{macrocode} +% \begin{macrocode} +\def\oncommand#1{ + \x_cs\ifx{saved-\string#1}\x_relax \else + \setsomething_global \expandafter\let \expandafter#1 + \csname saved-\string#1\endcsname + \setsomething_global\x_cs\let{saved-\string#1}\x_relax + \fi +} +%</pkg> +% \end{macrocode} +% \multchanges{\cs{offcommand}\cs{oncommand}}{1.914}{2000/05/28} +% {\package{fontdoc} definitions added. (LH)} +% \begin{macrocode} +%<*doc> +\def\offcommand#1{\Bheading{Turn off} \texttt{\string#1}} +\def\oncommand#1{\Bheading{Turn on} \texttt{\string#1}} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\generate_off_command} +% \begin{macro}{\count_hashes} +% \begin{macro}{\gobble_to_xrelax} +% |\generate_off_command|\meta{command} converts \meta{command} to +% an ``off'' version of itself by counting the number of arguments +% and defining it to gobble that many arguments. It cannot cope with +% commands whose parameter texts are not simply of the type +% \begin{quote} +% |#1#2|\textellipsis|#|$n$ +% \end{quote} +% \begin{macrocode} +%<*pkg> +\def\generate_off_command#1{ + \a_count=0 + \let\next=\count_hashes + \expandafter\next\meaning#1~->\x_relax + \b_count=0 + \a_toks={} + \loop \ifnum \b_count<\a_count + \advance \b_count 1 + \a_toks=\expandafter{\the\expandafter\a_toks \expandafter#### + \the\b_count} + \repeat + \setsomething_global \expandafter\def \expandafter#1 \the\a_toks {} +} +% \end{macrocode} +% \begin{macrocode} +\def\count_hashes#1#2{ + \if \hash_char#1 + \advance \a_count 1 + \else + \if -#1 + \if >#2 + \let\next=\gobble_to_xrelax + \fi\fi + \fi + \next#2 +} +\def\gobble_to_xrelax#1\x_relax{} +%</pkg> +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% Control sequences of the form +% \begin{quote} +% \describecsfamily{FD@s-\meta{name}}|\FD@s-|\meta{name} +% \end{quote} +% are used by \package{fontdoc} to store the values of string variables +% which have been assigned values; \meta{name} is the name of the string +% variable. Unlike the case in \package{fontinst}, the +% \package{fontdoc} |\setstr| command does not assign values to string +% variables, but |\SetStringVariable| does. +% +% The contents of the |\FD@s-|\meta{name} macros aren't really the +% string values, but code that will append the printable form of the +% corresponding string expression to |\toks@| and update other variables +% used by |\MakePrintable| accordingly. Typically it might look +% something like +% \begin{quote} +% |\toks@=\expandafter{\the\toks@ ab}| +% \end{quote} +% when the value of the string is |ab|. +% +% \begin{macro}{\SetStringVariable} +% \changes{1.916}{2001/01/24}{Command added. (LH)} +% The |\SetStringVariable| command has the syntax +% \begin{quote} +% |\SetStringVariable|\marg{variable name}\marg{new value} +% \end{quote} +% where \meta{variable name} and \meta{new value} are both string +% expressions. The \meta{variable name} must furthermore be a simple +% string expression. The command globally defines the corresponding +% |\FD@s-|\meta{name} control sequence to add the printable form of +% the \marg{new value} string to the |\toks@| token list register and, +% in case the \meta{new value} string is non-simple, sets the |@tempswa| +% switch to true. +% +% The control sequence |\@tempa| can be used as part of \meta{new +% value}, but not in the \meta{variable name}. +% \begin{macrocode} +%<*doc> +\newcommand\SetStringVariable[2]{% + \protected@edef\@tempa{\noexpand\MakePrintable \noexpand\@tempa + {FD@swa}{#2}}% + \@tempa + \protected@edef\@tempa{% + \toks@=\noexpand\expandafter{\noexpand\the \toks@ \@tempa}% + \ifFD@swa \noexpand\@tempswatrue \fi + }% + \protected@edef\@tempb{\noexpand\MakePrintable \noexpand\@tempb + {FD@swa}{#1}}% + \@tempb + \ifFD@swa + \begingroup + \let\PrintChar=\FD@quoted@PrintChar + \global\expandafter\let \csname FD@s-\@tempb\endcsname \@tempa + \endgroup + \else + \PackageError{fontdoc}{Names of string variables must be + simple\MessageBreak if they are to be assigned values}\@eha + \fi +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \subsection{For loops} +% +% +% \begin{macro}{\for} +% \begin{macro}{\endfor} +% \multchanges{\cs{for}\cs{endfor}}{1.900}{1999/02/16}{Commands +% added. (LH)} +% The command sequence +% \begin{quote} +% |\for|\parg{name}\marg{start}\marg{stop}\marg{step}\\ +% \vadjust{}\quad\meta{body code}\\ +% |\endfor|\parg{name} +% \end{quote} +% will cause the \meta{body code} to be repeated some number of times. +% How many depends on the values of \meta{start}, \meta{stop}, and +% \meta{step}, which are integer expressions. +% +% As a precaution, the \meta{body code} is not allowed to contain any +% empty lines (|\par| tokens). If you want to have the visual +% separation (for sakes of legibility or otherwise), put a |%| +% somewhere on the line---that makes it nonempty. +% +% \meta{name} is used as the name of an integer variable. This +% variable gets reset to the value of \meta{start} before the first +% repetition of \meta{body code}. After each repetition but the last, +% it is incremented by \meta{step}. \meta{body code} gets repeated if +% the value of \meta{name} has not gotten past that of \meta{stop}. To +% get past means to be bigger if \meta{step} is positive and to be +% smaller if \meta{step} is negative. In the case that \meta{step} is +% zero, the entire construction above will be equivalent to +% \begin{quote} +% |\resetint|\marg{name}\marg{start}\\ +% \meta{body code} +% \end{quote} +% +% |\for| \textellipsis\ |\endfor| constructions can be nested. +% \meta{name} is used by |\for| to identify its matching |\endfor|, so +% they need to be identical in |\for| and |\endfor|. +% +% \multchanges{\cs{for}\cs{for_i}\cs{foreach}}{1.914}{2000/05/21} +% {\cs{setsomething_global} added to assignments of the +% \cs{for-\meta{name}} and \cs{body-\meta{name}} control +% sequences. (LH)} +% \begin{macrocode} +%<*pkg> +\def\for(#1)#2#3#4{ + \eval_expr_to\a_count{#2} + \x_resetint{#1}{\a_count} + \eval_expr{#4} + \ifnum 0=\result \else + \c_count=\result + \eval_expr_to\b_count{#3} + \setsomething_global\x_cs\edef{for-#1}{ + \the\c_count \x_relax + \noexpand\ifnum \gobble_one\fi + \the\b_count \ifnum 0>\c_count > \else < \fi + } + \def\next##1##2##3\endfor(#1){##2\for_i{##1}{##3}} + \next{#1} + \fi +} +% \end{macrocode} +% +% The macro \describecsfamily{for-\meta{name}}|\for-|\meta{name} +% will contain +% \begin{quote} +% \meta{step}|\x_relax\ifnum|\meta{stop}\meta{rel} +% \end{quote} +% \meta{step} is the value of the \meta{step} parameter of |\for|, +% computed when the loop was entered and now expressed in digits. +% \meta{stop} is likewise for the \meta{stop} parameter. \meta{rel} +% is |>| or |<|, depending on whether \meta{step} is positive or +% negative respectively. The reason for this curious definition will +% be appearent in the light of the definition of |\for_ii|. +% +% |\for_i| is expanded in the context +% \begin{quote} +% |\for_i|\marg{name}\marg{body code} +% \end{quote} +% Also remember, when reading the definition below, that |\ifnum| +% keeps on expanding tokens until it has found a +% \begin{quote} +% \meta{number}\meta{relation}\meta{number} +% \end{quote} +% structure. It is therefore possible to nest |\ifnum|s like this! +% +% \begin{macrocode} +\def\for_i#1#2{ + \setsomething_global\x_cs\def{body-#1}{#2} + \ifnum \b_count \ifnum0>\c_count >\else<\fi \a_count + \expandafter\gobble_two + \else + \csname body-#1 \expandafter\endcsname + \fi + \for_ii{#1} +} +% \end{macrocode} +% +% The macro \describecsfamily{body-\meta{name}}|\body-|\meta{name} +% expands to the \meta{body code}. +% +% |\for_ii| executes the following code: +% \begin{quote} +% |\a_count=\int|\marg{name}\\ +% |\advance \a_count |\meta{step}|\x_relax|\\ +% |\ifnum |\meta{stop}\meta{rel}|\a_count|\\ +% | \expandafter\gobble_two|\\ +% |\else|\\ +% | \resetint|\marg{name}|\a_count|\\ +% | \csname body-|\meta{name}| \expandafter\endcsname|\\ +% |\fi|\\ +% |\for_ii|\marg{name} +% \end{quote} +% \meta{step}, \meta{stop}, and \meta{rel} are in |\for-|\meta{name}, +% and since there only are two other tokens between \meta{step} and +% \meta{rel} in the above, one might as well include them in +% |\for-|\meta{name} as well. Doing that requires that a matching +% hole---that will be filled in by |\for-|\meta{name}---is made in the +% definition of |\for_ii| and that is the reason for its somewhat +% curious definition. +% +% \begin{macrocode} +\def\for_ii#1{ + \a_count=\int{#1} + \advance \a_count \csname for-#1\endcsname \a_count + \expandafter\gobble_two + \else + \x_resetint{#1}\a_count + \csname body-#1 \expandafter\endcsname + \fi + \for_ii{#1} +} +% \end{macrocode} +% +% |\endfor| just gobbles its argument, so that the \meta{step}${}=0$ +% case will work right. +% +% \begin{macrocode} +\def\endfor(#1){} +%</pkg> +% \end{macrocode} +% \missing{doc}{\for} +% \missing{doc}{\endfor} +% \begin{macrocode} +%<*doc> +%</doc> +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \begin{macro}{\foreach} +% \changes{1.901}{1999/03/07}{Command added. (LH)} +% \changes{1.916}{2001/01/24}{\package{fontdoc} definition added. (LH)} +% \begin{macro}{\foreach_i} +% The command sequence +% \begin{quote} +% |\foreach|\parg{name}\marg{csep-list}\\ +% \vadjust{}\quad\meta{body code}\\ +% |\endfor|\parg{name} +% \end{quote} +% will cause the \meta{body code} to be repeated one time for each item +% in the \meta{csep-list}. \meta{csep-list} is a comma-separated list +% of strings. +% +% As a precaution, the \meta{body code} is not allowed to contain any +% empty lines (|\par| tokens). If you want to have the visual +% separation (for sakes of legibility or otherwise), put a |%| +% somewhere on the line---that makes it nonempty. +% +% \meta{name} is used as the name of a string variable. Before each +% repetition of the \meta{body code}, this variable will get reset to +% the next item in the \meta{csep-list}. +% +% |\for|\textellipsis\ |\endfor| constructions can be nested. +% \meta{name} is used by |\foreach| to identify its matching |\endfor|, +% so they need to be identical in |\foreach| and |\endfor|. +% +% \begin{macrocode} +%<*pkg> +\def\foreach(#1)#2{ + \def\next##1\endfor(#1){ + \setsomething_global\x_cs\def{body-#1}{##1} + \process_csep_list{\foreach_i{#1}}#2,\process_csep_list, + } + \next +} +\def\foreach_i#1#2{ + \resetstr{#1}{#2} + \csname body-#1\endcsname +} +%</pkg> +%<*doc> +\def\foreach(#1)#2{% + \def\next##1\endfor(#1){% + \@for\@tempa:=#2\do{% + \SetStringVariable{#1}{\@tempa}% + ##1% + }% + }% + \next +} +%</doc> +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% +% \subsection{Comments} +% +% \changes{1.911}{1999/11/30}{Comment commands included in +% \texttt{finstmsc.sty}. (LH)} +% +% \begin{macro}{\comment} +% In \package{fontinst}, |\comment| simply gobbles its argument. +% \begin{macrocode} +%<pkg>\let\comment=\gobble_one +% \end{macrocode} +% +% In \package{fontdoc}, |\comment| starts a new text paragraph and +% leaves the argument to be typeset. +% \begin{macrocode} +%<*doc> +\def\comment{\par\noindent} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\begincomment} +% \changes{1.900}{1999/02/07}{Command added. (LH)} +% \begin{macro}{\endcomment} +% \changes{1.900}{1999/02/07}{Command added. (LH)} +% Since |\comment| cannot be used for a comment longer than one +% paragraph, we also provide the means of introducing longer comments, +% by writing +% \begin{quote} +% |\begincomment| \meta{any amount of text} |\endcomment| +% \end{quote} +% The names are admittedly not nice from a \LaTeX\ point of view, but +% it is hardly worth the cost to implement some kind of environment +% processing in \package{fontinst}, just for the sake of this command. +% \begin{macrocode} +%<pkg>\let\begincomment=\iffalse +%<doc>\let\begincomment=\iftrue +%<pkg|doc>\let\endcomment=\fi +% \end{macrocode} +% \end{macro} \end{macro} +% +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/fontinst/base/ficonv.dtx b/Master/texmf-dist/source/fontinst/base/ficonv.dtx new file mode 100644 index 00000000000..e1fee953b8c --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/ficonv.dtx @@ -0,0 +1,2807 @@ +% \CheckSum{2221} +% \iffalse meta-comment +% +% Copyright 1993, 1994, 1995, 1996 Alan Jeffrey, +% hacked and maintained 1997, 1998 Sebastian Rahtz, +% copyright 1998, 1999, 2000 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. +% ----------------------------------------------------- +% +% 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: ficonv.dtx +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{fisource} +\title{The \package{fontinst} utility} +\author{Alan Jeffrey, Sebastian Rahtz, Ulrik Vieth, Lars Hellstr\"om} +\begin{document} +\maketitle +\tableofcontents +\DocInput{ficonv.dtx} +\end{document} +%</driver> +% \fi +% +% \StopEventually{} +% +% \section{Basic file format conversions} +% \label{Sec:Conv. input} +% \changes{1.902}{1999/05/01}{Collected the material in Section +% \thesection\space and moved it to \texttt{ficonv.dtx}. (LH)} +% \changes{1.926}{2003/07/12}{Added some missing \textasciitilde's +% at ends of lines. (LH)} +% +% \subsection{Converting an ENC file to an ETX file} +% +% \DescribeMacro{\enctoetx} +% The macro +% \begin{quote} +% |\enctoetx|\marg{encfile}\marg{etxfile} +% \end{quote} +% 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> +\newif\ifmissingslots +\x_cs\def{o-.notdef}#1{\global\missingslotstrue} +% \end{macrocode} +% +% \begin{macro}{\enctoetx} +% \begin{macrocode} +{ + \catcode`\/=\active + \catcode`\]=\active + \gdef\enctoetx#1#2{{ + \catcode`\/=\active + \catcode`\]=\active + \def/##1[{ + \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 + } + } + \def]~def{} + \make_etx{#1}{#2} + }} +} +% \end{macrocode} +% \end{macro} +% +% |\make_etx| finishes the job of |\enctoetx|. +% +% \begin{macrocode} +\def\make_etx#1#2{ + \open_out{\temp_prefix#2.etx} + \out_line{\percent_char~Filename:~#2.etx} + \out_line{\percent_char~Created~by:~tex~\jobname} + \out_line{\percent_char~Created~using:~\string\enctoetx{#1}{#2}} + \out_line{} + \out_line{\percent_char~This~file~contains~the~ + information~of~#1.enc~in~a~form} + \out_line{\percent_char~more~easily~read~by~TeX.~ + It~is~used~by~the~fontinst~package.} + \out_line{} + \out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.} + \out_line{} + \out_line{\string\relax} + \out_line{} + \out_line{\string\documentclass[twocolumn]{article}} + \out_line{\string\usepackage{fontdoc}} + \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{} + \out_line{\string\encoding} + \out_line{} + \out_line{\string\needsfontinstversion{\fontinstversion}} + \out_line{} + \primitiveinput #1.enc\x_relax + \out_line{} + \out_line{\string\end encoding} + \out_line{} + \out_line{\string\end{document}} + \close_out{Encoding~vector} +} +% \end{macrocode} +% +% +% \subsection{Converting an ETX file to an ENC file} +% \changes{1.911}{1999/11/21}{ETX to ENC converter added. (LH)} +% +% \DescribeMacro{\etxtoenc} +% The command +% \begin{quote} +% |\etxtoenc|\marg{etxfile}\marg{encfile} +% \end{quote} +% reads \meta{etxfile}|.etx| and generates a postscript encoding file +% \meta{encfile}|.enc| that specifies the same encoding vector. +% +% +% \begin{macro}{\notdef_name} +% This macro holds the name of the \texttt{.notdef} glyph, which must +% be put in all encoding positions where there is no other glyph. +% \begin{macrocode} +\def\notdef_name{.notdef} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\etxtoenc} +% The conversion has three steps. First the \texttt{.notdef} glyph is +% assigned to every slot in the encoding, then the ETX file is read +% and the assignments are changed for the slots which are not +% unassigned in the encoding, and finally the ENC file is written. +% The first two steps are carried out by |\etxtoenc|, but the final +% step is handled by |\make_enc|. +% \changes{1.927}{2004/07/12}{Made the \meta{etxfile} argument a +% comma-separated list of ETX files. Changed \cs{do_slot} definition +% to get set rather than reset semantics. (LH) Feature requested +% by Werner Lemberg.} +% \begin{macrocode} +\def\etxtoenc#1#2{\begingroup + \a_count=\z@ + \loop + \x_cs\let{name-\the\a_count}=\notdef_name + \ifnum \@cclv>\a_count + \advance \a_count \@ne + \repeat + \def\do_slot{ + \x_cs\ifx{name-\the\slot_number}\notdef_name + \x_cs\edef{name-\the\slot_number}{\slot_name} + \fi + } + \process_csep_list\inputetx #1,\process_csep_list, + \make_enc{#1}{#2} +\endgroup} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\make_enc} +% The command +% \begin{quote} +% |\make_enc|\marg{etxfiles}\marg{encfile} +% \end{quote} +% creates the file \meta{encfile}|.enc| and writes to that file the +% definition of the postscript encoding vector which corresponds to +% the encoding currently stored in the |\name-|\meta{slot} family of +% macros. That encoding is assumed to be defined by the files listed +% in the \meta{etxfiles}. +% +% \changes{1.911}{1999/12/02}{Storing encoding name in string +% \texttt{encodingname}, thus allowing the ETX file to override +% the default. (LH)} +% \changes{1.912}{2000/02/12}{Also calling \cs{declarepsencoding} +% once the encoding file has been written. (LH)} +% \changes{1.914}{2000/05/14}{Not writing an \texttt{address} entry +% if that string isn't set. (LH)} +% \changes{1.919}{2001/08/02}{Added DSC comments. (LH)} +% \changes{1.927}{2004/07/12}{Modified to handle a comma-separated +% list of ETX files. (LH)} +% \begin{macrocode} +\def\make_enc#1#2{ + \setstr{encodingname}{fontinst-autoenc-#1} + \def\a_macro##1{ + \add_to\b_macro{##1.etx} + \def\a_macro####1{ + \add_to\b_macro{,~####1.etx} + } + } + \let\b_macro\empty_command + \process_csep_list\a_macro #1,\process_csep_list, + \open_out{#2.enc} + \out_line{\percent_char !PS-Adobe-3.0~Resource-Encoding} + \out_line{\percent_char\space @psencodingfile\left_brace_char} + \ref_to_sourcefile{author}\b_macro + \ref_to_sourcefile{version}\b_macro + \out_line{\percent_char\four_spaces date~=~"generated~ + \the\year/ + \ifnum10>\month0\fi\the\month/ + \ifnum10>\day0\fi\the\day",} + \out_line{\percent_char\four_spaces filename~=~"\out_filename",} + \ref_to_sourcefile{email}\b_macro + \ifisstr{address}\then + \out_line{\percent_char\four_spaces address~=~\str{address}} + \fi + \out_line{\percent_char\four_spaces codetable~=~"ISO/ASCII",} + \out_line{\percent_char\four_spaces checksum~=~"",} + \out_line{\percent_char\four_spaces abstract~=~" + This~is~a~postscript~encoding~file,~automatically~ + generated~by~fontinst~from~\b_macro."} + \out_line{\percent_char\space\right_brace_char} + \out_line{} + \out_line{\percent_char\space Created~by:~tex~\jobname} + \out_line{\percent_char\space Created~using:~ + \string\etxtoenc{#1}{#2}} + \out_line{} + \out_line{\percent_char\space This~file~should~be~installed~ + somewhere~that~your~DVI} + \out_line{\percent_char\space to~postscript~driver~looks~for~files.~ + It~is~needed~for} + \out_line{\percent_char\space reencoding~some~font~you~have~ + transformed.} + \out_line{} + \out_line{\percent_char\space After~installing~this~file,~you~ + should~add~the~following} + \out_line{\percent_char\space line~(minus~\percent_char)~ + to~your~finstmsc.rc~file:} + \out_line{\percent_char\space\string\declarepsencoding + {#1}{\str{encodingname}}{\string\download{\out_filename}}} + \edef\a_macro{ + \noexpand\declarepsencoding{#1}{\str{encodingname}} + {\noexpand\download{\out_filename}} + } + \a_macro + \out_line{} + \out_line{\percent_char\percent_char BeginResource:~ + encoding~\str{encodingname}} + \out_line{/\str{encodingname}\space[} + \b_count=8 + \a_count=\z@ + \loop + \ifnum 8=\b_count + \b_count=\z@ + \out_line{\percent_char\space\the\a_count} + \fi + \out_line{/\csname name-\the\a_count \endcsname} + \ifnum \@cclv>\a_count + \advance \a_count \@ne + \advance \b_count \@ne + \repeat + \out_line{]~def} + \out_line{\percent_char\percent_char EndResource} + \out_line{} + \out_line{\percent_char\space End~of~file~\out_filename.} + \close_out{Encoding~vector} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ref_to_sourcefile} +% The command +% \begin{quote} +% |\ref_to_sourcefile|\marg{field}\marg{sourcefile} +% \end{quote} +% writes a \meta{field} field of a \BibTeX-style header to the +% current main output file. If the string named \meta{field} is set +% then the value for this field will be that string, and if it isn't +% set then the value will be the string \texttt{"See file }^^A +% \meta{sourcefile}\texttt{"}. Note that the string \#1 is not +% quoted, so it must contain the quotes if it isn't simply an integer. +% \begin{macrocode} +\def\ref_to_sourcefile#1#2{ + \ifisstr{#1}\then + \out_line{\percent_char\four_spaces #1~=~\str{#1},} + \else + \out_line{\percent_char\four_spaces #1~=~"See~file~#2",} + \fi +} +%</misc> +% \end{macrocode} +% \end{macro} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \subsection{Converting an AFM file to an MTX file} +% +% \DescribeMacro{\afmtomtx} +% The macro +% \begin{quote} +% |\afmtomtx|\marg{afmfile}\marg{mtxfile} +% \end{quote} +% reads \meta{afmfile}|.afm|, and writes the same information out to +% \meta{mtxfile}|.mtx|. +% +% \begin{macro}{\afmtomtx} +% \changes{1.911}{1999/11/18}{Changed setting of \cs{raw_font_name} +% to \cs{edef} and added setting of \cs{source_font_name}. (LH)} +% \changes{1.917}{2001/03/13}{Added resetting of +% \cs{setsomething_global}---assignments made here must be +% local. (LH)} +% \begin{macrocode} +%<*pkg> +\def\afmtomtx#1#2{{ + \let\setsomething_global=\x_relax + \open_out{\temp_prefix#2.mtx} + \edef\raw_font_name{#2} + \edef\source_font_name{#1} + \x_resetint{italicslant}{0} + \let\italcorr_expression=\uprightitalcorr + \x_setint{minimumkern}{0} + \minimum_kern=\int{minimumkern} + \out_line{\percent_char~Filename:~#2.mtx} + \out_line{\percent_char~Created~by:~tex~\jobname} + \out_line{\percent_char~Created~using:~\string\afmtomtx{#1}{#2}} + \out_line{} + \out_line{\percent_char~This~file~contains~the~ + information~of~#1.afm~in~a~form} + \out_line{\percent_char~more~easily~read~by~TeX.~ + It~is~used~by~the~fontinst~package.} + \out_line{} + \out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.} + \out_line{} + \out_line{\string\relax} + \out_line{\string\metrics} + \out_line{} + \out_line{\string\needsfontinstversion{\fontinstversion}} + \out_line{} + \catcode`\^^M=12 + \catcode`\ =10 + \expandafter\afm_line\primitiveinput #1.afm\x_relax + \out_line{} + \out_line{\endmetrics_text} + \close_out{Metrics} +}} +% \end{macrocode} +% \end{macro} +% +% Kerns below this value are ignored. +% +% \begin{macrocode} +\newcount\minimum_kern +% \end{macrocode} +% +% +% \begin{macro}{\afm_length} +% \changes{1.900}{1998/12/28}{Macro added, other macros modified to +% use it. (LH)} +% \begin{macro}{\afm_unit_dimen} +% The call |\afm_length|\meta{count}\marg{real} +% interprets the \meta{real} as a real number, rounds it to the +% nearest integer, and sets the \meta{count} (a |\count| register) +% to that integer. In this process, |\a_dimen| is used as a temporary +% storage. +% \begin{macrocode} +\def\afm_length#1#2{ + \a_dimen=#2\afm_unit_dimen + #1=\a_dimen + \divide #1 by \afm_unit_dimen + \advance \a_dimen by -#1\afm_unit_dimen + \ifdim \a_dimen>0.5\afm_unit_dimen + \advance #1 by 1 + \else \ifdim \a_dimen<-0.5\afm_unit_dimen + \advance #1 by -1 + \fi\fi + \x_relax +} +% \end{macrocode} +% The dimen |\afm_unit_dimen| is used to keep track of how long an AFM +% unit is interpreted as being in this routine. Lowering its value +% makes |\afm_length| capable of handling greater lengths but looses +% some very slight precision in the rounding, increasing the value +% has the opposite effects. The current value of 1000\thinspace sp +% means it reads lengths with three decimals accuracy (not very much +% use for them though as the number is rounded to zero decimals +% accuracy anyway, but it does make a difference when deciding how +% a \meta{real} like |0.502| should be rounded) and can handle lengths +% of an absolute value of a good million AFM units. This should be +% adequate in most cases. It is, by the way, probably wisest to keep +% it a power of ten scaled points in all cases, as this should reduce +% the rounding errors caused by various base conversions. +% \begin{macrocode} +\newdimen\afm_unit_dimen +\afm_unit_dimen=1000sp +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% The command |\afm_line| reads to the end of the line, calls +% |\afm_command| on that line, then calls |\afm_line| again. +% +% \begin{macrocode} +{\catcode`\^^M=12 \gdef\afm_line#1 +{\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 +% eat up the rest of the line. +% +% \begin{macrocode} +\def\afm_command#1~{\csname~afm-#1\endcsname\gobble_one_line} +\def\gobble_one_line#1\end_of_line{} +% \end{macrocode} +% +% This all stops when we reach the command |EndFontMetrics|. +% +% \begin{macrocode} +\x_cs\def{afm-EndFontMetrics}#1\afm_line{\endinput} +% \end{macrocode} +% +% \begin{macro}{\afm_def} +% 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}} +% \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. +% \begin{macrocode} +\def\afm_let#1#2{ + \expandafter\let \csname afm-#1\expandafter\endcsname + \csname afm-#2\endcsname +} +% \end{macrocode} +% \end{macro} +% +% For example, we can define the following AFM commands: +% \changes{1.6}{1997/02/07}{AFM commands fixed, to get fontdimens +% comparable to EC fonts. (Thierry Bouche)} +% ^^A (Fixed by Thierry Bouche +% ^^A 1997/02/07, to get fontdimens comparable to EC fonts.) +% \changes{1.912}{2000/02/20}{AFM command \texttt{StdVW} now +% interpreted: generates \cs{setint} for integer +% \texttt{verticalstem}. (LH)} +% +% \begin{macrocode} +\afm_def{CharWidth}(#1){\afm_length\char_x_width{#1}} +\afm_def{ItalicAngle}(#1~){\calculate_it_slant{#1}} +\afm_def{XHeight}(#1){ + \afm_length\a_count{#1} + \out_line{\string\setint{xheight}{\the\a_count}}} +\afm_def{CapHeight}(#1){ + \afm_length\a_count{#1} + \out_line{\string\setint{capheight}{\the\a_count}}} +\afm_def{Ascender}(#1){ + \afm_length\a_count{#1} + \out_line{\string\setint{ascender}{\the\a_count}}} +\afm_def{Descender}(#1){ + \afm_length\a_count{#1} + \out_line{\string\setint{descender_neg}{\the\a_count}}} +\afm_def{UnderlineThickness}(#1){ + \afm_length\a_count{#1} + \out_line{\string\setint{underlinethickness}{\the\a_count}}} +\afm_def{FontBBox}(#1~#2~#3~#4){ + \afm_length\a_count{#4} + \out_line{\string\setint{maxheight}{\the\a_count}} + \afm_length\a_count{#2} + \out_line{\string\setint{maxdepth_neg}{\the\a_count}}} +\afm_def{StdVW}(#1){ + \afm_length\a_count{#1} + \out_line{\string\setint{verticalstem}{\the\a_count}}} +\afm_def{IsFixedPitch}(#1){ + \if\first_char#1=f + \else\out_line{\string\setint{monowidth}{1}} + \fi +} +% \end{macrocode} +% +% \multchanges{\cs{afm_font_name}}{1.901}{1999/03/06}{Macro added. (LH)} +% \multchanges{\cs{afm_font_name}}{1.911}{1999/11/18}{Macro removed, +% since no longer needed. (LH)} +% +% \begin{macro}{\afm-FontName} +% The |FontName| of a font is needed for the |\storemapdata| command, +% so it is when that is encountered that this is written. This +% information is of no use when making TFMs and VFs, but it is likely +% to be of use for generation of map files, so it will be included in +% a file of recorded transforms, if such a file is being generated. +% \begin{macrocode} +\afm_def{FontName}(#1~){ + \record_transform{\raw_font_name} + {\string\fromafm{\source_font_name}{#1}}{}\iftrue +} +% \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{macrocode} +\afm_def{KP}(#1~#2~#3~#4){ + \if\first_char#1=.\else + \if\first_char#2=.\else + \afm_length\a_count{#3} + \ifnum \a_count>\minimum_kern + \out_line{\string\setkern{#1}{#2}{\the\a_count}} + \else\ifnum \a_count<-\minimum_kern + \out_line{\string\setkern{#1}{#2}{\the\a_count}} + \fi\fi + \fi\fi +} +\afm_let{KPX}{KP} +% \end{macrocode} +% +% Processing char metrics. +% +% \begin{macrocode} +\afm_def{C}(#1~;#2){\init_afm{#1}\do_list[#2]\afm_char} +\afm_let{CH}{C} +% \end{macrocode} +% +% Processing composite chars. +% +% \begin{macrocode} +\afm_def{CC}(#1~#2~;#3){\init_cc{#1}\do_list[#3]\cc_char} +% \end{macrocode} +% +% When parsing a character, we set the values of the following +% variables: +% +% \begin{macrocode} +\newcount\char_slot +\newcount\char_x_width +\newcount\x_width +\newcount\bbox_llx +\newcount\bbox_lly +\newcount\bbox_urx +\newcount\bbox_ury +\let\char_name=\empty_command +% \end{macrocode} +% +% |\init_afm| initializes the variables the AFM character list writes to. +% +% \begin{macrocode} +\def\init_afm#1{ + \char_slot=#1\x_relax + \x_width=\char_x_width + \bbox_llx=0 + \bbox_lly=0 + \bbox_urx=0 + \bbox_ury=0 + \let\char_name=\empty_command +} +% \end{macrocode} +% +% ^^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{macrocode} +\def\afm_char{ + \a_count=-\bbox_lly + \eval_expr{ + \italcorr_expression\x_width\bbox_llx\bbox_urx\bbox_lly\bbox_ury + } + \out_line{ + \ifnum -1<\char_slot + \string\setrawglyph + \else + \string\setnotglyph + \fi + {\char_name} + {\raw_font_name} + {10pt} + {\the\char_slot} + {\the\x_width} + {\the\bbox_ury} + {\the\a_count} + {\the\result} + } +} +% \end{macrocode} +% +% |\init_cc| and |\cc_char| write out a composite character glyph. +% +% \begin{macrocode} +\def\init_cc#1{% + \out_line{\string\setglyph{#1}} + \def\char_name{#1} +} +\def\cc_char{% + \out_lline{\string\samesize{\char_name-not}} + \out_line{\string\endsetglyph} +} +% \end{macrocode} +% +% +% \changes{1.900}{1998/12/28}{Method of computing italic corrections +% changed to using an integer expression. (LH)} +% \DescribeMacro{\italcorr_expression} +% The way the italic correction is computed has been changed +% quite a bit, although the computed values are still the same. +% The point is that it is much simpler to modify the formula according +% to which the value is computed using this method than using the +% previous method. +% +% The call +% \begin{quote} +% |\italcorr_expression|\marg{width}\marg{left}^^A +% \marg{right}\marg{bottom}\marg{top}, +% \end{quote} +% where the arguments are \TeX\ \meta{number}s, should expand to an +% integer expression. The value of that expression will be taken as the +% italic correction of the current character. +% +% \meta{width} is the width of the character. \meta{left}, +% \meta{right}, \meta{bottom}, and \meta{top} are the respective +% coordinates of the sides of the bounding box of the character. A +% quantity which is not given as an argument, but which nontheless +% might be of interest for a calculation of italic correction, is the +% italic slant of the font. This quantity can be found in the fontinst +% integer \texttt{italicslant}. (The MTX file written will also set +% the integer \texttt{italicslant} to this value.) +% +% \begin{macro}{\uprightitalcorr} +% \begin{macro}{\slanteditalcorr} +% These two commands are what |\italcorr_expression| will get set +% to---the slanted version is used if the italic slant is positive and +% the upright version is used otherwise. The default definitions +% compute the same values as in fontinst v\,1.8, but the definitions +% can easily be modified using |\resetcommand|. +% \begin{macrocode} +\def\uprightitalcorr#1#2#3#4#5{0} +\def\slanteditalcorr#1#2#3#4#5{\max{\sub{#3}{#1}}{0}} +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \begin{macro}{\calculate_it_slant} +% To set the italic angle, we need to calculate the tangent of the +% angle that the |.afm| file contains. This is done with David +% Carlisle's \package{trig} macros. Note that the \package{trig} +% macros don't like a space at the end of their argument. +% +% \changes{1.911}{1999/11/18}{Stripping off the space in +% \cs{afm-ItalicAngle}. (LH)} +% ^^A\question{\cs{afm_line} always inserts a space at the end of the line.} +% ^^ACould we therefore save us a bit of trouble by simply changing the +% ^^Apattern for |\ItalicAngle| to |(#1~)|? /LH +% +% \begin{macrocode} +\def\calculate_it_slant#1{ + \edef\theangle{#1} + \CalculateTan{\theangle} + \a_dimen=-\one_thousand sp + \a_dimen=\UseTan{\theangle}\a_dimen + \a_count=\a_dimen + \out_line{\string\setint{italicslant}{\the\a_count}} + \x_resetint{italicslant}{\a_count} + \ifnum 0<\a_count + \let\italcorr_expression=\slanteditalcorr + \else + \let\italcorr_expression=\uprightitalcorr + \fi +} +% \end{macrocode} +% \begin{macrocode} +% \def\strip_spaces#1~#2\end_strip_spaces{#1} +% \end{macrocode} +% \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|. +% +% \begin{macrocode} +\def\do_list[~#1~#2;~#3]{ + \csname~list-#1\endcsname\gobble_one_semi#2; + \ifx\x_relax#3\x_relax\expandafter\gobble_one + \else\expandafter\identity_one\fi + {\do_list[~#3]} +} +\def\gobble_one_semi#1;{} +% \end{macrocode} +% +% There is an analagous |\list_def| for defining commands to be used +% inside lists. +% +% \begin{macrocode} +\def\list_def#1(#2)#3{\x_cs\def{list-#1}\gobble_one_semi#2~;{#3}} +% \end{macrocode} +% +% For example, these are the commands that are used in giving +% character metrics: +% +% \begin{macrocode} +\list_def{W}(#1~#2){\afm_length\x_width{#1}} +\list_def{WX}(#1){\afm_length\x_width{#1}} +\list_def{WY}(#1){} +\list_def{N}(#1){\def\char_name{#1}} +\list_def{B}(#1~#2~#3~#4){ + \afm_length\bbox_llx{#1} + \afm_length\bbox_lly{#2} + \afm_length\bbox_urx{#3} + \afm_length\bbox_ury{#4} +} +\list_def{PCC}(#1~#2~#3){ + \afm_length\a_count{#2} + \afm_length\b_count{#3} + \out_lline{\string\glyphpcc{#1}{\the\a_count}{\the\b_count}} +} +% \end{macrocode} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \subsection{Converting a PL file to an MTX file} +% +% \DescribeMacro{\generalpltomtx}The macro +% \begin{quote} +% |\generalpltomtx|\marg{plfile}\marg{mtxfile}\marg{plsuffix}\relax +% \marg{opt-enc} +% \end{quote} +% reads \meta{plfile}|.|\meta{plsuffix}, interprets it as having the +% encoding specified by the file \meta{opt-enc}|.etx|, and writes the +% same metric information out to \meta{mtxfile}|.mtx|. In case +% \meta{opt-enc} is empty, the encoding will be determined using the +% |CODINGSCHEME| property of the file being read. +% \DescribeMacro{\pltomtx}The macro +% \begin{quote} +% |\pltomtx|\marg{plfile}\marg{mtxfile} +% \end{quote} +% reads \meta{plfile}|.pl|, uses the |CODINGSCHEME| property in that +% file to determine its encoding, and writes the same metric information +% out to \meta{mtxfile}|.mtx|. +% +% None of these commands can cope with |SKIP| properties in the (V)PL +% file. +% +% \begin{macro}{\generalpltomtx} +% \changes{1.902}{1999/05/01}{Command added, removed +% \cs{pltomtxgivenetx}. (LH)} +% \changes{1.910}{1999/11/01}{Made this command the standard one, +% which \cs{pltomtx} calls. (UV\&LH)} +% \changes{1.917}{2001/03/13}{Added resetting of +% \cs{setsomething_global}---assignments made here must be +% local. (LH)} +% \changes{1.923}{2002/12/03}{Changed test of fourth argument to +% instead of \cs{ifx} use \cs{if}. This is more versatile. (LH)} +% \begin{macrocode} +\def\generalpltomtx#1#2#3#4{{ + \let\setsomething_global=\x_relax + \let\setfontdimen=\pl_setfontdimen + \if _#4_ \else + \def\do_slot{\x_cs\let{name-\the\slot_number}\slot_name} + \def\do_boundary{\x_cs\let{name-BOUNDARYCHAR}\slot_name} + \inputetx{#4} + \let\CODINGSCHEME=\ignore_parens + \fi + \pl_to_mtx{#1}{#2}{#3}{\string\generalpltomtx{#1}{#2}{#3}{#4}} +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pltomtx} +% \begin{macrocode} +\def\pltomtx#1#2{\generalpltomtx{#1}{#2}{pl}{}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\pl_to_mtx} +% \changes{1.911}{1999/11/19}{\cs{edef}ing \cs{raw_font_name}. (LH)} +% The |\pl_to_mtx| macro contains all code that was common to +% |\pltomtx| and |\general|\-|pltomtx| before the former was redefined +% to a call of the latter. The structure of a call of |\pl_to_mtx| is +% \begin{quote} +% |\pl_to_mtx|\marg{plfile}\marg{mtxfile}\marg{plsuffix}\marg{call} +% \end{quote} +% \meta{call} is what should be written in the ``Created using:'' +% comment at the top of the MTX file written. +% \changes{1.921}{2002/07/27}{\cs{fromvpl} in \cs{storemapdata} does +% not have an argument. Fixed a bug that produced such an argument +% anyway. (LH)} +% \begin{macrocode} +\def\pl_to_mtx#1#2#3#4{ + \edef\raw_font_name{#1} + \open_out{\temp_prefix#2.mtx} + \out_line{\percent_char~Filename:~#2.mtx} + \out_line{\percent_char~Created~by:~tex~\jobname} + \out_line{\percent_char~Created~using:~#4} + \out_line{} + \out_line{\percent_char~This~file~contains~the~ + information~of~#1.#3~in~a~form} + \out_line{\percent_char~more~easily~read~by~TeX.~ + It~is~used~by~the~fontinst~package.} + \out_line{} + \out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.} + \out_line{} + \out_line{\string\relax} + \out_line{\string\metrics} + \out_line{} + \out_line{\string\needsfontinstversion{\fontinstversion}} + \out_line{} + \lowercase{ + \record_transform{#2}{ + \string\from#3 \x_cs\ifx{from#3}\frompl {#1} \fi + }{}\iftrue + } + \out_line{} + \catcode`\(=0 \catcode`\)=9 + \let\/=\ignore_parens + \let\do_pl_glyph=\x_relax + \primitiveinput #1.#3\x_relax + \do_pl_glyph + \out_line{} + \ifisint{\percent_char boundarychar}\then + \f_count=\int{\percent_char boundarychar} + \x_cs\ifx{name-\the\f_count}\x_relax \else + \out_line{\string\setstr{rightboundary} + {\csname name-\the\f_count\endcsname} + } + \out_line{} + \fi + \fi + \out_line{\endmetrics_text} + \close_out{Metrics} +} +% \end{macrocode} +% \end{macro} +% +% To parse a |.pl| file, we first make |(| the escape character, make |)| +% ignored, then define the various PL commands as \TeX\ control sequences. +% We can ignore a parenthesis matched string by making |(| and |)| the +% group delimiters, then gobbling them up. +% +% \begin{macrocode} +\def\ignore_parens{\bgroup\catcode`(=1 \catcode`)=2 \x_relax + \expandafter\expandafter\expandafter\gobble_parens + \iftrue\expandafter{\else}\fi} +\def\gobble_parens#1{\egroup} +% \end{macrocode} +% +% \begin{macro}{\pl_real} +% \begin{macro}{\pl_realer} +% Convert a PL real to an AFM unit, assuming it contains a decimal point. +% \begin{macrocode} +\def\pl_real#1{\pl_realer(#1000)} +\def\pl_realer(#1.#2#3#4#5){#1#2#3#4} +% \end{macrocode} +% \cs{pl_real} only works if the \texttt{DESIGNUNITS} +% setting is at the default value 1. Luckily, this is what +% \package{TFtoPL} and \package{VFtoVP} use in all (V)PL files they +% create, so you can always get a (V)PL file that will work by +% converting first to TFM (+\,VF) and then back again. As of v\,1.913, +% that is also the value \package{fontinst} uses for all VPL files it +% generates, so the problem isn't particularly important. +% \end{macro}\end{macro} +% +% \begin{macro}{\pl_rounded_real} +% \changes{1.921}{2002/07/26}{Macro added and is used instead of +% \cs{pl_real}. (LH)} +% The |\pl_rounded_real| macro is like |\pl_realer| in that it converts +% a PL unit containing a decimal point to an AFM unit. The difference +% is (i) that it rounds the number rather than truncating it and (ii) +% that it stores the result in |\result| rather than expanding to it. +% Note that the actual real (character string) to convert must be +% followed by at least four zeros for the conversion to work +% correctly in all cases. +% \begin{macrocode} +\def\pl_rounded_real(#1.#2#3#4#5){ + \global\result=#1#2#3#4\relax + \ifnum \first_char#5= >4 + \global\advance \result + \if - \first_char#1= \m@ne \else \@ne \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\pl_int} +% Convert a PL int to a \TeX{} int, assuming it's prefixed +% by |C|, |D|, |O|, or |H|. +% \begin{macrocode} +\def\pl_int#1#2{ + \ifx#1C `#2 + \else\ifx#1D #2 + \else\ifx#1O '#2 + \else\ifx#1H "#2 + \else -1\errmessage{Unknown~PL~number~prefix~`#1'} + \fi\fi\fi\fi +} +% \end{macrocode} +% \end{macro} +% +% Many of the PL commands are ignored, and I'm assuming the |R|s are in +% the places \texttt{tftopl} puts them, which is a bit naughty of me. +% +% \begin{PLproperty}{FAMILY} +% \begin{PLproperty}{FACE} +% \begin{PLproperty}{CHECKSUM} +% \begin{PLproperty}{HEADER} +% \begin{PLproperty}{SEVENBITSAFEFLAG} +% \begin{macrocode} +\let\FAMILY=\ignore_parens +\let\FACE=\ignore_parens +\let\CHECKSUM=\ignore_parens +\def\HEADER~#1~#2~#3~#4~{} +\def\SEVENBITSAFEFLAG~#1~{} +% \end{macrocode} +% \end{PLproperty}\end{PLproperty}\end{PLproperty}\end{PLproperty} +% \end{PLproperty} +% +% \begin{PLproperty}{COMMENT} +% \begin{PLproperty}{LIG} +% \begin{PLproperty}{NEXTLARGER} +% \begin{PLproperty}{VARCHAR} +% \begin{macrocode} +\let\COMMENT=\ignore_parens +\let\LIG=\ignore_parens +\let\NEXTLARGER=\ignore_parens +\let\VARCHAR=\ignore_parens +% \end{macrocode} +% \end{PLproperty}\end{PLproperty}\end{PLproperty}\end{PLproperty} +% +% +% \begin{PLproperty}{VTITLE} +% \begin{PLproperty}{MAPFONT} +% \begin{PLproperty}{MAP} +% \begin{flushleft} +% ^^A Flushed left since the paragraph is so hard to break +% ^^A correctly. +% \changes{1.900}{1998/12/04}{VPL-specific properties added to +% those which are ignored by \cs{pltomtx}. (LH)} +% The properties which are unique for VPL files---|VTITLE|, +% |MAPFONT|, |MAP|, |FONTNAME|, |FONTAREA|, |FONTCHECKSUM|, +% |FONTAT|, |FONTDSIZE|, |SELECTFONT|, |SETCHAR|, |SETRULE|, +% |MOVERIGHT|, |MOVELEFT|, |MOVEUP|, |MOVEDOWN|, |PUSH|, |POP|, +% |SPECIAL|, and |SPECIALHEX|---should also be ignored, but it is +% actually sufficient to ignore the first three since the others +% are only allowed inside |MAP| or |MAPFONT| property lists. +% \end{flushleft} +% +% \begin{macrocode} +\let\VTITLE=\ignore_parens +\let\MAPFONT=\ignore_parens +\let\MAP=\ignore_parens +% \end{macrocode} +% \end{PLproperty}\end{PLproperty}\end{PLproperty} +% +% +% \begin{PLproperty}{CODINGSCHEME} +% \begin{macro}{\CODINGSCHEME_cont} +% When we reach a |CODINGSCHEME| instruction, we read the coding string, +% and read in the corresponding \meta{encoding}|.etx| file. +% +% The corresponding \meta{encoding} is specified by |\declareencoding| +% statements (see below). Each |\declare_encoding| defines a macro +% |\enc-|\meta{codingscheme} which expands to \meta{encoding}. +% +% If the PL file is converted using the |\generalpltomtx| command with +% a nonempty \meta{opt-enc} argument then the |CODINGSCHEME| instruction +% is ignored since an encoding file has already been read in. +% +% \begin{macrocode} +\def\CODINGSCHEME{\bgroup\catcode`\)=12\x_relax\CODINGSCHEME_cont} +\def\CODINGSCHEME_cont#1){ + \egroup + \if_undefined{enc-#1}\then + \errhelp{The~encoding~for~`#1'~has~not~been~declared.^^J + You~should~declare~it~with~ + \string\declareencoding{#1}{ETXFILE}.^^J + Press~<RETURN>~to~carry~on~with~fingers~crossed,^^J + or~X~<RETURN>~to~exit.} + \errmessage{Undeclared~encoding~`#1'} + \else + \def\do_slot{\x_cs\let{name-\the\slot_number}\slot_name} + \def\do_boundary{\x_cs\let{name-BOUNDARYCHAR}\slot_name} + \catcode`\(=12 \catcode`\)=12 + \x_cs\inputetx{enc-#1}\x_relax + \catcode`\(=0 \catcode`\)=9 + \fi +} +% \end{macrocode} +% \end{macro}\end{PLproperty} +% +% \begin{PLproperty}{DESIGNSIZE} +% The |DESIGNSIZE| is needed because the |FONTDSIZE| specified in a +% |MAPFONT| property list has to be the same as the |DESIGNSIZE| of +% the corresponding base font. +% \begin{macrocode} +\def\DESIGNSIZE~#1~#2~{ + \a_dimen=#2pt + \out_line{\string\setdim{designsize}{\the\a_dimen}} +} +% \end{macrocode} +% \end{PLproperty} +% +% \begin{PLproperty}{DESIGNUNITS} +% \changes{1.905}{1999/06/30}{Error message added. (LH)} +% \changes{1.912}{2000/02/20}{Store designunits value in +% \cs{b_dimen} rather than \cs{a_dimen}. \cs{a_dimen} holds the +% design size throughout PL-to-MTX. (LH)} +% The PL to MTX converter assumes that the (V)PL files to convert +% look like the ones created by \texttt{TFtoPL}\slash\texttt{VFtoVP}, +% and the interpretation of the \texttt{DESIGNUNITS} property is one +% thing specifically affected by this. The TFM file format does not +% store the \texttt{DESIGNUNITS} value used, so the two above +% programs always generate (V)PL files with the default setting of +% design unit equal to the design size. Hence any occurence of the +% \texttt{DESIGNUNITS} property with a nondefault value is an +% indication of an error. +% +% The incorrect metrics can be corrected by scaling by a suitable +% amount (1000 divided by the \texttt{designunits} dimen), but it is +% much simpler to convert the PL to a TFM and then convert it back, +% that will also fix the units. +% +% \begin{macrocode} +\def\DESIGNUNITS~#1~#2~{ + \b_dimen=#2pt\x_relax + \ifdim 1pt=\b_dimen \else + \fontinsterror{PL-to-MTX}{Nondefault~unit~used~in~PL~file} + {You~may~continue,~but~the~metrics~for~this~font~will~be~wrong.} + \fi + \out_line{\string\setdim{designunits}{\the\b_dimen}} +} +% \end{macrocode} +% \end{PLproperty} +% +% \begin{PLproperty}{BOUNDARYCHAR} +% \begin{macrocode} +\def\BOUNDARYCHAR~#1~#2~{ + \x_setint{\percent_char boundarychar}{\pl_int{#1}{#2}} +} +% \end{macrocode} +% \end{PLproperty} +% +% \changes{1.917}{2001/03/16}{Rewrote the fontdimen part of the +% (V)PL-to-MTX converter so that the ETX can specify the +% fontdimens. (LH)} +% +% Declared fontdimens are converted to |\setint| commands in the MTX +% file. A fontdimen declaration for fontdimen $n$ is stored in the +% control sequence \describecsfamily{fdimen-\meta{n}}|\fdimen-|$n$; if +% this control sequence is undefined then the fontdimen is not declared +% and if it is set then it is a macro which expands to the name of the +% corresponding integer variable. +% +% \begin{macro}{\pl_setfontdimen} +% Fontdimens are declared by the |\pl_setfontdimen| macro, which is a +% definition of |\setfontdimen| that is used during (V)PL-to-MTX +% conversion. +% \begin{macrocode} +\def\pl_setfontdimen#1#2{\x_cs\def{fdimen-#1}{#2}} +% \end{macrocode} +% \end{macro} +% +% \begin{PLproperty}{PARAMETER} +% The |PARAMETER| property is the generic specifier of fontdimens in +% (V)PL files. It takes two arguments: the fontdimen number (integer) +% and value (real). +% \begin{macrocode} +\def\PARAMETER~#1~#2~R~#3~{ + \f_count=\pl_int{#1}{#2}\x_relax + \if_defined{fdimen-\the\f_count}\then + \pl_rounded_real(#3 0000) + \out_line{\string\setint{\csname fdimen-\the\f_count\endcsname} + {\the\result}} + \fi +} +% \end{macrocode} +% \end{PLproperty} +% +% \begin{PLproperty}{FONTDIMEN} +% No special processing is required for the |FONTDIMEN| property. +% \begin{macrocode} +\let\FONTDIMEN=\x_relax +% \end{macrocode} +% \end{PLproperty} +% +% \begin{PLproperty}{SLANT} +% \begin{PLproperty}{SPACE} +% \begin{PLproperty}{STRETCH} +% \begin{PLproperty}{SHRINK} +% \begin{PLproperty}{XHEIGHT} +% \begin{PLproperty}{QUAD} +% \begin{PLproperty}{EXTRASPACE} +% The properties for the seven mandatory fontdimens are converted +% to the corresponding |PARAMETER| properties but their meanings are +% predeclared. The effect of these predeclarations is that even ETX +% files that don't use |\setfontdimen| to set the fontdimens have +% these fontdimens converted to |\setint|s. +% +% A scan shows that the current (2001/03/17) MTX and ETX files aren't +% using the integers \texttt{stretchword}, \texttt{shrinkword}, +% \texttt{quad}, and \texttt{extraspace}. They probably should. +% \begin{macrocode} +\def\SLANT{\PARAMETER D~1~} +\pl_setfontdimen{1}{italicslant} +\def\SPACE{\PARAMETER D~2~} +\pl_setfontdimen{2}{interword} +\def\STRETCH{\PARAMETER D~3~} +\pl_setfontdimen{3}{stretchword} +\def\SHRINK{\PARAMETER D~4~} +\pl_setfontdimen{4}{shrinkword} +\def\XHEIGHT{\PARAMETER D~5~} +\pl_setfontdimen{5}{xheight} +\def\QUAD{\PARAMETER D~6~} +\pl_setfontdimen{6}{quad} +\def\EXTRASPACE{\PARAMETER D~7~} +\pl_setfontdimen{7}{extraspace} +% \end{macrocode} +% \end{PLproperty}\end{PLproperty}\end{PLproperty}\end{PLproperty} +% \end{PLproperty}\end{PLproperty}\end{PLproperty} +% +% \begin{numPLproperty}{NUM}{1,2,3} +% \begin{numPLproperty}{DENOM}{1,2} +% The |NUM|$*$ and |DENOM|$*$ properties are for fontdimens 8--10 +% and 11--12. They have to do with positioning numerator and +% denominator in fractions. +% \begin{macrocode} +\def\NUM#1~#2~#3~{ + \ifcase #1\or + \PARAMETER D~8~#2~#3~ + \or + \PARAMETER D~9~#2~#3~ + \or + \PARAMETER D~10~#2~#3~ + \fi +} +\def\DENOM#1~#2~#3~{ + \ifcase #1\or + \PARAMETER D~11~#2~#3~ + \or + \PARAMETER D~12~#2~#3~ + \fi +} +% \end{macrocode} +% \end{numPLproperty}\end{numPLproperty} +% +% \begin{numPLproperty}{SUP}{1,2,3} +% \begin{numPLproperty}{SUB}{1,2} +% The |SUP|$*$ and |SUB|$*$ properties are for fontdimens 13--15 +% and 16--17. They have to do with positioning superscripts and +% subscripts. +% \begin{macrocode} +\def\SUP#1~#2~#3~{ + \ifcase #1\or + \PARAMETER D~13~#2~#3~ + \or + \PARAMETER D~14~#2~#3~ + \or + \PARAMETER D~15~#2~#3~ + \fi +} +\def\SUB#1~#2~#3~{ + \ifcase #1\or + \PARAMETER D~16~#2~#3~ + \or + \PARAMETER D~17~#2~#3~ + \fi +} +% \end{macrocode} +% \end{numPLproperty}\end{numPLproperty} +% +% \begin{PLproperty}{SUPDROP} +% \begin{PLproperty}{SUBDROP} +% \begin{PLproperty}{AXISHEIGHT} +% These are fontdimens 18, 19, and 22. +% \begin{macrocode} +\def\SUPDROP{\PARAMETER D~18~} +\def\SUBDROP{\PARAMETER D~19~} +\def\AXISHEIGHT{\PARAMETER D~22~} +% \end{macrocode} +% \end{PLproperty}\end{PLproperty}\end{PLproperty} +% +% \begin{numPLproperty}{DELIM}{1,2} +% The |DELIM|$*$ fondimens have number 20 and 21. They have to do with +% the size of delimiters put around a generalised fraction. +% \begin{macrocode} +\def\DELIM#1~#2~#3~{ + \ifcase #1\or + \PARAMETER D~20~#2~#3~ + \or + \PARAMETER D~21~#2~#3~ + \fi +} +% \end{macrocode} +% \end{numPLproperty} +% +% \begin{PLproperty}{DEFAULTRULETHICKNESS} +% \begin{numPLproperty}{BIGOPSPACING}{1,2,3,4,5} +% The fontdimen properties that are special for math extension fonts +% are |DEFAULT|\-|RULE|\-|THICKNESS| and the various +% |BIG|\-|OP|\-|SPACING|$*$. +% \begin{macrocode} +\def\DEFAULTRULETHICKNESS{\PARAMETER D~8~} +\def\BIGOPSPACING#1~#2~#3~{ + \ifcase #1\or + \PARAMETER D~9~#2~#3~ + \or + \PARAMETER D~10~#2~#3~ + \or + \PARAMETER D~11~#2~#3~ + \or + \PARAMETER D~12~#2~#3~ + \or + \PARAMETER D~13~#2~#3~ + \fi +} +% \end{macrocode} +% This is the old definition of |\DEFAULTRULETHICKNESS| for historical +% references (since its behaviour has changed). +% \begin{macrocode} +% \def\DEFAULTRULETHICKNESS~R~#1~{ +% \out_line{\string\setint{underlinethickness}{\pl_real{#1}}} +% } +% \end{macrocode} +% \end{numPLproperty}\end{PLproperty} +% +% +% \begin{PLproperty}{LABEL} +% \begin{macro}{\LABEL_slot} +% \begin{macro}{\LABEL_boundarychar} +% \begin{macro}{\do_if_defined} +% The most complicated part of the processing of the |LIGTABLE| +% property list is that it has to keep track of which glyphs the +% current ligature\slash kerning program applies to. This stored as +% a |\do|\marg{glyph} list in |\a_macro| and building this list +% is the job of the |LABEL| property. +% +% It is assumed that |\do| is |\never_do| whenever some element is +% added to |\a_macro|. +% \begin{macrocode} +\def\LABEL~#1{\ifx #1B + \expandafter\LABEL_boundarychar + \else + \expandafter\LABEL_slot \expandafter#1 + \fi +} +\def\LABEL_slot #1~#2~{ + \f_count=\pl_int{#1}{#2} + \edef\a_macro{\a_macro + \x_cs\do_if_defined{name-\the\f_count} + } +} +\def\LABEL_boundarychar OUNDARYCHAR{ + \edef\a_macro{\a_macro + \x_cs\do_if_defined{name-BOUNDARYCHAR} + } +} +\def\do_if_defined#1{\ifx #1\x_relax \else \do{#1} \fi} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{PLproperty} +% +% +% \begin{PLproperty}{LIGTABLE} +% \begin{PLproperty}{STOP} +% \begin{PLproperty}{SKIP} +% The |LIGTABLE|, |STOP|, and |SKIP| properties are the remaining +% properties involved in managing the |\a_macro| list. |SKIP| +% properties are \emph{not} processed. +% \begin{macrocode} +\def\LIGTABLE{\let\do=\never_do\let\a_macro\empty_command} +\def\STOP{\let\a_macro\empty_command} +\def\SKIP~#1~#2~{\immediate\write16{Warning:~SKIP~instruction~ignored.}} +% \end{macrocode} +% \end{PLproperty}\end{PLproperty}\end{PLproperty} +% +% \begin{PLproperty}{KRN} +% \begin{macro}{\write_pl_krn} +% |KRN| properties are converted to |\setkern| instructions. +% \begin{macrocode} +\def\KRN~#1~#2~R~#3~{ + \pl_rounded_real(#3 0000) + \edef\do{\noexpand\write_pl_krn{\pl_int{#1}{#2}}{\the\result}} + \a_macro + \let\do=\never_do +} +\def\write_pl_krn#1#2#3{ + \f_count=#1\x_relax + \x_cs\ifx{name-\the\f_count}\x_relax \else + \out_line{\string\setkern{#3} + {\csname name-\the\f_count\endcsname}{#2} + } + \fi +} +% \end{macrocode} +% \end{macro}\end{PLproperty} +% +% \begin{PLproperty}{CHARACTER} +% \begin{PLproperty}{CHARWD} +% \begin{PLproperty}{CHARHT} +% \begin{PLproperty}{CHARDP} +% \begin{PLproperty}{CHARIC} +% The character metrics that are processed are |CHARWD|, |CHARHT|, +% |CHARDP|, and |CHARIC|. The |CHARACTER| property takes care of +% writing the information to the MTX file, but note that each new +% |CHARACTER| property writes the information from the preceeding +% |CHARACTER| property. +% \begin{macrocode} +\def\CHARWD~R~#1~{\pl_rounded_real(#1 0000) \b_count=\result} +\def\CHARHT~R~#1~{\pl_rounded_real(#1 0000) \c_count=\result} +\def\CHARDP~R~#1~{\pl_rounded_real(#1 0000) \d_count=\result} +\def\CHARIC~R~#1~{\pl_rounded_real(#1 0000) \e_count=\result} +\def\CHARACTER~#1~#2~{ + \do_pl_glyph + \a_count=\pl_int{#1}{#2} + \b_count=0 + \c_count=0 + \d_count=0 + \e_count=0 + \let\do_pl_glyph=\write_pl_glyph +} +% \end{macrocode} +% \end{PLproperty}\end{PLproperty}\end{PLproperty}\end{PLproperty} +% \end{PLproperty} +% +% \begin{macro}{\write_pl_glyph} +% The |\write_pl_glyph| actually writes the information contained in +% a |CHARACTER| property list to the MTX file as a |\setrawglyph| +% command. +% \begin{macrocode} +\def\write_pl_glyph{ + \x_cs\ifx{name-\the\a_count}\x_relax\else + \out_line{\string\setrawglyph + {\csname~name-\the\a_count\endcsname} + {\raw_font_name} + {\the\a_dimen} + {\the\a_count} + {\the\b_count} + {\the\c_count} + {\the\d_count} + {\the\e_count}} + \fi + } +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Converting an MTX file to a PL file} +% +% \DescribeMacro{\mtxtopl} +% The macro +% \begin{quote} +% |\mtxtopl|\marg{mtxfile}\marg{plfile} +% \end{quote} +% writes a font from the |\setrawglyph| instructions in \meta{mtxfile} +% to \meta{plfile}. It ignores any font dimensions and kerning, so the +% resulting font is only useful for generating virtual fonts from. +% (This macro is called by |\transformfont|.) +% +% \begin{macro}{\mtxtopl} +% \changes{1.911}{1999/11/19}{Added `ligless' to one of the comment +% lines. (LH) Clarification requested by Walter Schmidt.} +% \changes{1.917}{2001/03/13}{Added resetting of +% \cs{setsomething_global}---assignments made here must be +% local. (LH)} +% \begin{macrocode} +\def\mtxtopl#1#2{{ + \let\setsomething_global=\x_relax + \open_out{#2.pl} + \top_of_pl_hook + \out_line{(COMMENT~raw~font~#2~created~by~fontinst~ + v\fontinstversion)} + \out_line{} + \out_line{(COMMENT~Filename:~#2.pl)} + \out_line{(COMMENT~Created~by:~tex~\jobname)} + \out_line{(COMMENT~Created~using:~\string\mtxtopl{#1}{#2})} + \out_line{} + \out_line{(COMMENT~This~file~can~be~turned~into~ + a~ligless~TeX~font~with)} + \out_line{(COMMENT~pltotfm~#2.pl~#2.tfm)} + \out_line{} + \out_line{(COMMENT~THIS~FILE~CAN~THEN~BE~DELETED.)} + \out_line{} + \out_line{(DESIGNSIZE~R~10.0)} + \out_line{} + \let\setglyph=\iffalse + \let\endsetglyph=\fi + \let\setkern=\gobble_three + \let\setscaledrawglyph=\first_pl_raw_glyph + \def\setscalednotglyph##1##2##3##4##5##6##7##8##9{} + \inputmtx{#1} + \out_line{} + \out_line{(COMMENT~END~OF~FILE~#2.pl)} + \close_out{Raw~font} +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\first_pl_raw_glyph} +% The |\first_pl_raw_glyph| writes the \texttt{DESIGNUNITS} property +% for the font when the first |\setscaledrawglyph| is encountered. +% This is to undo the scaling that has already been applied to the +% metrics, so that the metrics will match the actual font. +% \begin{macrocode} +\def\first_pl_raw_glyph#1#2#3#4{ + \out_line{(DESIGNUNITS~R~\make_factor{#4})} + \let\setscaledrawglyph=\pl_raw_glyph + \pl_raw_glyph{#1}{#2}{#3}{#4} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pl_raw_glyph} +% \begin{macrocode} +\def\pl_raw_glyph#1#2#3#4#5#6#7#8#9{ + \out_line{(CHARACTER~D~\number#5~\space(COMMENT~#1)} + \out_lline{(CHARWD~R~\make_factor{#6})} + \out_lline{(CHARHT~R~\make_factor{#7})} + \out_lline{(CHARDP~R~\make_factor{#8})} + \out_lline{(CHARIC~R~\make_factor{#9})} + \out_lline{)} +} +% \end{macrocode} +% \end{macro} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \section{Font transformations} +% \label{Sec:Font.trans} +% \changes{1.902}{1999/05/01}{Moved Section \thesection\space to +% \texttt{ficonv.dtx}. (LH)} +% +% \subsection{Transformable metric files} +% \label{Ssec:TransMTX} +% +% \changes{1.901}{1999/02/28}{Definition of transformable metric file +% added. (LH)} +% \changes{1.913}{2000/03/10}{Definition of transformable metric file +% changed to include the \cs{setscaledrawglyph} and +% \cs{setscalednotglyph} commands. (LH)} +% \changes{1.915}{2000/09/09}{Added description of \cs{aliased} macro +% to the definition of transformable metric files. (LH)} +% A \emph{transformable metric file} is a metric file +% which complies with certain restrictions in its syntax. The only +% metric commands allowed are +% \begin{isyntax} +% |\setscaledrawglyph|\marg{glyph}\marg{font}\marg{size}^^A +% \marg{scale}\marg{slot}\marg{width}\penalty0 +% \marg{height}\penalty0\marg{depth}\penalty0\marg{italic}\\ +% |\setrawglyph|\marg{glyph}\marg{font}\marg{size}\marg{slot}^^A +% \marg{width}\marg{height}\penalty0\marg{depth}\penalty0 +% \marg{italic}\\ +% |\setscalednotglyph|\marg{glyph}\marg{font}\marg{size}^^A +% \marg{scale}\marg{slot}\marg{width}\penalty0 +% \marg{height}\penalty0\marg{depth}\penalty0\marg{italic}\\ +% |\setnotglyph|\marg{glyph}\marg{font}\marg{size}\marg{slot}^^A +% \marg{width}\marg{height}\penalty0\marg{depth}\penalty0 +% \marg{italic}\\ +% |\setkern|\marg{glyph1}\marg{glyph2}\marg{amount}\\ +% |\setglyph|\marg{glyph} \meta{glyph commands} |\endsetglyph| +% \end{isyntax} +% where \meta{glyph}, \meta{glyph1}, \meta{glyph2}, and \meta{font} are +% strings without any variable references (no |\str| or |\strint| are +% allowed), \meta{scale}, \meta{slot}, \meta{width}, \meta{height}, +% \meta{depth}, \meta{italic}, and \meta{amount} are \TeX\ numbers, and +% \meta{size} is a \TeX\ dimen. (More accurately, all dimens in a +% transformable metric file should be on the form \meta{optional +% signs}\penalty0 \meta{decimal constant}\penalty0 \meta{physical unit}, +% but that's at the ``dangerous bend'' level.) The \meta{glyph}s may be +% of the form +% \begin{quote} +% |\aliased|\marg{font's name}\marg{alias name} +% \end{quote} +% Such \meta{glyph}s are interpreted as \meta{alias name} for all +% purposes except reencoding, when they are interpreted as \meta{font's +% name}. \meta{glyph}s of this form are furthermore copied as they are +% to MTX files created by |\transform|\-|font| (|\mtxtomtx|). +% +% The only \meta{glyph commands} allowed are +% \begin{quote} +% |\samesize|\marg{glyph}\\ +% |\glyphpcc|\marg{glyph}\marg{xoffset}\marg{yoffset} +% \end{quote} +% where \meta{glyph} is as above, and \meta{xoffset} and \meta{yoffset} +% are \TeX\ numbers. +% +% The only general commands allowed are +% \begin{quote} +% |\needsfontinstversion|\marg{version}\\ +% |\setint|\marg{name}\marg{number}\\ +% |\setdim|\marg{name}\marg{dimen}\\ +% |\setstr|\marg{name}\marg{string}\\ +% |\storemapdata|\marg{font}\marg{source}\marg{transformations} +% \end{quote} +% where \meta{name} and \meta{string} are strings without variable +% references, \meta{number} is a \TeX\ number, and \meta{dimen} is a +% \TeX\ dimen. The arguments of |\needs|\-|fontinst|\-|version| and +% |\store|\-|map|\-|data| are as usual, but these commands do not get +% copied in a font transformation. +% +% The metric files produced by |\afmtomtx| and |\generalpltomtx| are +% meant to be transformable. If they are not then there is a bug +% somewhere. +% +% The name of the integer in |\setint| commands is interpreted. This +% name is used to determine how the number should be transformed, see +% the implementation of |\mtxtomtx_setint| below. +% +% +% \subsection{Making font transformations} +% +% \changes{1.911}{1999/11/19}{Recording of transformations moved to the +% macros that actually write the MTX files. (LH)} +% \changes{1.911}{1999/11/19}{Flag for that source font wasn't found +% changed to \texttt{afm-name}. \texttt{transform-source} string +% completely removed. (LH)} +% \changes{1.913}{2000/03/11}{New implementation of \cs{scalefont} and +% \cs{yscalefont}, using the new \cs{setscaledrawglyph} and +% \cs{setscalednotglyph} commands. (LH)} +% \changes{1.913}{2000/03/12}{Using \cs{slots-}\meta{glyph} control +% sequences for storing encoding positions of glyphs in reencoded +% fonts. (LH)} +% +% \DescribeMacro{\transformfont} +% The macro: +% \begin{quote} +% |\transformfont|\marg{font-name}\marg{transformed font} +% \end{quote} +% transforms the metrics of a raw font. As far as \TeX\ is concerned, +% \meta{font-name} will be a new font. Actually doing the +% transformation and providing the transformed font (as opposed to the +% metrics of the transformed font) is for most transforms up to some +% other piece of software, in most cases the DVI driver, but +% \package{fontinst} will handle isotropic scaling itself. +% +% The easiest way to find out which transformations need to be carried +% out is to generate a map file for the \texttt{debug} ``driver'' (see +% Section~\ref{Sec:Mapfiles}). Of course, if \package{fontinst} can +% generate a mapfile for the target driver then you probably don't need +% to find out which transformations were necessary\,\textellipsis +% \spacefactor=\sfcode`\.\space\space +% In any case, the arguments of |\storemapdata| in the MTX file +% generated will tell which transformations of this |\transformfont| +% command that must be performed by some other software. +% +% \DescribeMacro{\fromafm} +% \DescribeMacro{\frommtx} +% \DescribeMacro{\frompl} +% \DescribeMacro{\scalefont} +% \DescribeMacro{\xscalefont} +% \DescribeMacro{\yscalefont} +% \DescribeMacro{\slantfont} +% \DescribeMacro{\reencodefont} +% The \meta{transformed font} commands are: +% \begin{quote} +% |\fromafm|\marg{AFM file}\\ +% |\frompl|\marg{PL file}\\ +% |\fromplgivenetx|\marg{PL file}\marg{etx}\\ +% |\frommtx|\marg{MTX file}\\ +% |\fromany|\marg{file}\\ +% |\scalefont|\marg{integer expression}\marg{transformed font}\\ +% |\xscalefont|\marg{integer expression}\marg{transformed font}\\ +% |\yscalefont|\marg{integer expression}\marg{transformed font}\\ +% |\slantfont|\marg{integer expression}\marg{transformed font}\\ +% |\reencodefont|\marg{etx}\marg{transformed font} +% \end{quote} +% +% Each |\transformfont| command generates an |.mtx| file for +% \meta{font-name} and a corresponding raw |.pl| file, which is written +% out by |\mtxtopl|. +% +% Each |\fromafm|, |\frompl|, or |\fromplgivenetx| command also generates +% an |.mtx| file for the source font, which is written out by |\afmtomtx| +% or |\generalpltomtx|. In addition, |\fromafm| also uses |\mtxtopl| +% to generate a corresponding raw |.pl| file. +% +% |\fromany| reads an MTX, PL, AFM, or VPL file depending on what it can +% find. It tries them in the order first MTX, then PL, then AFM, and +% last VPL. +% +% \begin{macro}{\transformfont} +% \changes{1.912}{2000/01/15}{Added local resetting of +% \cs{setsomething_global} to \cs{relax}, since \cs{transformfont} +% assumes such assignments are local. (LH)} +% \begin{macrocode} +\def\transformfont#1#2{{ + \let\setsomething_global=\x_relax + \unsetstr{afm-name} + \unsetstr{etx-name} + \x_resetint{x-scale}{\one_thousand} + \x_resetint{y-scale}{\one_thousand} + \x_resetint{slant-scale}{0} + #2 +% \end{macrocode} +% \changes{1.903}{1999/06/01}{Added behaviour for the case source file +% not found. (LH)} +% \changes{1.921}{2002/07/31}{Corrected an error message that tried +% to use a variable that wasn't set! (LH)} +% \begin{macrocode} + \ifisstr{afm-name}\then + \mtxtomtx{\str{afm-name}}{#1} + \mtxtopl{#1}{#1} + \else + \fontinsterror{Transformfont}{ + Failed~to~make~transformed~font~#1;\messagebreak + source~font~metrics~file~not~found + }\error_help_a + \fi +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fromafm} +% \changes{1.904}{1999/06/17}{Added call of \cs{record_transform}. (LH)} +% \changes{1.911}{1999/11/19}{Added test for file existence. (LH)} +% \begin{macrocode} +\def\fromafm#1{ + \if_file_exists{#1.afm}\then + \x_setstr{afm-name}{#1} + \afmtomtx{#1}{#1} + \mtxtopl{#1}{#1} + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\frommtx} +% \changes{1.911}{1999/11/19}{Added test for file existence. (LH)} +% \begin{macrocode} +\def\frommtx#1{ + \if_file_exists{#1.mtx}\then \x_setstr{afm-name}{#1} \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\frompl} +% \changes{1.904}{1999/06/17}{Added call of \cs{record_transform}. (LH)} +% \changes{1.911}{1999/11/19}{Added test for file existence. (LH)} +% \begin{macro}{\fromplgivenetx} +% \changes{1.902}{1999/05/02}{Command added. (LH)} +% \changes{1.904}{1999/06/17}{Added call of \cs{record_transform}. (LH)} +% \changes{1.911}{1999/11/19}{Added test for file existence. (LH)} +% \begin{macrocode} +\def\frompl#1{ + \if_file_exists{#1.pl}\then + \x_setstr{afm-name}{#1} + \generalpltomtx{#1}{#1}{pl}{} + \fi +} +% \end{macrocode} +% \begin{macrocode} +\def\fromplgivenetx#1#2{ + \if_file_exists{#1.pl}\then + \x_setstr{afm-name}{#1} + \generalpltomtx{#1}{#1}{pl}{#2} + \fi +} +% \end{macrocode} +% \end{macro} \end{macro} +% +% \multchanges{\cs{fromvpl}\cs{fromvplgivenetx}}{1.902}{1999/05/02} +% {Commands added. (LH)} +% \multchanges{\cs{fromvpl}\cs{fromvplgivenetx}}{1.904}{1999/06/16} +% {Commands removed. (LH)} +% Regarding \cs{fromvpl} and \cs{fromvplgivenetx}: I realized that +% there isn't any point in reading metrics for a font that is to be +% transformed from a VPL file, since no driver I know of can transform +% virtual fonts. If someone has a problem with this then I suppose he +% or she should send word about it. /LH +% +% +% \begin{macro}{\fromany} +% \changes{1.903}{1999/05/20}{Command added. (LH) Based on a +% suggestion by Vladimir Volovich.} +% \changes{1.903}{1999/06/01}{Added behaviour for AFM not found case. +% (LH)} +% \changes{1.904}{1999/06/16}{Added search for VPL file and calls to +% \cs{record_transform}. (LH)} +% \changes{1.923}{2002/12/03}{Added \cs{pl_encoding}. (LH)} +% \changes{1.926}{2003/07/10}{Removed \cs{pl_encoding}; it is better +% to provide that functionality in a separate macro. (LH)} +% \changes{1.926}{2003/07/10}{Has to reset the \texttt{afm-name} +% string, since \cs{input_mtx_file} now uses the value. (LH)} +% The |\fromany| transformed font command searches for font metrics +% for \#1 by looking for, in turn, the files \#1|.mtx|, \#1|.pl|, +% \#1|.afm|, and \#1|.vpl|. If an MTX file doesn't exist, it is +% generated, and if the MTX is generated from an AFM then a +% corresponding (non-ligful) PL file is generated as well. |\fromany| +% also sets the fontinst string \texttt{afm-name} according +% to what kind of font it found. If none of the fonts existed then +% |afm-name| is unset. +% \begin{macrocode} +\def\fromany#1{ + \x_cs\edef{s-afm-name}{#1} + \if_file_exists{#1.mtx}\then\else +% \end{macrocode} +% +% \changes{1.6}{1997/01/15}{Search order changed to PL before AFM. +% (SPQR) The code wasn't in \cs{fromany} back then, though.} +% 1997/01/15 SPQR changed the below search order to |.pl| before |.afm| +% because of the |cmr*.afm| files found in the |TEXMF|\slash +% |fonts|\slash|afm| hierarchy. +% \begin{macrocode} + \if_file_exists{#1.pl}\then + \generalpltomtx{#1}{#1}{pl}{} + \else + \if_file_exists{#1.afm}\then + \afmtomtx{#1}{#1} + \mtxtopl{#1}{#1} + \else + \if_file_exists{#1.vpl}\then + \generalpltomtx{#1}{#1}{vpl}{} + \else + \unsetstr{afm-name} + \fi\fi\fi\fi +} +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection*{The mathematical basis for the metric font transformations} +% +% Mathematically, all the metric font transformations (|\scale|\-|font|, +% |\xscale|\-|font|, |\yscale|\-|font|, and |\slant|\-|font|) are linear +% mappings of the real plane onto itself. All quantities in a +% transformable metric file are interpreted as being determined by some +% point in this plane and hence their transformation depends on how that +% point would be moved by the metric font transformations performed. +% This is usually simpler than it sounds, since all quantities except +% |italicslant| are interpreted as either the $x$- or the $y$-coordinate +% of some point. |italicslant| is interpreted as the quotient +% $\frac{x}{y}$ for a point. +% +% The best way to describe a linear mapping of the real plane to itself +% is by a \(2 \times 2\) matrix whose components are real numbers. Since +% true real numbers are not available in \TeX, integers are used instead, +% with the convention that they are in units of thousandths. In a +% concrete form this means that $0$ represents $0$, $500$ represents +% $\frac{1}{2}$, $1000$ represents $1$, etc. This works just as for the +% scaling factors used in |\scale|. It also means that the matrix +% $$ +% \left(\begin{array}{cc} 1000 & 0 \\ 0 & 1000 \end{array}\right) +% $$ +% represents the identity mapping (the mapping taking everything to +% itself). +% +% Thinking of points as column vectors (\(2 \times 1\) matrices) with +% the $x$-coordinate in the first component and the $y$-coordinate in +% the second, the respective elementary metric font transformations +% correspond to the following matrices: +% \begin{eqnarray*} +% \mbox{\cs{scalefont}\marg{n}} & \mbox{is} & +% \left( \begin{array}{cc} +% \mbox{\meta{n}}& 0 \\ +% 0 & \mbox{\meta{n}} +% \end{array} \right) \\ +% \mbox{\cs{xscalefont}\marg{n}} & \mbox{is} & +% \left( \begin{array}{cc} +% \mbox{\meta{n}}& 0 \\ +% 0 & 1000 +% \end{array} \right) \\ +% \mbox{\cs{yscalefont}\marg{n}} & \mbox{is} & +% \left( \begin{array}{cc} +% 1000 & 0 \\ +% 0 & \mbox{\meta{n}} +% \end{array} \right) \\ +% \mbox{\cs{slantfont}\marg{n}} & \mbox{is} & +% \left( \begin{array}{cc} +% 1000 & \mbox{\meta{n}} \\ +% 0 & 1000 +% \end{array} \right) +% \end{eqnarray*} +% Since all these matrices are upper triangular, all products of such +% matrices (corresponding to compositions of the linear mappings) will be +% upper triangular as well. It is therefore unnecessary to store the +% subdiagonal component anywhere (it is always zero), and hence +% \package{fontinst} represents an arbitrary metric transform by the +% matrix +% $$ +% \left( \begin{array}{cc} +% \mbox{\texttt{x-scale}} & \mbox{\texttt{slant-scale}} \\ +% 0 & \mbox{\texttt{y-scale}} +% \end{array} \right) +% $$ +% where \texttt{x-scale}, \texttt{y-scale}, and \texttt{slant-scale} +% are fontinst integers. +% +% The reason there is a representation of arbitrary metric transforms +% is that all the elementary metric transforms listed in the second +% argument of |\transformfont| are concatenated before the actual font +% file conversion is made. This reduces the amount of calculations +% performed in case there are many transformations of the font. +% +% Why do we only consider transformations that correspond to upper +% triangular matrices? Well, a transformation corresponds to an upper +% triangular matrix if and only if it leaves horizontal lines horizontal. +% Since in particular the baseline must always be horizontal in \TeX, +% there is no point in considering other linear transformations. +% +% \begin{macro}{\scalefont} +% \begin{macro}{\xscalefont} +% \begin{macro}{\yscalefont} +% \begin{macro}{\slantfont} +% \begin{macro}{\reencodefont} +% \begin{macrocode} +\def\scalefont#1#2{ + \eval_expr_to\d_count{#1} + \x_resetint{x-scale}{\scale{\d_count}{\int{x-scale}}} + \x_resetint{y-scale}{\scale{\d_count}{\int{y-scale}}} + \x_resetint{slant-scale}{\scale{\d_count}{\int{slant-scale}}} + #2 +} +\def\xscalefont#1#2{ + \x_resetint{x-scale}{\scale{#1}{\int{x-scale}}} + #2 +} +\def\yscalefont#1#2{ + \eval_expr_to\d_count{#1} + \x_resetint{y-scale}{\scale{\d_count}{\int{y-scale}}} + \x_resetint{slant-scale}{\scale{\d_count}{\int{slant-scale}}} + #2 +} +\def\slantfont#1#2{ + \x_resetint{slant-scale}{ + \add{\scale{#1}{\int{x-scale}}}{\int{slant-scale}} + } + #2 +} +\def\reencodefont#1#2{ + #2 + \resetstr{etx-name}{#1} +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% That's only half the story, however. It is true that the transformation +% matrix, as computed by |\scalefont|, |\slantfont|, |\xscalefont|, and +% |\yscalefont| above, is used for transforming the font metrics, but it +% is not directly used for transforming the font itself. Instead it is +% factorized as +% $$ +% \left( \begin{array}{cc} +% x & s \\ 0 & y +% \end{array} \right) = +% y \left( \begin{array}{cc} +% x/y & s/y \\ 0 & 1 +% \end{array} \right) +% $$ +% Here the scalar factor $y$ will be used to scale the \meta{scale} +% argument of |\set|\-|scaled|\-|raw|\-|glyph| and +% |\set|\-|scaled|\-|not|\-|glyph| commands, whereas the matrix +% factor will be put in the third argument of |\store|\-|map|\-|data| +% in the MTX file written. Thus \package{fontinst} will handle the +% scalar factor of the transformation itself, but leave the matrix +% factor for some other software to take care of. +% +% \bigskip +% +% +% \DescribeMacro{\mtxtomtx} +% The macro: +% \begin{quote} +% |\mtxtomtx|\marg{source MTX}\marg{destination MTX} +% \end{quote} +% converts the first |.mtx| file to the second, using the current values +% of |\int{x-scale}|, |\int{y-scale}|, |\int{slant-scale}|, and +% |\str{etx-name}|. +% +% NOTE: this doesn't convert arbitrary |.mtx| files, just the +% transformable ones. +% +% \begin{macro}{\mtxtomtx} +% \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)} +% \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 + \_a_true + \ifnum \int{x-scale}=\int{y-scale} + \ifnum \int{slant-scale}=\z@ + \_a_false + \fi \fi + \if_a_ + \a_count=\int{x-scale} + \l_inv_scale\a_count{\int{y-scale}} + \b_count=\int{slant-scale} + \l_inv_scale\b_count{\int{y-scale}} + \edef\a_macro{\a_macro + \string\transformfont{\the\a_count}{\the\b_count} + } + \fi + \open_out{\temp_prefix#2.mtx} + \edef\raw_font_name{#2} + \out_line{\percent_char~Filename:~#2.mtx} + \out_line{\percent_char~Created~by:~tex~\jobname} + \out_line{\percent_char~Created~using:~\string\mtxtomtx{#1}{#2}} + \out_line{} + \out_line{\percent_char~This~file~is~used~by~the~fontinst~package.} + \out_line{} + \out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.} + \out_line{} + \out_line{\string\relax} + \out_line{\string\metrics} + \out_line{} + \out_line{\string\needsfontinstversion{\fontinstversion}} + \out_line{} + \record_transform{#2}{\string\frommtx{#1}}{\a_macro}\iftrue + \out_line{} + \mtxtomtx_redefinitions + \inputmtx{#1} + \out_line{} + \out_line{\endmetrics_text} + \close_out{Transformed~metrics} +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mtxtomtx_redefinitions} +% This macro serves as a hook. One can make additional commands +% transformable by appending suitable redefenitions of them to this +% macro. +% \changes{1.927}{2003/12/08}{Macro added. The code used to be in +% \cs{mtxtomtx}. (LH)} +% \begin{macrocode} +\def\mtxtomtx_redefinitions{ + \let\setint=\mtxtomtx_setint + \let\setdim=\mtxtomtx_setdim + \let\setstr=\mtxtomtx_setstr + \let\setscaledrawglyph=\mtxtomtx_setscaledrawglyph + \let\setscalednotglyph=\mtxtomtx_setscaledrawglyph + \let\setkern=\mtxtomtx_setkern + \let\setglyph=\mtxtomtx_setglyph + \let\glyphpcc=\mtxtomtx_glyphpcc + \let\samesize=\mtxtomtx_samesize + \let\endsetglyph=\mtxtomtx_endsetglyph + \def\aliased{\string\aliased} +} +%</pkg> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\aliased} +% \changes{1.915}{2000/09/09}{Macro added. (LH)} +% The |\aliased| macro has the syntax +% \begin{quote} +% |\aliased|\marg{font's name}\marg{alias name} +% \end{quote} +% This normally expands to \meta{alias name}, but in |\mtxtomtx| it +% normally expands to +% \begin{quote} +% |\string\aliased|\marg{font's name}\marg{alias name} +% \end{quote} +% and when |\mtxtomtx_setscaledrawglyph| is reencoding it uses +% \meta{font's name} to determine the new slot position. +% \begin{macrocode} +%<pkg|misc>\let\aliased=\second_of_two +%<doc>\let\aliased=\@secondoftwo +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mtxtomtx_setint} +% \changes{1.917}{2001/03/24}{Redefined to allow an extensible list +% \cs{width_ints_list} of integers that should be transformed as +% widths. (LH)} +% \begin{macro}{\italicslant_name} +% \begin{macro}{\width_ints_list} +% \changes{1.917}{2001/03/24}{Macro added. \cs{verticalstem_name} +% removed. (LH)} +% Most integers are transformed as if they are the $y$-coordinates of +% some points, but |italicslant| and the integers in the +% |\width_ints_list| are treated differently. |italicslant| is +% interpreted as the quotient $\frac{x}{y}$ for a point $(x,y)$, but +% represented as a real number (i.e., the \TeX\ number is really a +% thousand times the actual quotient). The integers in the +% |\width_ints_list| are transformed as if they are the +% $x$-coordinates of some points on the baseline. +% +% The |\width_ints_list| macro is an ordinary |\do|-type list where +% each |\do| has precisely one argument. These arguments are the names +% of the integers which should be transformed as widths. Elements can +% be added to the list using the |\add_to| macro. +% +% The test for whether a specific integer is in the |\width_ints_list| +% exploits that |\if_true| and |\if_false| only matter in |\if|--|\fi| +% matching after they have been expanded, whereas +% |\gobble_one|\,|\iftrue| only matters before it is expanded. +% \begin{macrocode} +%<*pkg> +\def\mtxtomtx_setint#1#2{ + \def\a_macro{#1} + \ifx \a_macro\italicslant_name + \eval_expr{#2} + \global\multiply \result \int{x-scale} + \a_count=\int{slant-scale} + \multiply \a_count \one_thousand + \advance \a_count \result + \divide \a_count \int{y-scale}\x_relax + \else + \def\do##1{ + \def\b_macro{##1} + \ifx \a_macro\b_macro \expandafter\if_false \fi + } + \gobble_one\iftrue \width_ints_list \if_true + \eval_expr_to\a_count{\scale{#2}{\int{y-scale}}} + \else + \eval_expr_to\a_count{\scale{#2}{\int{x-scale}}} + \fi + \fi + \out_line{\string\setint{#1}{\the\a_count}} +} +\def\italicslant_name{italicslant} +\def\width_ints_list{ + \do{interword}\do{stretchword}\do{shrinkword}\do{quad} + \do{extraspace}\do{digitwidth}\do{verticalstem} +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\mtxtomtx_setdim} +% \begin{macro}{\mtxtomtx_setstr} +% Strings and dimens are not affected by the |\mtxtomtx| transforms. +% \begin{macrocode} +\def\mtxtomtx_setdim#1#2{ + \out_line{\string\setdim{#1}{#2}} +} +% \end{macrocode} +% \begin{macrocode} +\def\mtxtomtx_setstr#1#2{ + \out_line{\string\setstr{#1}{#2}} +} +% \end{macrocode} +% \end{macro} \end{macro} +% +% \begin{macro}{\mtxtomtx_setscaledrawglyph} +% \changes{1.915}{2000/09/09}{Added local redefinition of +% \cs{aliased}. (LH)} +% |#6| (the width) is transformed as the $x$-coordinate of a point on +% the baseline. |#7| and |#8| (the height and depth respectively) are +% transformed as $y$-coordinates. The depth should probably really have +% been transformed as the negative of a $y$-coordinate, but it comes +% out the same in the end anyway. |#9| (the italic correction) is +% transformed as the $x$-coordinate of a point whose $y$-coordinate +% equals the height of the character. |#4| (the scaling) is +% transformed as a $y$-coordinate. +% +% If the italic slant of the font is negative then the italic +% correction should possibly be transformed as the $x$-coordinate of +% a point whose $y$-coordinate equals the negative of the depth +% instead (as that is the part of the box that is sticking out to the +% right), but it is hard to say for sure how that case should be +% treated. +% +% \begin{macrocode} +\def\mtxtomtx_setscaledrawglyph#1#2#3#4#5#6#7#8#9{ + \eval_expr_to\a_count{\scale{#6}{\int{x-scale}}} + \eval_expr_to\b_count{\scale{#7}{\int{y-scale}}} + \eval_expr_to\c_count{\scale{#8}{\int{y-scale}}} + \eval_expr_to\d_count{#9} \eval_expr{#7} + \multiply \d_count \int{x-scale} + \global\multiply \result \int{slant-scale} + \global\advance \result \d_count + \rounded_thousandths + \d_count=\result + \eval_expr{\scale{#4}{\int{y-scale}}} + \ifisstr{etx-name}\then + \bgroup + \let\aliased=\first_of_two + \if_undefined{slots-#1}\then + \egroup \e_count=\m@ne + \else + \expandafter\egroup \expandafter\e_count + \csname slots-#1\endcsname + \fi + \else + \e_count=#5 + \fi + \out_line{ + \ifnum \e_count>\m@ne + \string\setscaledrawglyph + \else + \string\setscalednotglyph + \fi + {#1}{\raw_font_name}{#3}{\the\result}{\the\e_count} + {\the\a_count}{\the\b_count}{\the\c_count}{\the\d_count} + } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mtxtomtx_setkern} +% Kerns are transformed as the $x$-coordinate of a point on the +% baseline. +% +% \begin{macrocode} +\def\mtxtomtx_setkern#1#2#3{ + \eval_expr{\scale{\int{x-scale}}{#3}} + \out_line{\string\setkern{#1}{#2}{\the\result}} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mtxtomtx_setglyph} +% \begin{macro}{\mtxtomtx_samesize} +% \begin{macro}{\mtxtomtx_endsetglyph} +% \begin{macrocode} +\def\mtxtomtx_setglyph#1{\out_line{\string\setglyph{#1}}} +\def\mtxtomtx_samesize#1{\out_lline{\string\samesize{#1}}} +\def\mtxtomtx_endsetglyph{\out_line{\string\endsetglyph}} +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} +% +% \begin{macro}{\mtxtomtx_glyphpcc} +% |#2| is transformed as the $x$-coordinate and |#3| is transformed +% as the $y$-coordinate of a point---the same point for both +% parameters. +% +% \begin{macrocode} +\def\mtxtomtx_glyphpcc#1#2#3{ + \eval_expr_to\b_count{\scale{\int{y-scale}}{#3}} + \eval_expr_to\a_count{#2} \eval_expr{#3} + \multiply \a_count \int{x-scale} + \global\multiply \result \int{slant-scale} + \global\advance \result \a_count + \rounded_thousandths + \out_lline{\string\glyphpcc{#1}{\the\result}{\the\b_count}} +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Changing glyph names} +% \label{Ssec:Reglyph} +% +% \package{fontinst} uses names to identify glyphs, and if for example +% the font in question is a postscript font, then names will also be used +% to identify glyphs in the printer. Between those two points however, +% and in particular inside \TeX\ itself, glyphs are represented with +% numbers (slots). Therefore there is no real need for the glyph names +% used within \package{fontinst} and the glyph names used in the printer +% (the names gotten from the AFM file) to be equal, but they usually are. +% There are some cases though where the glyph names of a font are +% unsuitable for use with \package{fontinst}---mainly because +% \package{fontinst} can mix glyphs from different printer fonts---and +% therefore \package{fontinst} also offers the ability to automatically +% change the names of glyphs in transformable metric files. +% +% \begin{macro}{\reglyphfonts} +% \changes{1.912}{2000/01/15}{Added local resetting of +% \cs{setsomething_global} to \cs{relax}. It shouldn't be needed, +% since \cs{reglyphfonts} should not occur between \cs{installfonts} +% and \cs{endinstallfonts}, but I bet someone will try. (LH)} +% \begin{macro}{\endreglyphfonts} +% \begin{quote} +% |\reglyphfonts| \meta{reglyphing commands} |\endreglyphfonts| +% \end{quote} +% \begin{macrocode} +\def\reglyphfonts{ + \begingroup + \let\setsomething_global=\x_relax + \x_setint{renameweight}{1} + \x_setint{killweight}{-10} + \setcommand\iftokeep##1\then{\ifnum -1<##1} +} +\def\endreglyphfonts{\endgroup} +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% The \meta{reglyphing commands} are +% \begin{quote} +% |\renameglyph|\marg{to}\marg{from}\\ +% |\renameglyphweighted|\marg{to}\marg{from}\marg{weight}\\ +% |\killglyph|\marg{glyph}\\ +% |\killglyphweighted|\marg{glyph}\marg{weight}\\ +% |\offmtxcommand|\marg{command}\\ +% |\onmtxcommand|\marg{command}\\ +% |\reglyphfont|\marg{destination font}\marg{source font} +% \end{quote} +% The only reglyphing command that actually convert the names of any +% glyphs is \DescribeMacro{\reglyphfont}|\reglyph|\-|font|; it reads a font +% \meta{source font} (which may be of type MTX, PL, AFM, or VPL) and +% writes another font \meta{destination font} in which the names of +% glyphs have been converted. All the other commands control \emph{how} +% this conversion should be made, and these settings get cleared at the +% closing |\endreglyphfonts|. +% +% The conversion works in two ways. First of all, the names of the +% glyphs can be changed. This works as a general mapping and is +% controlled by the \DescribeMacro{\renameglyph}|\renameglyph| and +% \DescribeMacro{\renameglyphweighted}|\renameglyphweighted| +% commands. Any mensioning of the glyph \meta{from} in a command will be +% converted to a mensioning of the glyph \meta{to}, if that command +% survives the conversion. The other way the conversion works is that it +% can selectively kill---refrain from including in \meta{destination +% font}---commands in the metric file. This part weighs in several +% factors. +% +% For one thing, one can specify that all metric commands of a certain +% type should be killed, and this is done with the +% \DescribeMacro{\offmtxcommand}|\offmtxcommand| command. For example, +% one can see to that all kerning commands are killed by +% \begin{quote} +% |\offmtxcommand{\setkern}| +% \end{quote} +% The effect is the same as that of saying +% \begin{quote} +% |offkern,|\meta{destination font}|,onkern| +% \end{quote} +% rather than just \meta{destination font} in the second argument to +% |\installfont|, but it is somewhat faster since less text is written +% to and subsequently read from the \meta{destination font}|.mtx| file. +% The effect of a previous |\offmtxcommand| can be canceled by a call to +% \DescribeMacro{\onmtxcommand}|\onmtxcommand|, just like with +% |\offcommand| and |\oncommand|. +% +% The survivance of a command is also affected by the glyphs it refers to. +% Each glyph has a \emph{weight} associated with it and the sum of the +% weights for all glyphs mensioned by a command is also used to decide +% whether that command should survive. The test here is performed by the +% macro \DescribeMacro{\iftokeep}|\iftokeep|, whose parameter text +% must be |#1\then|, where |#1| will be a |\count| register. This +% macro must eventually expand to an if of some sort and that if +% evaluating to true is interpreted as that the command should be kept. +% The default replacement text is |\ifnum -1<#1|, which causes a command +% to be killed (not kept) iff the sum of weights for it is negative. +% +% The weight of a glyph is set by |\rename|\-|glyph|, +% |\rename|\-|glyph|\-|weighted|, +% \DescribeMacro{\killglyph}|\kill|\-|glyph|, and +% \DescribeMacro{\killglyphweighted}|\kill|\-|glyph|\-|weighted|. The +% |\rename|\textellipsis\ commands also set a new name for the glyph if +% it survives, whereas the |\kill|\textellipsis\ commands will keep the +% old name. Since the standard settings are that a +% |\rename|\textellipsis\ weight is small and positive and a +% |\kill|\textellipsis\ weight is large and negative, glyphs for which +% a |\kill|\textellipsis\ has been done will usually not survive. +% +% Any one of |\rename|\-|glyph|, |\rename|\-|glyph|\-|weighted|, +% |\kill|\-|glyph|, and |\kill|\-|glyph|\-|weighted| for a glyph will +% override all previous settings +% by any of these four commands for that glyph. The equivalent of the +% neutral state for a glyph (no settings by any of these commands have +% been made for that glyph) is achieved by the command +% \begin{quote} +% |\killglyphweighted|\marg{glyph}|{0}| +% \end{quote} +% +% +% \begin{macro}{\offmtxcommand} +% \begin{macro}{\onmtxcommand} +% These two are just special forms of |\offcommand| and |\oncommand|. +% \begin{macrocode} +\def\offmtxcommand#1{ + \x_cs\offcommand{reglyph_\expandafter\gobble_one\string#1} +} +\def\onmtxcommand#1{ + \x_cs\oncommand{reglyph_\expandafter\gobble_one\string#1} +} +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% \describecsfamily{slots-\meta{glyph}}Inside a |\reglyphfonts| +% \textellipsis\ |\endreglyphfonts| block, the family +% |\slots-|\meta{glyph} of control sequences is used to store the +% information about how glyph \meta{glyph} should be converted. These +% control sequences are either undefined or parameterless macros +% whose replacement texts are of one of the forms +% \begin{quote} +% |\rename_glyph|\marg{to}\marg{weight}\\ +% |\rename_glyph|\marg{to}|\i-renameweight|\\ +% |\kill_glyph|\marg{weight}\\ +% |\kill_glyph\i-killweight| +% \end{quote} +% \meta{to} is what the glyph will be renamed to and \meta{weight} is +% the associated weight. These four different forms are generated by +% the four different commands |\renameglyphweighted|, |\renameglyph|, +% |\killglyphweighted|, and |\killglyph| respectively. +% +% \begin{macro}{\renameglyph} +% \begin{macro}{\renameglyphweighted} +% The difference between the commands |\renameglyphweighted| and +% |\renameglyph| is that the former lets one specify the weight exactly +% while the latter will use the value of the integer |renameweight| +% \emph{at the time of conversion}. By changing the value of +% |renameweight| between two conversions, one changes the weights +% used for all glyph renamings declared using |\renameglyph|. +% \begin{macrocode} +\begingroup + \catcode`\-=11 + \gdef\renameglyph#1#2{ + \x_cs\edef{slots-#2}{ + \noexpand\rename_glyph{#1}\noexpand\i-renameweight + } + } +\endgroup +% \end{macrocode} +% \begin{macrocode} +\def\renameglyphweighted#1#2#3{ + \eval_expr{#3} + \x_cs\edef{slots-#2}{\noexpand\rename_glyph{#1}{\the\result}} +} +% \end{macrocode} +% \end{macro} \end{macro} +% +% \begin{macro}{\killglyph} +% \begin{macro}{\killglyphweighted} +% The difference between the commands |\killglyphweighted| and +% |\killglyph| is that the former lets one specify the weight exactly +% while the latter will use the value of the integer |killweight| +% \emph{at the time of conversion}. By changing the value of +% |killweight| between two conversions, one changes the weights +% used for all glyph killings declared using |\killglyph|. +% \begin{macrocode} +\begingroup + \catcode`\-=11 + \gdef\killglyph#1{ + \x_cs\def{slots-#1}{\kill_glyph\i-killweight} + } +\endgroup +% \end{macrocode} +% \begin{macrocode} +\def\killglyphweighted#1#2{ + \eval_expr{#2} + \x_cs\edef{slots-#1}{\noexpand\kill_glyph{\the\result}} +} +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% \begin{macro}{\reglyphfont} +% The command +% \begin{quote} +% |\reglyphfont|\marg{destination font}\marg{source font} +% \end{quote} +% reads the font metric file \meta{source font}|.mtx| (which must be +% transformable), \meta{source font}|.pl|, or \meta{source font}|.afm| +% (the possibilities are tried in that order) and writes out a font +% metric file \meta{destination font}|.mtx| that is the converted (as +% described above) form of the source font. +% +% \meta{destination font} and \meta{source font} may not be equal. +% \changes{1.903}{1999/06/01}{Using \cs{fromany} for locating font. +% (LH)} +% \changes{1.904}{1999/06/16}{Added \cs{record_transform}. (LH)} +% \begin{macrocode} +\def\reglyphfont#1#2{ + \fromany{#2} + \ifisstr{afm-name}\then + \reglyph_font{#1}{#2} + \else + \fontinsterror{Reglyph}{Could~not~find~font~metrics~for~#2.} + \error_help_a + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\reglyph_font} +% This macro does the actual conversion. +% \begin{macrocode} +\def\reglyph_font#1#2{{ + \open_out{\temp_prefix#1.mtx} + \out_line{\percent_char~Filename:~#1.mtx} + \out_line{\percent_char~Created~by:~tex~\jobname} + \out_line{\percent_char~Created~using:~\string\reglyphfont{#1}{#2}} + \out_line{} + \out_line{\percent_char~This~file~is~used~by~the~fontinst~package.} + \out_line{} + \out_line{\percent_char~THIS~FILE~CAN~BE~DELETED.} + \out_line{} + \out_line{\string\relax} + \out_line{\string\metrics} + \out_line{} + \out_line{\string\needsfontinstversion{\fontinstversion}} + \out_line{} + \record_transform{#1}{\string\frommtx{#2}}{\string\reglyphfont} + \iftrue + \out_line{} + \reglyph_redefinitions + \inputmtx{#2} + \out_line{} + \out_line{\endmetrics_text} + \close_out{Reglyphed~metrics} +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\reglyph_redefinitions} +% This macro serves as a hook. One can make additional commands +% transformable by appending suitable redefenitions of them to this +% macro. +% \changes{1.927}{2003/12/08}{Macro added. The code used to be in +% \cs{reglyph_font}. (LH)} +% \begin{macrocode} +\def\reglyph_redefinitions{ + \let\setint=\reglyph_setint + \let\setdim=\reglyph_setdim + \let\setstr=\reglyph_setstr + \let\setscaledrawglyph=\reglyph_setscaledrawglyph + \let\setscalednotglyph=\reglyph_setscaledrawglyph + \let\setkern=\reglyph_setkern + \let\setglyph=\reglyph_setglyph + \let\glyphpcc=\reglyph_glyphpcc + \let\samesize=\reglyph_samesize + \let\endsetglyph=\reglyph_endsetglyph +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\reglyph_setint} +% \begin{macro}{\reglyph_setdim} +% \begin{macro}{\reglyph_setstr} +% These are just copied to the file generated. +% \begin{macrocode} +\def\reglyph_setint#1#2{\out_line{\string\setint{#1}{#2}}} +\def\reglyph_setdim#1#2{\out_line{\string\setdim{#1}{#2}}} +\def\reglyph_setstr#1#2{\out_line{\string\setstr{#1}{#2}}} +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} +% +% \begin{macro}{\command_survivance} +% This |\count| register stores the sum of the weights associated +% with the glyphs considered so far. It is updated by |\rename_glyph| +% and |\kill_glyph|. +% \begin{macrocode} +\newcount\command_survivance +% \end{macrocode} +% \end{macro} +% +% The macro \DescribeMacro{\glyphname}|\glyphname| holds the name of +% the glyph currently under consideration. It is altered by +% |\rename_glyph|. +% +% \begin{macro}{\rename_glyph} +% \begin{macro}{\kill_glyph} +% \begin{macrocode} +\def\rename_glyph#1{\def\glyphname{#1}\kill_glyph} +\def\kill_glyph#1{\advance \command_survivance #1\x_relax} +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% \begin{macro}{\reglyph_setscaledrawglyph} +% \changes{1.915}{2000/06/25}{Corrected bug in the \cs{ifnum}: it +% should test argument \#5, not \#4. (LH) Encountered by Thierry +% Bouche.} +% The |\reglyph_|\-|setscaled|\-|rawglyph| macro is straightforward. +% Whether it writes a |\setscaled|\-|rawglyph| or a |\setscaled|\-^^A +% |notglyph| command depends on the fifth parameter, just like with +% |\mtxtomtx_|\-|setscaled|\-|rawglyph|. +% \begin{macrocode} +\def\reglyph_setscaledrawglyph#1#2#3#4#5#6#7#8#9{ + \command_survivance=0 + \def\glyphname{#1} + \csname slots-#1\endcsname + \iftokeep\command_survivance\then + \out_line{ + \ifnum #5<\z@ + \string\setscalednotglyph + \else + \string\setscaledrawglyph + \fi + {\glyphname}{#2}{#3}{\number#4}{#5}{#6}{#7}{#8}{#9} + } + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\reglyph_setkern} +% \begin{macrocode} +\def\reglyph_setkern#1#2#3{ + \command_survivance=0 + \def\glyphname{#1} + \csname slots-#1\endcsname + \let\a_macro=\glyphname + \def\glyphname{#2} + \csname slots-#2\endcsname + \iftokeep\command_survivance\then + \out_line{\string\setkern{\a_macro}{\glyphname}{#3}} + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\reglyph_setglyph} +% \multchanges{\cs{reglyph_glyphpcc}\cs{reglyph_samesize}^^A +% \cs{reglyph_setglyph}}{1.911}{1999/12/10}{\cs{string} +% which should be \cs{noexpand} corrected. (LH) Reported by +% Rolf Lindgren.} +% \begin{macro}{\off-\reglyph_setglyph} +% \begin{macro}{\reglyph_glyphpcc} +% \changes{1.911}{1999/12/10}{Typo corrected. (LH) Spotted by Rolf +% Lindgren.} +% \begin{macro}{\reglyph_samesize} +% \begin{macro}{\reglyph_endsetglyph} +% In |\setglyph| \textellipsis\ |\endsetglyph| constructions (which +% are written for composite characters in AFM files), the decision of +% whether to write a command or not due to glyph weights is done +% only once for the entire construction. This means that the commands +% must be saved until the |\endsetglyph| where the result is finally +% known. The token list register |\a_toks| is used for this purpose. +% \begin{macrocode} +\def\reglyph_setglyph#1{ + \command_survivance=0 + \def\glyphname{#1} + \csname slots-#1\endcsname + \edef\a_macro{\noexpand\out_line{\string\setglyph{\glyphname}}} + \a_toks=\expandafter{\a_macro} +} +\x_cs\def{off-\string\reglyph_setglyph}#1{\gobble_glyph} +% \end{macrocode} +% \begin{macrocode} +\def\reglyph_glyphpcc#1#2#3{ + \def\glyphname{#1} + \csname slots-#1\endcsname + \edef\a_macro{\noexpand\out_lline{ + \string\glyphpcc{\glyphname}{#2}{#3} + }} + \a_toks=\expandafter{\the\expandafter\a_toks \a_macro} +} +% \end{macrocode} +% \begin{macrocode} +\def\reglyph_samesize#1{ + \def\glyphname{#1} + \csname slots-#1\endcsname + \edef\a_macro{\noexpand\out_lline{ + \string\samesize{\glyphname} + }} + \a_toks=\expandafter{\the\expandafter\a_toks \a_macro} +} +% \end{macrocode} +% \begin{macrocode} +\def\reglyph_endsetglyph{ + \iftokeep\command_survivance\then + \the\a_toks + \out_line{\string\endsetglyph} + \fi + \a_toks={} +} +%</pkg> +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} +% +% +% \subsubsection*{Three common reglyphing schemes} +% +% As is mensioned elsewhere, the most common reglyphing operation is to +% take a caps and small caps font produced by some major foundry and +% change the glyph names so that they agree with the glyph names used in +% expert fonts. The following code contains the modifying reglyphing +% commands to set up this reglyphing, in two different variants. +% +% The commands are currently based on a comparision of Adobe Garamond +% Small Caps \& Oldstyle Figures (\texttt{padrc8a} in the Berry +% scheme) with Adobe Garamond Regular Expert (\texttt{padr8x} in the +% Berry scheme), so they should be correct for a fair amount of Adobe +% font families, but it is also highly probable that there are lots of +% fonts out there for which it doesn't work quite right. In case you do +% find such a font, please write to tell the \package{fontinst} mailing +% list about it---it would be rather easy to add various alternative +% set-up schemes, controlled by switches, to these files. Just make sure +% first (by checking the newest version of \package{fontinst}) that the +% alternative setting you have found hasn't already been included. +% +% As mentioned, there are two different reglyphing schemes that are set +% up by the code below---one has \package{docstrip} guard \Module{glyphs}, +% the other has guard \Module{!glyphs}---but they both change SC names +% to Expert names. The difference lies instead in what information is +% copied from source font to destination font: the \Module{glyphs} +% variant copies everything, whereas the \Module{!glyphs} variant +% doesn't copy |\setrawglyph| commands, |\setnotglyph| commands, +% |\setscaledrawglyph| commands, |\setscalednotglyph| commands or +% |\setglyph| constructions. The \Module{!glyphs} variant also +% suppresses kerns between two glyphs that doesn't change name. +% +% The motive for having such a curious set-up naturally lies in how the +% files are meant to be used. If you have SC fonts, but no Expert +% fonts, then you should definitely use the \Module{glyphs} variant. If +% on the other hand you have both SC and Expert fonts for a family, +% then it is worth considering using the \Module{!glyphs} variant instead. +% The observation this is based on is that within a triad of the +% corresponding regular, expert, and SC fonts, almost all glyphs present +% in the SC font can also be found in either the regular or the expert +% font; furthermore the only missing glyphs were \texttt{FIsmall}, +% \texttt{FLsmall}, and \texttt{SSsmall}, which (i) were included in the +% SC font only to complete the \texttt{8a} encoding vector and (ii) are +% identical to \package{fontinst}'s fakes for them. +% +% Thus by constructing the \texttt{sc} shape fonts from the regular and +% expert variants, instead of the SC variant, one can get away with +% using one raw font less, thus reducing the time needed for downloading +% the fonts to the printer and the size of the corresponding postscript +% file. One thing not found in either of the regular or expert font in +% the triad is however the kerns between capitals and small capitals, but +% these can be extracted from the metrics of the SC font, and doing this +% is the primary objective for the \Module{!glyphs} variant. +% +% \bigskip +% \changes{1.906}{1999/08/01}{Reglyphing settings files added. (LH)} +% +% First there is the English alphabet: +% \begin{macrocode} +%<*reglyphletters> +\renameglyph{Asmall}{a} +\renameglyph{Bsmall}{b} +\renameglyph{Csmall}{c} +\renameglyph{Dsmall}{d} +\renameglyph{Esmall}{e} +\renameglyph{Fsmall}{f} +\renameglyph{Gsmall}{g} +\renameglyph{Hsmall}{h} +\renameglyph{Ismall}{i} +\renameglyph{Jsmall}{j} +\renameglyph{Ksmall}{k} +\renameglyph{Lsmall}{l} +\renameglyph{Msmall}{m} +\renameglyph{Nsmall}{n} +\renameglyph{Osmall}{o} +\renameglyph{Psmall}{p} +\renameglyph{Qsmall}{q} +\renameglyph{Rsmall}{r} +\renameglyph{Ssmall}{s} +\renameglyph{Tsmall}{t} +\renameglyph{Usmall}{u} +\renameglyph{Vsmall}{v} +\renameglyph{Wsmall}{w} +\renameglyph{Xsmall}{x} +\renameglyph{Ysmall}{y} +\renameglyph{Zsmall}{z} +%</reglyphletters> +% \end{macrocode} +% +% Then there are the figures: +% \multchanges{\notcs{Reglyphing}}{1.911}{1999/12/10} +% {\texttt{eightoldstyle} typo corrected. (LH) Spotted by +% Rolf Lindgren.} +% \multchanges{\notcs{Reglyphing}}{1.927}{2004/07/12} +% {Placed commands for letters and figures in separate modules, +% so that they can be separated in generation. (LH)} +% \begin{macrocode} +%<*reglyphfigures> +\renameglyph{zerooldstyle}{zero} +\renameglyph{oneoldstyle}{one} +\renameglyph{twooldstyle}{two} +\renameglyph{threeoldstyle}{three} +\renameglyph{fouroldstyle}{four} +\renameglyph{fiveoldstyle}{five} +\renameglyph{sixoldstyle}{six} +\renameglyph{sevenoldstyle}{seven} +\renameglyph{eightoldstyle}{eight} +\renameglyph{nineoldstyle}{nine} +%</reglyphfigures> +% \end{macrocode} +% +% Then there are the accents and a couple of miscellaneous symbols. You +% might want to check these carefully, as there might not always be a +% distinction. +% \changes{1.925}{2003/05/13}{Added \cs{renameglyph} for +% \texttt{Hungarumlautsmall}. Walter Schmidt noticed it was missing. +% (LH)} +% \begin{macrocode} +%<*reglyphletters> +\renameglyph{Acutesmall}{acute} +\renameglyph{Brevesmall}{breve} +\renameglyph{Caronsmall}{caron} +\renameglyph{Cedillasmall}{cedilla} +\renameglyph{Circumflexsmall}{circumflex} +\renameglyph{Dieresissmall}{dieresis} +\renameglyph{Dotaccentsmall}{dotaccent} +\renameglyph{Gravesmall}{grave} +\renameglyph{Hungarumlautsmall}{hungarumlaut} +\renameglyph{Macronsmall}{macron} +\renameglyph{Ogoneksmall}{ogonek} +\renameglyph{Ringsmall}{ring} +\renameglyph{Tildesmall}{tilde} +\renameglyph{ampersandsmall}{ampersand} +\renameglyph{centoldstyle}{cent} +\renameglyph{dollaroldstyle}{dollar} +% \end{macrocode} +% +% There are also all the non-English letters: +% \begin{macrocode} +\renameglyph{AEsmall}{ae} +\renameglyph{Ethsmall}{eth} +\renameglyph{Lslashsmall}{lslash} +\renameglyph{Oslashsmall}{oslash} +\renameglyph{OEsmall}{oe} +\renameglyph{Thornsmall}{thorn} +% \end{macrocode} +% \begin{macrocode} +\renameglyph{Agravesmall}{agrave} +\renameglyph{Egravesmall}{egrave} +\renameglyph{Igravesmall}{igrave} +\renameglyph{Ogravesmall}{ograve} +\renameglyph{Ugravesmall}{ugrave} +% \end{macrocode} +% \begin{macrocode} +\renameglyph{Aacutesmall}{aacute} +\renameglyph{Eacutesmall}{eacute} +\renameglyph{Iacutesmall}{iacute} +\renameglyph{Oacutesmall}{oacute} +\renameglyph{Uacutesmall}{uacute} +\renameglyph{Yacutesmall}{yacute} +% \end{macrocode} +% \begin{macrocode} +\renameglyph{Acircumflexsmall}{acircumflex} +\renameglyph{Ecircumflexsmall}{ecircumflex} +\renameglyph{Icircumflexsmall}{icircumflex} +\renameglyph{Ocircumflexsmall}{ocircumflex} +\renameglyph{Ucircumflexsmall}{ucircumflex} +% \end{macrocode} +% \begin{macrocode} +\renameglyph{Atildesmall}{atilde} +\renameglyph{Ntildesmall}{ntilde} +\renameglyph{Otildesmall}{otilde} +% \end{macrocode} +% \begin{macrocode} +\renameglyph{Adieresissmall}{adieresis} +\renameglyph{Edieresissmall}{edieresis} +\renameglyph{Idieresissmall}{idieresis} +\renameglyph{Odieresissmall}{odieresis} +\renameglyph{Ydieresissmall}{ydieresis} +\renameglyph{Udieresissmall}{udieresis} +% \end{macrocode} +% \begin{macrocode} +\renameglyph{Aringsmall}{aring} +\renameglyph{Ccedillasmall}{ccedilla} +\renameglyph{Scaronsmall}{scaron} +\renameglyph{Zcaronsmall}{zcaron} +% \end{macrocode} +% +% The following four glyphs aren't really necessary, since they are +% usually identical to another glyph or to their fakes. +% \begin{macrocode} +\killglyph{dotlessi} +%<*glyphs> +\renameglyph{FIsmall}{fi} +\renameglyph{FLsmall}{fl} +\renameglyph{SSsmall}{germandbls} +%</glyphs> +%<*!glyphs> +\killglyph{fi} +\killglyph{fl} +\killglyph{germandbls} +%</!glyphs> +%</reglyphletters> +% \end{macrocode} +% +% The \Module{!glyphs} settings have no need for |\setrawglyph|, +% |\setscaledrawglyph|, or |\setglyph| commands, and no need for the +% kerns between capitals either, since these are already known from the +% regular variant. Note that it is pointless to say |\offmtxcommand|^^A +% \penalty0|\setrawglyph| as of v\,1.913 since |\setrawglyph| is now +% simply syntactic sugar for the equivalent |\set|\-|scaled|\-|raw|\-^^A +% |glyph|. +% \begin{macrocode} +%<*(reglyphletters|reglyphfigures)&!glyphs> +\offmtxcommand\setscaledrawglyph +\offmtxcommand\setglyph +\resetcommand\iftokeep#1\then{\ifnum 0<#1} +%</(reglyphletters|reglyphfigures)&!glyphs> +% \end{macrocode} +% +% +% \changes{1.904}{1999/06/13}{Font transformation recordings moved to +% \texttt{fimapgen.dtx}, so that the interface will be specified +% in a single place. (LH)} +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \Finale +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/source/fontinst/base/filtfam.dtx b/Master/texmf-dist/source/fontinst/base/filtfam.dtx new file mode 100644 index 00000000000..1cfcf6c1f00 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/filtfam.dtx @@ -0,0 +1,1187 @@ +% \CheckSum{1041} +% \iffalse meta-comment +% +% Copyright 1993, 1994, 1995, 1996 Alan Jeffrey, +% hacked and maintained 1997, 1998 Sebastian Rahtz, +% copyright 1998, 1999 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. +% ----------------------------------------------------- +% +% 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.0 or, at your option, any later version. +% +%%% From file: filtfam.dtx +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{fisource} +\GetFileInfo{filtfam.dtx} +\title{The \package{fontinst} utility} +\author{Alan Jeffrey, Sebastian Rahtz, Ulrik Vieth} +\begin{document} +\maketitle +\DocInput{filtfam.dtx} +\end{document} +%</driver> +% \fi +% +% \section{Installing Latin families} +% +% \changes{1.800}{1998/06/22}{\cs{textcompfamily} integrated into +% \cs{latinfamily}. (UV)} +% +% \begin{macro}{\latinfamily} +% The macro: +% \begin{quote} +% |\latinfamily|\marg{family}\marg{commands} +% \end{quote} +% installs a Latin font family. +% +% \StopEventually{} +% +% \begin{macrocode} +%<*pkg> +\def\latinfamily#1#2{{ + \edef\a_macro{#1} + \expandafter\parse_family\a_macro + \empty_command\empty_command\end_parse_family + \installfonts + \if_file_exists{\raw_encoding.mtx}\then + \installfamily{\raw_encoding}{\latex_family}{#2} + \fi + \installfamily{OT1}{\latex_family}{#2} + \installfamily{T1}{\latex_family}{#2} +%<*textcomp> + \installfamily{TS1}{\latex_family}{#2} +%</textcomp> + \latin_weights + \endinstallfonts +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\parse_family} +% \begin{macro}{\font_family} +% \begin{macro}{\font_variant} +% \begin{macro}{\raw_variant} +% \begin{macro}{\latex_variant} +% |\parse_family FAMILY\end_parse_family| +% +% Intializes |\latex_family| to |FAMILY|, |\font_family| to first +% three characters of |FAMILY|, |\font_variant| and |\raw_variant| +% to fourth and fifth character (if present). +% +% SPQR 02/95: If the fourth parameter is |x| or |9|, then its an expert +% indication, not a variant. So initialy set |\raw_variant| to |#4|, +% but unset it if the expert test succeeds. When |#4| is used for a +% real variant, it passes through. +% +% SPQR 05/95: If it \emph{is} an expert font, then the variantness +% is expressed by the encoding, not a variant letter, so unset +% |\font_variant|. +% +% UV 06/98: Added |\if_oldstyle_| code from Alan's v~1.511 beta. +% If the fourth parameter is |9|, treat it as if |j| was given. +% +% Note that instead of using |\setcommand\digit|, we now use separate +% encoding files for |T1j.etx|, etc. +% +% \begin{macrocode} +\def\parse_family #1#2#3#4#5\end_parse_family{ + \gdef\font_family{#1#2#3} + \gdef\font_variant{#4#5} + \gdef\raw_variant{#4#5} + \gdef\latex_family{#1#2#3#4#5} + \_expert_false + \_oldstyle_false + \ifx#4x + \_expert_true + \gdef\raw_variant{#5} + \gdef\font_variant{#5} + %\setcommand\digit##1{##1} + \else\ifx#4j + \_expert_true + \_oldstyle_true + \gdef\raw_variant{#5} + \gdef\font_variant{#5} + %\setcommand\digit##1{##1oldstyle} + \else\ifx#49 + \gdef\latex_family{#1#2#3j#5} + \_expert_true + \_oldstyle_true + \gdef\raw_variant{#5} + \gdef\font_variant{#5} + %\setcommand\digit##1{##1oldstyle} + \else + \_expert_false + \_oldstyle_false + %\setcommand\digit##1{##1} + \fi\fi\fi +%<*debug> + \if_oldstyle_ + \immediate\write16{INFO>~parse~family~<#1#2#3><#5>~(oldstyle)} + \else\if_expert_ + \immediate\write16{INFO>~parse~family~<#1#2#3><#5>~(expert)} + \else + \immediate\write16{INFO>~parse~family~<#1#2#3><#4#5>} + \fi\fi +%</debug> +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\if_expert_} +% \begin{macro}{\if_oldstyle_} +% \begin{macrocode} +\newif\if_expert_ +\newif\if_oldstyle_ +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection{Processing a list of weights, widths and shapes} +% +% \begin{macro}{\latin_weight} +% \begin{macro}{\font_weight} +% \begin{macro}{\latex_weight} +% |\latin_weight{FONTWEIGHT}{LATEXWEIGHT}| +% +% \begin{macrocode} +\def\latin_weight#1#2{ + \gdef\font_weight{#1}% + \gdef\latex_weight{#2}% + \latin_widths +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\latin_width} +% \begin{macro}{\font_width} +% \begin{macro}{\latex_width} +% |\latin_width{FONTWIDTH}{LATEXWIDTH}| +% +% \begin{macrocode} +\def\latin_width#1#2{ + \gdef\font_width{#1} + \gdef\latex_width{#2} + \latin_shapes +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\latin_shape} +% \begin{macro}{\font_shape} +% \begin{macro}{\raw_shape} +% \begin{macro}{\encoding_shape} +% \begin{macro}{\latex_shape} +% \begin{macro}{\encoding_switches} +% |\latin_shape{FONTSHAPE}{RAWSHAPE}{ENCODINGSHAPE}{LATEXSHAPE}{SWITCHES}| +% +% Calls |\fake_width_WIDTH| and |\fake_shape_SHAPE| to generate an +% |8r|-reencoded |.mtx| file. If successful, calls |\latin_encodings|. +% +% UV 06/98: Added a fifth argument |SWITCHES|, which may be used +% to set |\if_textcomp_| before it is evaluated in |\latin_encodings|. +% +% \begin{macrocode} +\def\latin_shape#1#2#3#4#5{ + \gdef\font_shape{#1} + \gdef\raw_shape{#2} + \gdef\encoding_shape{#3} + \if_oldstyle_ + \gdef\encoding_shape{#3\oldstyle_shape} + \fi + \gdef\latex_shape{#4} + \gdef\encoding_switches{#5} +%<*debug> + \immediate\write16{ + INFO>~to~make~LaTeX~font~shape~<\latex_family, + \latex_weight,\latex_shape,\latex_width>~seek~ + \font_family\font_weight\raw_shape + \raw_variant\raw_encoding\font_width.mtx} +%</debug> + \csname fake_width_\font_width\endcsname + \csname fake_shape_\raw_shape\endcsname + \if_file_exists{ + \font_family\font_weight\raw_shape + \raw_variant\raw_encoding\font_width.mtx + }\then + \latin_encodings + \fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \subsection{Faking font shapes} +% +% (CK) changed font faking code; based on SPQR's code (still in this +% file). I am not sure that know what I am doing here; let's hope +% I won't be caught. Also changed: Order of |\font_width| and +% |\font_encoding| in MANY places. Also added tests which prevent +% multiple calls to the same font faking routine. (Seems to be +% necessary in some cases and can't hurt.) --- (ASAJ) I think CK +% knows more about what he's doing than he's letting on. +% +% \begin{macro}{\fake_shape_} +% Check if an |8a|-encoded |.afm| file exists for current combination +% of font attributes, and, if so, call |\fake_shape_raw_encoding|. +% For expert fonts, also check if an |8x|-encoded |.afm| file exists, +% and call |\fake_shape_expert_encoding|, if approporiate. +% +% UV, 06/98: Cut down lengthy |\fake_shape_| routine into several +% subroutines |\fake_shape_raw_encoding| and optionally +% |\fake_shape_expert_encoding| and |\fake_shape_oldstyle_encoding|. +% +% UV, 06/98: Added experimental code to install OsF or SC\&OsF fonts. +% +% \begin{macrocode} +\def\fake_shape_{ + \if_file_exists{ + \font_family\font_weight\raw_shape\raw_variant + \adobe_encoding\font_width.afm + }\then + \fake_shape_raw_encoding + \fi + \if_expert_ + \if_file_exists{ + \font_family\font_weight\raw_shape\raw_variant + \expert_encoding\font_width.afm + }\then + \fake_shape_expert_encoding + \fi + \fi +%<*oldstyle> + \if_oldstyle_ + \gdef\oldstyle_variant{\oldstyle_shape} + \if_file_exists{ + \font_family\font_weight\raw_shape\oldstyle_variant + \adobe_encoding\font_width.afm + }\then + \fake_shape_oldstyle_encoding + \else + \gdef\oldstyle_variant{\caps_shape} + \if_file_exists{ + \font_family\font_weight\raw_shape\oldstyle_variant + \adobe_encoding\font_width.afm + }\then + \fake_shape_oldstyle_encoding + \fi + \fi + \fi +%</oldstyle> +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fake_shape_raw_encoding} +% Called from |\fake_shape_| if an |8a|-encoded |.afm| file was found. +% Invokes +% \begin{quote} +% |\transformfont{<FONT>8r}|\\ +% | {\reencodefont{8r}{\fromafm{<FONT>8a}}}| +% \end{quote} +% to generate an |8r|-reencoded |.mtx| file (and a raw |.pl| file), +% followed by +% \begin{quote} +% |\installrawfont{<FONT>8r}{<FONT>8r,8r}{8r}...| +% \end{quote} +% to install a ligfull |.pl| file. +% +% \begin{macrocode} +\def\fake_shape_raw_encoding{ + \if_file_exists{ + \font_family\font_weight\raw_shape\raw_variant + \raw_encoding\font_width.mtx + }\then % no action required + \else +%<*debug> + \immediate\write16{ + INFO>~run~\string\transformfont\space\space + <\font_family\font_weight\raw_shape\raw_variant + \raw_encoding\font_width>~from~ + <\font_family\font_weight\raw_shape\raw_variant + \adobe_encoding\font_width> + } +%</debug> + \transformfont{ + \font_family\font_weight\raw_shape\raw_variant + \raw_encoding\font_width + }{ + \reencodefont{\raw_encoding}{ + \fromafm{ + \font_family\font_weight\raw_shape\raw_variant + \adobe_encoding\font_width + } + } + } + \if_file_exists{ \raw_encoding.mtx }\then +%<*debug> + \immediate\write16{ + INFO>~run~\string\installrawfont\space + <\font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width> + <\font_family\font_weight\raw_shape\raw_variant + \raw_encoding\font_width, + \raw_encoding> + <\raw_encoding> + <\raw_encoding> + <\latex_family> + <\latex_weight\latex_width> + <\latex_shape>} +%</debug> + \installrawfont{ + \font_family\font_weight\raw_shape\raw_variant + \raw_encoding\font_width + }{ \font_family\font_weight\raw_shape\raw_variant + \raw_encoding\font_width, + \raw_encoding + }{ \raw_encoding + }{ \raw_encoding + }{ \latex_family + }{ \latex_weight\latex_width + }{ \latex_shape + }{} + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fake_shape_expert_encoding} +% Called from |\fake_shape_| if an |8x|-encoded |.afm| file was found. +% Invokes +% \begin{quote} +% |\fromafm{<FONT>8x}| +% \end{quote} +% to generate an |8x|-encoded |.mtx| file (and a raw |.pl| file). +% +% \begin{macrocode} +\def\fake_shape_expert_encoding{ + \if_file_exists{ + \font_family\font_weight\raw_shape\raw_variant + \expert_encoding\font_width.mtx + }\then % no action required + \else + \fromafm{ + \font_family\font_weight\raw_shape\raw_variant + \expert_encoding\font_width + } + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fake_shape_oldstyle_encoding} +% Called from |\fake_shape_| if an OsF or SC\&OsF variant of an +% |8a|-encoded |.afm| file was found. Invokes +% \begin{quote} +% |\transformfont{<FONT>j8r}|\\ +% | {\reencodefont{8r}{\fromafm{<FONT>j8a}}}| +% \end{quote} +% to generate an |8r|-reencoded |.mtx| file (and a raw |.pl| file). +% +% \begin{macrocode} +%<*oldstyle> +\def\fake_shape_oldstyle_encoding{ + \if_file_exists{ + \font_family\font_weight\raw_shape\oldstyle_variant + \adobe_encoding\font_width.mtx + }\then % no action required + \else +%<*debug> + \immediate\write16{ + INFO>~run~\string\transformfont\space\space + <\font_family\font_weight\raw_shape\oldstyle_variant + \raw_encoding\font_width>~from~ + <\font_family\font_weight\raw_shape\oldstyle_variant + \adobe_encoding\font_width> + } +%</debug> + \transformfont{ + \font_family\font_weight\raw_shape\oldstyle_variant + \raw_encoding\font_width + }{ + \reencodefont{\raw_encoding}{ + \fromafm{ + \font_family\font_weight\raw_shape\oldstyle_variant + \adobe_encoding\font_width + } + } + } + \fi +} +%</oldstyle> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\fake_shape_c} +% Check if an |8a|-encoded |.afm| file exists for the small caps shape. +% If so, call |\fake_shape_| to generate an |8r|-reencoded MTX +% file and to install a ligfull |.pl| file. If not, reset |\raw_shape| +% to the default shape and |\encoding_shape| to small caps before +% calling |\fake_shape_| to install a faked small caps font. +% +% \begin{macrocode} +\def\fake_shape_c{ + \if_file_exists{ + \font_family\font_weight\raw_shape\raw_variant + \adobe_encoding\font_width.afm + }\then + \fake_shape_ + \else + % If real smallcaps font doesn't exist, fake it from the roman. + \gdef\raw_shape{} + \if_oldstyle_ + \gdef\encoding_shape{cj} + \else + \gdef\encoding_shape{c} + \fi + \fake_shape_ + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\fake_shape_o} +% Check if an |8a|-encoded |.afm| file exists for the oblique shape. +% If so, call |\fake_shape_| to generate an |8r|-reencoded MTX +% file and to install a ligfull |.pl| file. If not, call macros +% to fake a oblique fonts. +% +% \begin{macrocode} +\def\fake_shape_o{ + \if_file_exists{ + \font_family\font_weight\raw_shape\raw_variant + \adobe_encoding\font_width.afm + }\then + \fake_shape_ + \else + \fake_shape_o_raw_encoding + \if_expert_ + \fake_shape_o_expert_encoding + \fi +%<*oldstyle> + \if_oldstyle_ + \fake_shape_o_oldstyle_encoding + \fi +%</oldstyle> + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fake_shape_o_raw_encoding} +% Called from |\fake_shape_o| if the oblique shape needs to be faked. +% Invokes +% \begin{quote} +% |\transformfont{<FONT>o8r}|\\ +% | {\slantfont{SLANT}{\frommtx{<FONT>8r}}}| +% \end{quote} +% to generate an |8r|-reencoded |.mtx| file (and a raw |.pl| file), +% followed by +% \begin{quote} +% |\installrawfont{<FONT>o8r}{<FONT>o8r,8r}{8r}...| +% \end{quote} +% to install a ligfull |.pl| file. +% +% \begin{macrocode} +\def\fake_shape_o_raw_encoding{ + \if_file_exists{ + \font_family\font_weight\raw_variant + \raw_encoding\font_width.mtx + }\then + \if_file_exists{ + \font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width.mtx + }\then % no action required + \else +%<*debug> + \immediate\write16{ + INFO>~run~\string\transformfont\space\space + <\font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width>~from~ + <\font_family\font_weight\raw_variant + \raw_encoding\font_width>~(faking~oblique) + } +%</debug> + %%% WARNING: famtool.pl relies on this message format!!! + \immediate\write16{ + Faking~oblique~font~ + \font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width + \space from~ + \font_family\font_weight\raw_variant + \raw_encoding\font_width + } + \transformfont{ + \font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width + }{ + \slantfont{\SlantAmount}{ + \frommtx{ + \font_family\font_weight\raw_variant + \raw_encoding\font_width + } + } + } + \if_file_exists{ \raw_encoding.mtx }\then +%<*debug> + \immediate\write16{ + INFO>~run~\string\installrawfont\space + <\font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width> + <\font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width, + \raw_encoding> + <\raw_encoding> + <\raw_encoding> + <\latex_family> + <\latex_weight\latex_width> + <\latex_shape>} +%</debug> + \installrawfont{ + \font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width + }{ \font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width, + \raw_encoding + }{ \raw_encoding + }{ \raw_encoding + }{ \latex_family + }{ \latex_weight\latex_width + }{ \latex_shape + }{} + \fi + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fake_shape_o_expert_encoding} +% Called from |\fake_shape_o| if the oblique shape needs to be faked. +% Invokes +% \begin{quote} +% |\transformfont{<FONT>o8x}|\\ +% | {\slantfont{SLANT}{\frommtx{<FONT>8x}}}| +% \end{quote} +% to generate an |8x|-reencoded |.mtx| file (and a raw |.pl| file). +% +% \begin{macrocode} +\def\fake_shape_o_expert_encoding{ + \if_file_exists{ + \font_family\font_weight\raw_variant + \expert_encoding\font_width.mtx + }\then + \if_file_exists{ + \font_family\font_weight\font_shape\raw_variant + \expert_encoding\font_width.mtx + }\then % no action required + \else +%<*debug> + \immediate\write16{ + INFO>~run~\string\transformfont\space\space + <\font_family\font_weight\font_shape\raw_variant + \expert_encoding\font_width>~from~ + <\font_family\font_weight\raw_variant + \expert_encoding\font_width>~(faking~oblique) + } +%</debug> + %%% WARNING: famtool.pl relies on this message format!!! + \immediate\write16{ + Faking~oblique~font~ + \font_family\font_weight\font_shape\raw_variant + \expert_encoding\font_width + \space from~ + \font_family\font_weight\raw_variant + \expert_encoding\font_width + } + \transformfont{ + \font_family\font_weight\font_shape\raw_variant + \expert_encoding\font_width + }{ + \slantfont{\SlantAmount}{ + \frommtx{ + \font_family\font_weight\raw_variant + \expert_encoding\font_width + } + } + } + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fake_shape_o_oldstyle_encoding} +% Called from |\fake_shape_o| if the oblique shape needs to be faked. +% Invokes +% \begin{quote} +% |\transformfont{<FONT>oj8r}|\\ +% | {\slantfont{SLANT}{\frommtx{<FONT>j8r}}}| +% \end{quote} +% to generate an |8r|-reencoded |.mtx| file (and a raw |.pl| file). +% +% \begin{macrocode} +%<*oldstyle> +\def\fake_shape_o_oldstyle_encoding{ + \if_file_exists{ + \font_family\font_weight\oldstyle_variant + \raw_encoding\font_width.mtx + }\then + \if_file_exists{ + \font_family\font_weight\font_shape\oldstyle_variant + \raw_encoding\font_width.mtx + }\then % no action required + \else +%<*debug> + \immediate\write16{ + INFO>~run~\string\transformfont\space\space + <\font_family\font_weight\font_shape\oldstyle_variant + \raw_encoding\font_width>~from~ + <\font_family\font_weight\oldstyle_variant + \raw_encoding\font_width>~(faking~oblique) + } +%</debug> + %%% WARNING: famtool.pl relies on this message format!!! + \immediate\write16{ + Faking~oblique~font~ + \font_family\font_weight\font_shape\oldstyle_variant + \raw_encoding\font_width + \space from~ + \font_family\font_weight\oldstyle_variant + \raw_encoding\font_width + } + \transformfont{ + \font_family\font_weight\font_shape\oldstyle_variant + \raw_encoding\font_width + }{ + \slantfont{\SlantAmount}{ + \frommtx{ + \font_family\font_weight\oldstyle_variant + \raw_encoding\font_width + } + } + } + \fi + \fi +} +%</oldstyle> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\fake_shape_i} +% Call |\fake_shape_| to generate an |8r|-reencoded |.mtx| file and a +% ligfull |.pl| file, if a corresponding |8a|-encoded |.afm| file exists. +% Otherwise, do nothing, since an italic shape can't be faked. +% +% \begin{macrocode} +\let\fake_shape_i\fake_shape_ % We must do this again! +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Faking font widths} +% +% \begin{macro}{\if_fake_narrow_} +% \begin{macrocode} +\newif\if_fake_narrow_ +\_fake_narrow_false +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fakenarrow} +% |\fakenarrow{WIDTH}| +% +% Sets the expansion factor used to generate faked narrow fonts. +% If it isn't set, do not attempt to install faked narrow fonts. +% \begin{macrocode} +\def\fakenarrow#1{ + \_fake_narrow_true + \gdef\fake_narrow_width{#1} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fake_width_} +% Do nothing for the default width or the condensed width. +% \begin{macrocode} +\def\fake_width_{} +\def\fake_width_c{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fake_width_n} +% If we are faking narrow fonts, check if an |8a|-encoded |.afm| file +% exists for the current shape in narrow width, and if not call +% |\fake_shape_n_raw_encoding| and |\fake_shape_n_expert_encoding|. +% +% \begin{macrocode} +\def\fake_width_n{ + \if_fake_narrow_ + \if_file_exists{ + \font_family\font_weight\raw_shape\raw_variant + \adobe_encoding\font_width.afm + }\then % no action required + \else + \fake_width_n_raw_encoding + \if_expert_ + \fake_width_n_expert_encoding + \fi + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fake_width_n_raw_encoding} +% Called from |\fake_width_n| if the narrow width needs to be faked. +% Invokes +% \begin{quote} +% |\transformfont{<FONT>8rn}|\\ +% | {\xscalefont{WIDTH}{\frommtx{<FONT>8r}}}| +% \end{quote} +% to generate an |8r|-encoded |.mtx| file for a faked narrow font, +% followed by +% \begin{quote} +% |\installrawfont{<FONT>8rn}{<FONT>8rn,8r}{8r}...| +% \end{quote} +% to install a ligfull |.pl| file. +% +% \begin{macrocode} +\def\fake_width_n_raw_encoding{ + \if_file_exists{ + \font_family\font_weight\font_shape\raw_variant + \raw_encoding.mtx + }\then + \if_file_exists{ + \font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width.mtx + }\then % no action required + \else +%<*debug> + \immediate\write16{ + INFO>~run~\string\transformfont\space\space + <\font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width>~from~ + <\font_family\font_weight\font_shape\raw_variant + \raw_encoding>~(faking~narrow) + } +%</debug> + %%% WARNING: famtool.pl relies on this message format!!! + \immediate\write16{ + Faking~narrow~font~ + \font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width + \space from~ + \font_family\font_weight\font_shape\raw_variant + \raw_encoding + } + \transformfont{ + \font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width + }{ + \xscalefont{\fake_narrow_width}{ + \frommtx{ + \font_family\font_weight\font_shape\raw_variant + \raw_encoding + } + } + } + \if_file_exists{ \raw_encoding.mtx }\then +%<*debug> + \immediate\write16{ + INFO>~run~\string\installrawfont\space + <\font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width> + <\font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width, + \raw_encoding> + <\raw_encoding> + <\raw_encoding> + <\latex_family> + <\latex_weight\latex_width> + <\latex_shape>} +%</debug> + \installrawfont{ + \font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width + }{ \font_family\font_weight\font_shape\raw_variant + \raw_encoding\font_width, + \raw_encoding + }{ \raw_encoding + }{ \raw_encoding + }{ \latex_family + }{ \latex_weight\latex_width + }{ \latex_shape + }{} + \fi + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fake_width_n_expert_encoding} +% Called from |\fake_width_n| if the narrow width needs to be faked. +% Invokes +% \begin{quote} +% |\transformfont{<FONT>8xn}|\\ +% | {\xscalefont{WIDTH}{\frommtx{<FONT>8x}}}| +% \end{quote} +% to generate an |8x|-encoded |.mtx| file for a faked narrow font. +% +% \begin{macrocode} +\def\fake_width_n_expert_encoding{ + \if_file_exists{ + \font_family\font_weight\font_shape\raw_variant + \expert_encoding.mtx + }\then + \if_file_exists{ + \font_family\font_weight\font_shape\raw_variant + \expert_encoding\font_width.mtx + }\then % no action required + \else +%<*debug> + \immediate\write16{ + INFO>~run~\string\transformfont\space\space + <\font_family\font_weight\font_shape\raw_variant + \expert_encoding\font_width>~from~ + <\font_family\font_weight\font_shape\raw_variant + \expert_encoding>~(faking~narrow) + } +%</debug> + %%% WARNING: famtool.pl relies on this message format!!! + \immediate\write16{ + Faking~narrow~font~ + \font_family\font_weight\font_shape\raw_variant + \expert_encoding\font_width + \space from~ + \font_family\font_weight\font_shape\raw_variant + \expert_encoding + } + \transformfont{ + \font_family\font_weight\font_shape\raw_variant + \expert_encoding\font_width + }{ + \xscalefont{\fake_narrow_width}{ + \frommtx{ + \font_family\font_weight\font_shape\raw_variant + \expert_encoding + } + } + } + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Installing reencoded fonts} +% +% \begin{macro}{\latin_encoding} +% \begin{macro}{\font_encoding} +% \begin{macro}{\latex_encoding} +% \begin{macro}{\latex_mtx} +% +% |\latin_encoding{FONTENC}{EXPERTISED-ENC}{OLDSTYLE-ENC}| +% |{LATEXENC}{LATEXMTX}| +% +% If this is an expertised family |EXPERTISED-ENC| is used instead +% of |FONTENC|. If this is an expertised family with oldstyle +% digits |OLDSTYLE-ENC| is used instead of |EXPERTISED-ENC|. +% +% UV 06/98: Added code for oldstyle encodings from Alan's v~1.511. +% The |\font_encoding| is changed when |\if_oldstyle_| is true. +% +% UV 06/98: Added anonther parameter for the default metrics file +% (which is usually either |latin.mtx| or |textcomp.mtx|). +% +% UV 06/98: Added experimental code for OsF or SC\&OsF fonts. +% +% \begin{macrocode} +\def\latin_encoding#1#2#3#4#5{ + \gdef\latex_encoding{#4} + \gdef\latex_mtx{#5} + \if_oldstyle_ + \gdef\font_encoding{#3} + \else\if_expert_ + \gdef\font_encoding{#2} + \else + \gdef\font_encoding{#1} + \fi\fi + \gdef\expert_font{} + \gdef\oldstyle_font{} + \if_expert_ + \if_file_exists{ + \font_family\font_weight\raw_shape\raw_variant + \expert_encoding\font_width.mtx + }\then + \gdef\expert_font{ + \font_family\font_weight\raw_shape\raw_variant + \expert_encoding\font_width, + } + \fi + \fi +%<*oldstyle> + \if_oldstyle_ + \if_file_exists{ + \font_family\font_weight\raw_shape\oldstyle_variant + \raw_variant\raw_encoding\font_width.mtx + }\then + \gdef\oldstyle_font{ + unsetnum, + \font_family\font_weight\raw_shape\oldstyle_variant + \raw_variant\raw_encoding\font_width, + resetosf, + } + \fi + \fi +%</oldstyle> +%<*debug> + \immediate\write16{ + INFO>~run~\string\installfont\space + <\font_family\font_weight\font_shape\font_variant + \font_encoding\font_width> + <\font_family\font_weight\raw_shape\raw_variant + \raw_encoding\font_width, + \if_oldstyle_ + \ifx\raw_shape\caps_shape + resetosf, + \fi + \fi + \expert_font + \oldstyle_font + \latex_mtx> + <\latex_encoding\encoding_shape> + <\latex_encoding> + <\latex_family> + <\latex_weight\latex_width> + <\latex_shape>} +%</debug> + \installfont{ + \font_family\font_weight\font_shape\font_variant + \font_encoding\font_width + }{ + \font_family\font_weight\raw_shape\raw_variant + \raw_encoding\font_width, + \if_oldstyle_ + \ifx\raw_shape\caps_shape + resetosf, + \fi + \fi + \expert_font + \oldstyle_font + \latex_mtx + }{ + \latex_encoding\encoding_shape + }{ + \latex_encoding + }{ + \latex_family + }{ + \latex_weight\latex_width + }{ + \latex_shape + }{} +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsection{Default weights, widths and shapes} +% +% \begin{center} +% \begin{tabular}{llll} +% \hline +% \multicolumn{2}{l}{Fontname: \texttt{weight.map}} & +% \multicolumn{2}{l}{NFSS: \emph{\LaTeX\ Companion}, p.~190} \\ +% \hline +% |a| & Thin Hairline & |ul| & Ultra Light \\ +% |j| & ExtraLight & |el| & Extra Light \\ +% |l| & Light & |l| & Light \\ +% |r| & Regular Roman & |m| & Medium \\ +% |k| & Book & |m| & Medium \\ +% |m| & Medium & |mb| & (was: |m|) \\ +% |d| & Demi & |db| & (was: |sb|) \\ +% |s| & Semibold & |sb| & Semibold \\ +% |b| & Bold & |b| & Bold \\ +% |h| & Heavy Heavyface & |eb| & (was missing) \\ +% |c| & Black & |eb| & (was missing) \\ +% |x| & ExtraBold ExtraBlack & |eb| & Extra Bold \\ +% |u| & Ultra UltraBlack & |ub| & Ultra Bold \\ +% |p| & Poster & & (still missing) \\ +% \hline +% \end{tabular} +% \end{center} +% +% \begin{macro}{\latin_weights} +% Each call to |\latin_weight| maps a Fontname weight code +% (|\font_weight|) to a \LaTeX{} weight code (|\latex_weight|). +% Non-existing weights are ignored (or substituted when the +% |.fd| files are written out by |\endinstallfont|). +% +% The standard values are given in the table. They may be changed, +% but you'd better know what you're doing. +% +% UV, 04/98: Changed the processing order: Do the most common +% shapes first. Added new mappings for |c| and |h|, changed +% mapping for |m| to newly invented \LaTeX{} weight |mb|. +% +% \begin{macrocode} +\def\latin_weights{ + \latin_weight{r}{m} + \latin_weight{k}{m} + \latin_weight{b}{b} + \latin_weight{s}{sb} + \latin_weight{d}{db} % was {d}{sb}, SPQR changed + \latin_weight{m}{mb} % was {m}{m}, UV changed + \latin_weight{c}{eb} % UV added + \latin_weight{h}{eb} % UV added + \latin_weight{x}{eb} + \latin_weight{u}{ub} + \latin_weight{l}{l} + %\latin_weight{j}{el} + %\latin_weight{a}{ul} % UV added +} +% \end{macrocode} +% \end{macro} +% +% \begin{center} +% \begin{tabular}{llll} +% \hline +% \multicolumn{2}{l}{Fontname: \texttt{width.map}} & +% \multicolumn{2}{l}{NFSS: \emph{\LaTeX\ Companion}, p.~190} \\ +% \hline +% |t| & Thin & -- & -- \\ +% |o| & Ultra Condensed & |uc| & Ultra Condensed \\ +% |u| & Ultra Compressed & |uc| & . . \\ +% |q| & Extra Compressed & |ec| & Extra Condensed \\ +% |c| & Condensed & |c| & Condensed \\ +% |p| & Compressed & |c| & . . \\ +% |n| & Narrow & |c| & . . \\ +% -- & -- & |sc| & Semi Condensed \\ +% |r| & Normal, Medium, Regular & |m| & Medium \\ +% -- & -- & |sx| & Semi Expanded \\ +% |e| & Expanded & |x| & Expanded \\ +% |x| & Extended & |x| & . . \\ +% |v| & Extra Expanded & |ex| & Extra Expanded \\ +% -- & -- & |ux| & Ultra Expanded \\ +% |w| & Wide & -- & -- \\ +% \hline +% \end{tabular} +% \end{center} +% +% \begin{macro}{\latin_widths} +% Each call to |\latin_width| maps a Fontname width code +% (|\font_width|) to a \LaTeX{} width code (|\latex_width|). +% Non-existing narrow fonts are faked only if |\fakenarrow| +% is specifically called for. +% +% \begin{macrocode} +\def\latin_widths{ + \latin_width{}{} + \latin_width{n}{c} + %latin_width{c}{c} + %latin_width{x}{x} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\latin_shapes} +% The fifth argument of |\latin_shape| is stored in the variable +% |\encoding_switches|. +% \begin{macrocode} +\def\latin_shapes{ + \latin_shape{} {} {} {n} {\_textcomp_true } + \latin_shape{c}{c}{} {sc}{\_textcomp_false} + \latin_shape{o}{o}{} {sl}{\_textcomp_true } + \latin_shape{i}{i}{i}{it}{\_textcomp_true } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\latin_encodings} +% |\encoding_switches| is evaluated immediatley before the +% |\if_textcomp_| test to set it as appropriate for the curent shape. +% \changes{1.925}{2003/03/31}{Changed from using \texttt{latin.mtx} to +% \texttt{newlatin.mtx}. (LH)} +% \begin{macrocode} +\def\latin_encodings{ + \latin_encoding{7t}{9t}{9o}{OT1}{newlatin} + \latin_encoding{8t}{9e}{9d}{T1} {newlatin} +%<*textcomp> + \encoding_switches + \if_textcomp_ + \latin_encoding{8c}{9c}{9c}{TS1}{textcomp} + \fi +%</textcomp> +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\if_textcomp_} +% Switch to control whether or not to install a text companion +% encoding. It is set or unset for each shape by |\latin_shapes| +% and evaluated in |\latin_encodings|. +% +% \begin{macrocode} +\newif\if_textcomp_ +% \end{macrocode} +% \end{macro} + +% +% \begin{macro}{\raw_encoding} +% \begin{macro}{\adobe_encoding} +% \begin{macro}{\expert_encoding} +% \begin{macrocode} +\def\raw_encoding{8r} +\def\adobe_encoding{8a} +\def\expert_encoding{8x} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} + +% \begin{macro}{\caps_shape} +% \begin{macro}{\oldstyle_shape} +% \begin{macrocode} +\def\caps_shape{c} +\def\oldstyle_shape{j} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\SlantAmount} +% \begin{macrocode} +\def\SlantAmount{167} +%</pkg> +% \end{macrocode} +% \end{macro} +% +% \Finale +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/source/fontinst/base/fimain.dtx b/Master/texmf-dist/source/fontinst/base/fimain.dtx new file mode 100644 index 00000000000..62ae7dad6fa --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/fimain.dtx @@ -0,0 +1,4848 @@ +% \CheckSum{4010} +% \iffalse meta-comment +% +% Copyright 1993, 1994, 1995, 1996 Alan Jeffrey, +% hacked and maintained 1997, 1998 Sebastian Rahtz, +% copyright 1998, 1999, 2000 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. +% ----------------------------------------------------- +% +% 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: fimain.dtx +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{fisource} +\title{The \package{fontinst} utility} +\author{Alan Jeffrey, Sebastian Rahtz, Ulrik Vieth, Lars Hellstr\"om} +\begin{document} +\maketitle +\tableofcontents +\DocInput{fimain.dtx} +\end{document} +%</driver> +% \fi +% +% \StopEventually{} +% +% +% \section{Encoding files} +% +% \changes{1.911}{1999/11/21}{Definitions of encoding file commands +% added to \protect\protect\protect\Module{misc}. (LH)} +% +% \DescribeMacro{\inputetx} +% The macro +% \begin{quote} +% |\inputetx|\marg{filename} +% \end{quote} +% inputs \meta{filename}|.etx|, ignoring anything between |\relax| +% and |\encoding|, and anything after |\endencoding|. +% +% The file name is transformed to lowercase before opening. +% +% \begin{macro}{\inputetx} +% \begin{macro}{\encoding} +% \changes{1.900}{1999/02/07} +% {Changed group in fontdoc to \cs{begingroup} type. (LH)} +% \usechange{raggedright} +% \begin{macro}{\endencoding} +% \changes{1.900}{1999/02/07}{Made it outer. (LH)} +% \usechange{raggedright} +% \begin{macrocode} +%<*pkg|misc> +\def\inputetx#1{ + \edef\lowercase_file{\lowercase{ + \edef\noexpand\lowercase_file{#1}}} + \lowercase_file + \slot_number=0 + \def\relax{\let\relax=\x_relax\iffalse} + \let\encoding=\fi + \primitiveinput \lowercase_file.etx\x_relax + \let\relax=\x_relax +} +\let\encoding=\relax +\outer\def\endencoding{\endinput} +%</pkg|misc> +% \end{macrocode} +% +% Things are a bit more complicated in \package{fontdoc}, since the +% |\relax| \textellipsis\ |\encoding| \textellipsis\ |\endencoding| +% markup must be able to work in two different ways. In the main file +% only |\encoding| actually does anything---it sets |\slot@number| to +% zero. In a file that is being |\inputetx|ed, they must work as with +% \package{fontinst}: Everything between |\relax| and |\encoding|, +% and everything after |\endencoding| must be ignored. +% \multchanges{\cs{inputetx}\cs{inputmtx}}{1.914}{2000/05/27} +% {New \package{fontdoc} definition, using \cs{IfFileExists}. (LH)} +% \multchanges{\cs{encoding}\cs{endencoding}}{1.918}{2001/06/19} +% {Added \cs{par} and \cs{addvspace} to \package{fontdoc} +% definitions. (LH)} +% \multchanges{\cs{endencoding}}{1.919}{2001/09/01} +% {Added setting of \cs{parindent} to 1\,em to \package{fontdoc} +% definition. (LH)} +% \begin{macrocode} +%<*doc> +\def\inputetx#1{% + \begingroup + \edef\lowercase@file{\lowercase{% + \edef\noexpand\lowercase@file{#1}% + }}% + \lowercase@file + \global\slot@number=0% + \FD@slot@known@true + \IfFileExists{\lowercase@file.etx}{% + \def\relax{\let\relax=\x@relax\iffalse}% + \let\encoding=\fi + \outer\x@cs\def{endencoding}{\endinput}% + \@@input \@filef@und + \let\relax=\x@relax + }{% + \PackageError{fontdoc}{File #1.etx not found}% + {\@eha\MessageBreak You can \protect\inputetx\space + some other file now, if you want.}% + } + \endgroup +} +\def\encoding{% + \par + \ifFD@spec@ \addvspace{\bigskipamount}\fi + \begin{flushleft} + \global\slot@number=\z@ +} +\outer\def\endencoding{% + \end{flushleft} + \ifFD@spec@ \addvspace{\bigskipamount}\fi +} +%</doc> +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} +% +% +% \begin{macro}{\setslot} +% \changes{1.917}{2001/03/23}{Made slots referencable using +% \cs{label}. (LH)} +% \begin{macro}{\endsetslot} +% \begin{macro}{\slot_name} +% |\setslot|\marg{name} \meta{slot commands} |\endsetslot| +% +% In \package{fontinst}, this sets |\slot_name| to \meta{name} and +% calls |\do_slot| at the beginning of the slot and it calls +% |\end_do_slot| and increments |\slot_number| by one at the end. +% By default, |\do_slot| and |\end_do_slot| do nothing, but this is +% over-ridden later. +% +% \begin{macrocode} +%<*pkg|misc> +\def\setslot#1{\edef\slot_name{#1}\do_slot} +\def\endsetslot{\end_do_slot\advance\slot_number by 1\x_relax} +%</pkg|misc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\slot@name} +% \changes{1.917}{2001/03/23}{Now storing the printable form of the +% name, rather than the raw code. (LH)} +% In \package{fontdoc}, the same code converts \meta{name} to a +% printable string and stores the result in |\slot@name|, prints an +% |\Aheading| heading for the slot which show the name and number +% of the slot, and prints the current automatic slot comment (if +% one has been set) at the beginning of the slot. At the end of +% the slot, it simply increments |\slot@number| by one. +% +% \begin{macrocode} +%<*doc> +\newcommand\setslot[1]{% + \protected@edef\slot@name{% + \noexpand\MakePrintable \noexpand\slot@name {FD@swa}{#1}% + }% + \slot@name + \FD@tight@true + \Aheading{Slot + \ifFD@slot@known@ + \the\slot@number\space + \else + \(\FD@slot@expression + \the\slot@number\) + \fi + `\FD@typeset@string{\slot@name}'% + }% + \protected@edef\@currentlabel{% + \ifFD@slot@known@ + \the\slot@number + \else + \protect\(% + \FD@slot@expression+\the\slot@number + \protect\)% + \fi + \space(\protect\FD@typeset@string{\slot@name})% + }% + \ifFD@slot@known@ \ifslot@comment@ \comment{\slot@comment}\fi\fi +} +\def\endsetslot{% + \global\advance \slot@number \@ne + \FD@tight@false +} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\do_slot} +% \begin{macro}{\end_do_slot} +% \begin{macrocode} +%<*pkg|misc> +\let\do_slot\empty_command +\let\end_do_slot\empty_command +% \end{macrocode} +% \end{macro} \end{macro} +% \multchanges{\cs{do_new_slot}}{1.910}{1999/11/01}{Macro removed. (LH)} +% +% \begin{macro}{\nextslot} +% \begin{macro}{\skipslots} +% \begin{macro}{\slot_number} +% \begin{macro}{\slot@number} +% \begin{switch}{FD@slot@known@} +% \begin{macro}{\FD@slot@expression} +% |\nextslot|\marg{integer expression}\\ +% |\skipslots|\marg{integer expression} +% +% In \package{fontinst}, |\nextslot| sets the |\slot_number| and +% |\skipslots| addvances the |\slot_number|. +% +% \begin{macrocode} +\newcount\slot_number +\def\nextslot#1{\eval_expr_to\slot_number{#1}} +\def\skipslots#1{\eval_expr{#1} \advance\slot_number by \result} +%</pkg|misc> +% \end{macrocode} +% +% The commands do the same in \package{fontdoc} as in +% \package{fontinst}, although they do it to |\slot@number| instead of +% |\slot_number|. +% +% \begin{macrocode} +%<*doc> +\newcount\slot@number +\def\FD@slot@known@true{\global\let\ifFD@slot@known@\iftrue} +\def\FD@slot@known@false{\global\let\ifFD@slot@known@\iffalse} +\FD@slot@known@true +\newcommand\nextslot[1]{% + \FD@evaluate@true + \FD@eval@expr{#1}% + \ifFD@evaluate@ + \global\slot@number=\FD@result + \FD@slot@known@true + \else + \global\let\FD@slot@expression=\FD@expression + \global\slot@number=\z@ + \FD@slot@known@false + \fi +} +\newcommand\skipslots[1]{% + \FD@evaluate@true + \FD@eval@expr{#1}% + \ifFD@evaluate@ + \global\advance \slot@number \FD@result + \else + \ifFD@slot@known@ + \global\let\FD@slot@expression=\FD@expression + \else + \protected@xdef\FD@slot@expression{% + \FD@slot@expression+\FD@expression + }% + \fi + \FD@slot@known@false + \fi +} +%</doc> +% \end{macrocode} +% +% There has been some ambiguity concerning what is allowed as +% arguments of \cs{nextslot} and \cs{skipslots}. At least since +% v\,1.335 the comments in the source has said it was an integer +% expression, but the implementation was for a \TeX\ number. +% Alan's v\,1.5 manual and Rowland's v\,1.8 manual both say the +% arguments must be numbers. Allowing arbitrary integer +% expressions with \package{fontinst} is trivial, the above +% implementation copes with that, but \package{fontdoc} gets in +% trouble, so what should we do about it? /LH +% +% AFAIK, all instances of |\nextslot| or |\skipslots| appearing in +% present |*.etx| files are explicit numbers, no fancy constructs. /UV +% +% No, but if a |\setslot| command appears in a |\for| loop then the +% slot number in that command will depend on the values of various +% integer expressions anyway, so we might as well deal with it. /LH +% +% The matter was finally resolved when \package{fontdoc} was +% augmented to handle (and typeset) arbtrary integer expressions. +% +% \multchanges{\cs{nextslot}\cs{skipslots}}{1.900}{1999/02/07}^^A +% {Made changes of \cs{slot@number} global. (LH)} +% \end{macro}\end{switch}\end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\setleftboundary} +% \multchanges{\cs{setleftboundary}\cs{endsetleftboundary}}^^A +% {1.909}{1999/10/19}{\package{fontdoc} definition added. (LH)} +% \changes{1.917}{2001/03/23}{Made the left boundary referencable +% using \cs{label}. (LH)} +% \begin{macro}{\endsetleftboundary} +% \begin{macro}{\do_boundary} +% |\setleftboundary|\marg{glyph} \meta{slot commands} +% |\endsetleftboundary| +% +% These macros are like |\setslot| and |\endsetslot|, but they merely +% set the left boundary ligkern program, they do not cause any +% |CHARACTER| property list to be written. Thus the only metric +% information connected to the \meta{glyph} argument that is ever used +% is the kerns with this glyph on the left. +% +% |\do_boundary| and |\endsetleftboundary| are initally |\relax|, but +% are later redefined. +% +% \begin{macrocode} +%<*pkg> +\def\setleftboundary#1{\edef\slot_name{#1}\do_boundary} +\let\endsetleftboundary\x_relax +\let\do_boundary\x_relax +%</pkg> +%<*doc> +\newcommand\setleftboundary[1]{% + \protected@edef\slot@name{% + \noexpand\MakePrintable \noexpand\slot@name {FD@swa}{#1}% + }% + \slot@name + \FD@tight@true + \Aheading{Left boundary `\FD@typeset@string{\slot@name}'}% + \protected@edef\@currentlabel{% + left boundary (\protect\FD@typeset@string{\slot@name})% + }% +} +\let\endsetleftboundary=\FD@tight@false +%</doc> +%<*misc> +\let\setleftboundary=\gobble_one +\let\endsetleftboundary=\x_relax +%</misc> +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% \begin{macro}{\setrightboundary} +% |\setrightboundary|\marg{glyph} +% +% The |\setrightboundary| macro should be used to set which slot in +% the font is used as right boundary marker if that slot is empty. It +% advances |\slot_number| just like a |\setslot| \textellipsis\ +% |\endsetslot| pair, but since the slot will be left empty, there is +% no need for any \meta{slot commands}, and hence there is no need for +% a closing |\endset|\textellipsis\ command either. +% +% If the right boundary marker slot is not to be left empty (often +% unavoidable), then one should use the slot command +% |\makerightboundary| instead. +% +% \changes{1.909}{1999/10/19}{doc definition added. (LH)} +% \begin{macrocode} +%<*pkg|misc> +\def\setrightboundary#1{ + \makerightboundary{#1} + \advance \slot_number 1\x_relax +} +%</pkg|misc> +%<*doc> +\newcommand\setrightboundary[1]{% + \Aheading{Right boundary slot + \ifFD@slot@known@ + \the\slot@number\space + \else + \(\FD@slot@expression + \the\slot@number\) + \fi + `\TypesetStringExpression{#1}'% + }% + \global\advance \slot@number \@ne +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% \DescribeMacro{\ligature} +% \DescribeMacro{\Ligature} +% \DescribeMacro{\oddligature} +% \DescribeMacro{\nextlarger} +% \DescribeMacro{\varchar} +% \DescribeMacro{\endvarchar} +% \DescribeMacro{\usedas} +% \DescribeMacro{\makerightboundary} +% \DescribeMacro{\Unicode} +% The \meta{slot commands} are: +% \begin{quote} +% |\ligature|\marg{lig}\marg{glyph}\marg{glyph}\\ +% |\Ligature|\marg{lig}\marg{glyph}\marg{glyph}\\ +% |\oddligature|\marg{note}\marg{lig}\marg{glyph}\marg{glyph}\\ +% |\nextlarger|\marg{glyph}\\ +% |\varchar| \meta{varchar commands} |\endvarchar|\\ +% |\usedas|\marg{command}\marg{type}\\ +% |\makerightboundary|\marg{glyph}\\ +% |\Unicode|\marg{code point}\marg{name} +% \end{quote} +% By default, these do nothing in \package{fontinst}, but most of +% those defaults are overridden locally in those situations where one +% wants them to do something. Exceptions are \cs{usedas}, +% which is never used at all AFAIK,\footnote{It was intended to be +% used for math font encodings, but that never got off the +% \texttt{TODO} list. /LH} and |\oddligature| and |\Unicode|, +% which are purely documentation commands. In \package{fontdoc}, +% they generate descriptive headings. +% +% \begin{macro}{\ligature} +% \begin{macro}{\Ligature} +% \changes{1.917}{2001/03/31}{Command added. (LH)} +% \begin{macro}{\oddligature} +% \changes{1.918}{2001/05/31}{Command added. (LH)} +% The |\ligature| and |\Ligature| commands have the same syntax and +% meaning to \package{fontinst}, but \package{fontdoc} can give them +% slightly different treatment. In a specification ETX file, the +% |\Ligature| command gets the heading ``Mandatory ligature'', whereas +% the |\ligature| command gets the heading ``Ordinary ligature''. +% +% The |\oddligature| command takes a fourth argument which contains a +% short note on when the ligature might be appropriate. The entire +% command is always ignored by \package{fontinst}. +% \begin{macrocode} +%<pkg|misc>\let\ligature=\gobble_three +%<pkg|misc>\def\Ligature{\ligature} +%<pkg|misc>\def\oddligature#1#2#3#4{} +%<*doc> +\newcommand\ligature[3]{% + \Bheading{\ifFD@spec@ Ordinary ligature\else Ligature\fi} + \@nameuse{FD@lig-#1}{#2}{#3}% +} +\newcommand\Ligature[3]{% + \Bheading{\ifFD@spec@ Mandatory ligature\else Ligature\fi} + \@nameuse{FD@lig-#1}{#2}{#3}% +} +\newcommand\oddligature[4]{% + \Bheading{Odd\footnote{#1} ligature} + \@nameuse{FD@lig-#2}{#3}{#4}% +} +% \end{macrocode} +% +% Symbolic typesetting of |\ligature| programs requires +% special processing.\describecsfamily{FD@lig-\meta{lig}} +% \multchanges{\cs{FD@lig-/LIG\PrintChar{`>}}\cs +% {FD@lig-LIG/\PrintChar{`>}}\cs{FD@lig-/LIG/\PrintChar{`>}}\cs +% {FD@lig-/LIG/\PrintChar{`>}\PrintChar{`>}}}{1.917} +% {2001/03/31}{Changed how \package{fontdoc} marks the current +% position after a ligature instruction, from $+$ to +% $*\lfloor$. (LH)} +% \multchanges{\cs{FD@lig-/LIG}}{1.927} +% {2004/06/21}{Fixed a typo. (LH) Reported by Werner Lemberg.} +% \multchanges{\cs{FD@lig-/LIG/\PrintChar{`>}\PrintChar{`>}}}{1.927} +% {2004/06/24}{Fixed a typo. (LH) Reported by Werner Lemberg.} +% +% \begin{macrocode} +\x@cs\def{FD@lig-LIG}#1#2{% + \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}% + ${}\rightarrow{}$\typeset@glyph{#2}% +} +\x@cs\def{FD@lig-/LIG}#1#2{% + \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}% + ${}\rightarrow{}$% + \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#2}% +} +\x@cs\def{FD@lig-LIG/}#1#2{% + \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}% + ${}\rightarrow{}$% + \typeset@glyph{#2}${}*{}$\typeset@glyph{#1}% +} +\x@cs\def{FD@lig-/LIG/}#1#2{% + \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}% + ${}\rightarrow{}$% + \FD@typeset@string{\slot@name}${}*{}$% + \typeset@glyph{#2}${}*{}$\typeset@glyph{#1}% +} +\x@cs\def{FD@lig-/LIG>}#1#2{% + \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}% + ${}\rightarrow{}$% + \FD@typeset@string{\slot@name}${}*\lfloor$\typeset@glyph{#2}% +} +\x@cs\def{FD@lig-LIG/>}#1#2{% + \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}% + ${}\rightarrow{}$% + \typeset@glyph{#2}${}*\lfloor$\typeset@glyph{#1}% +} +\x@cs\def{FD@lig-/LIG/>}#1#2{% + \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}% + ${}\rightarrow{}$% + \FD@typeset@string{\slot@name}${}*\lfloor$% + \typeset@glyph{#2}${}*{}$\typeset@glyph{#1}% +} +\x@cs\def{FD@lig-/LIG/>>}#1#2{% + \FD@typeset@string{\slot@name}${}*{}$\typeset@glyph{#1}% + ${}\rightarrow{}$% + \FD@typeset@string{\slot@name}${}*{}$% + \typeset@glyph{#2}${}*\lfloor$\typeset@glyph{#1}% +} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% \begin{macro}{\nextlarger} +% \begin{macro}{\usedas} +% \begin{macro}{\makerightboundary} +% \begin{macrocode} +%<*pkg|misc> +\let\nextlarger=\gobble_one +\let\usedas=\gobble_two +\let\makerightboundary=\gobble_one +%</pkg|misc> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\def\nextlarger#1{\Bheading{Next larger} \typeset@glyph{#1}} +\def\makerightboundary#1{% + \Bheading{Right boundary marker slot} designation \typeset@glyph{#1}% +} +%</doc> +% \end{macrocode} +% \missing{doc}{\usedas} +% \end{macro} \end{macro} \end{macro} +% +% +% \begin{macro}{\Unicode} +% \changes{1.917}{2001/03/13}{Command added. (LH)} +% \changes{1.917}{2001/03/31}{Added setting of \cs{linepenalty} and +% \cs{spaceskip}. (LH)} +% \begin{macro}{\textunicode} +% \changes{1.918}{2001/06/17}{Command added. (LH)} +% \begin{macro}{\FD@codepoint} +% \changes{1.918}{2001/06/17}{Macro added. (LH)} +% \begin{macro}{\FD@charname} +% \changes{1.918}{2001/06/17}{Macro added. (LH)} +% Since ISO\,10646\slash Unicode has become the primary reference for +% identifying characters, we provide a special comment command for +% specifying which Unicode character corresponds to a particular slot +% in an encoding. \label{Unicode} The syntax is +% \begin{quote} +% |\Unicode|\marg{code point}\marg{name} +% \end{quote} +% where the \meta{code point} is the four hexadecimal digits that +% identify the code point of the character and \meta{name} is the +% name of the character. An example is +% \begin{quote} +% |\Unicode{0041}{LATIN CAPITAL LETTER A}| +% \end{quote} +% which is typeset as +% \begin{quote} +% Unicode character \texttt{U+0041}, \textsc{latin capital letter a}. +% \end{quote} +% The \meta{name} field may be left empty. +% +% The |\Unicode| command makes a whole |\comment|, but it is also +% useful to have a similar command for writing such data as part of a +% longer paragraph. The |\textunicode| command, which has the same +% argument structure as |\Unicode|, is provided for this. If you write +% \begin{quote} +% |see also \textunicode{0041}{LATIN CAPITAL LETTER A} for| +% \end{quote} +% then this is typeset as +% \begin{quote} +% see also \texttt{U+0041} (\textsc{latin capital letter a}) for +% \end{quote} +% +% As case is not significant in the character names and they +% furthermore usually seem to be written in capitals, I have chosen +% to typeset them using small capitals only. This is done by +% |\FD@charname|. The |\FD@codepoint| macro similarly handles +% typesetting of code points. See also the \texttt{hypertex} option +% to the \package{fontdoc} package. +% +% The \package{fontinst} and \package{finstmsc} definitions of +% |\Unicode| are to gobble the arguments. +% \begin{macrocode} +%<pkg|misc>\let\Unicode=\gobble_two +%<*doc> +\newcommand*\Unicode[2]{% + \comment{% + \spaceskip=\fontdimen2\font minus 1.1\fontdimen4\font + Unicode character \FD@codepoint{#1}% + \ifx \par#2\par \else , \FD@charname{#2}\fi.% + \linepenalty=300\par + }% +} +\newcommand*\textunicode[2]{% + \FD@codepoint{#1} \ifx\par#2\par\else(\FD@charname{#2})\fi +} +\providecommand*\FD@codepoint[1]{\texttt{U+\uppercase{#1}}} +\providecommand*\FD@charname[1]{\textsc{\lowercase{#1}}} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \DescribeMacro{\vartop} +% \DescribeMacro{\varmid} +% \DescribeMacro{\varbot} +% \DescribeMacro{\varrep} +% The \meta{varchar commands} are: +% \begin{quote} +% |\vartop|\marg{glyph}\\ +% |\varmid|\marg{glyph}\\ +% |\varbot|\marg{glyph}\\ +% |\varrep|\marg{glyph} +% \end{quote} +% These too do by default, which is overridden later, nothing in +% \package{fontinst} but typeset descriptive headings in \package{fontdoc}. +% +% \begin{macro}{\varchar} +% \begin{macro}{\vartop} +% \begin{macro}{\varmid} +% \begin{macro}{\varbot} +% \begin{macro}{\varrep} +% \begin{macro}{\endvarchar} +% \begin{macrocode} +%<*pkg|misc> +\let\varchar=\empty_command +\let\vartop=\gobble_one +\let\varmid=\gobble_one +\let\varbot=\gobble_one +\let\varrep=\gobble_one +\let\endvarchar=\empty_command +%</pkg|misc> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\def\varchar{\Bheading{Extensible glyph:}} +\def\vartop#1{\Bheading{Top} \typeset@glyph{#1}} +\def\varmid#1{\Bheading{Middle} \typeset@glyph{#1}} +\def\varbot#1{\Bheading{Bottom} \typeset@glyph{#1}} +\def\varrep#1{\Bheading{Repeated} \typeset@glyph{#1}} +\let\endvarchar\relax +%</doc> +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} +% +% +% \begin{macro}{\useexamplefont} +% \begin{macro}{\slotexample} +% \begin{macro}{\setslotcomment} +% \begin{macro}{\resetslotcomment} +% \begin{macro}{\unsetslotcomment} +% \begin{macro}{\slot@comment} +% \begin{macro}{\slot@font} +% As of v\,1.8 of \package{fontinst}, we have added an interface +% for automatic documentation of encoding files, which has been +% developed by Matthias Clasen as part of his work on math fonts. +% The implementation was slightly modified and integrated into +% this version by Ulrik Vieth. +% +% |\setslotcomment| defines a default slot comment, stored in the +% variable |\slot@comment|, which is subsequently used to annotate +% all |\setslot| commands. The slot comment can be changed by +% |\resetslotcomment| or turned off by |\unsetslotcomment|. +% +% |\useexamplefont| defines a default font, |\slot@font|, which +% may be referenced by calling |\slotexample| in slot comments to +% display the character or symbol allocated to the current slot. +% +% Taking advantage of this mechanism, it is possible to write: +% \begin{quote} +% |\useexamplefont{FONT}|\\[0.5\baselineskip] +% |\setslotcomment{The symbol `\slotexample'.}|\\ +% |\setslot{FOO}\endsetslot|\\ +% |\setslot{BAR}\endsetslot|\\ +% |\resetslotcomment{The character `\slotexample'.}|\\ +% |\setslot{BAZ}\endsetslot| +% \end{quote} +% instead of having to write: +% \begin{quote} +% |\usepackage{PACKAGE-to-use-symbols-from-FONT}|\\[0.5\baselineskip] +% |\setslot{FOO}\comment{The symbol `\foo'.}\endsetslot|\\ +% |\setslot{BAR}\comment{The symbol `\bar'.}\endsetslot|\\ +% |\setslot{BAZ}\comment{The character `\baz'.}\endsetslot| +% \end{quote} +% +% These macros never do anything in \package{fontinst}, they just +% gobble their arguments. +% \begin{macrocode} +%<*pkg|misc> +\let\useexamplefont=\gobble_one +\let\slotexample=\empty_command +\let\setslotcomment=\gobble_one +\let\resetslotcomment=\gobble_one +\let\unsetslotcomment=\empty_command +%</pkg|misc> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newif\ifslot@comment@ +\slot@comment@false +\def\slot@comment{} +\newcommand\setslotcomment[1]{% + \slot@comment@true + \gdef\slot@comment{#1}% +} +\newcommand\resetslotcomment[1]{\gdef\slot@comment{#1}} +\newcommand\unsetslotcomment{% + \slot@comment@false + \global\let\slot@comment\@empty +} +% \end{macrocode} +% +% \begin{macrocode} +\let\slot@font=\nullfont +\newcommand\useexamplefont[1]{\font\slot@font=#1 } +\newcommand\slotexample{% + \ifFD@slot@known@{\slot@font\char\slot@number}\fi +} +%</doc> +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\setfontdimen} +% \changes{1.917}{2001/03/16}{Command added. (LH)} +% The |\setfontdimen| command is used in an ETX file to set a font +% dimen. The syntax is +% \begin{quote} +% |\setfontdimen|\marg{fontdimen no.}\marg{integer} +% \end{quote} +% where \meta{fontdimen no.} and \meta{integer} are \emph{string} +% expressions. \meta{fontdimen no.} specifies the fontdimen to set. +% \meta{integer} is the name of the integer variable to whose value +% the fontdimen will be set. +% +% When used in font installation, the above |\setfontdimen| command +% is equivalent to +% \changes{1.923}{2002/10/25}{Leave the fontdimen unset when the +% integer variable has not been set. (LH)} +% \begin{quote} +% |\ifisint|\marg{integer}|\then|\\ +% | \setint{fontdimen(|\meta{fontdimen no.}|)}{\int{|^^A +% \meta{integer}|}}|\\ +% |\fi| +% \end{quote} +% but |\setfontdimen| is also understood by the (V)PL-to-MTX +% converter as declaring an integer that the generated MTX file +% should set to the value of the fontdimen in the (V)PL. +% \begin{macrocode} +%<*pkg> +\def\setfontdimen#1#2{ + \ifisint{#2}\then \setint{fontdimen(#1)}{\int{#2}} \fi +} +%</pkg> +%<misc>\let\setfontdimen\gobble_two +%<*doc> +\newcommand\setfontdimen[2]{% + \Bheading{Fontdimen} \TypesetStringExpression{#1} is + \(\TypesetIntegerExpression{\int{#2}}\)% +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\label} +% \changes{1.917}{2001/03/23}{Macro added. (LH)} +% \package{fontinst} and \package{finstmsc} defines the \LaTeX\ +% |\label| command to gobble its argument, so that one can use it to +% reference slots. +% \begin{macrocode} +%<pkg|misc>\let\label=\gobble_one +% \end{macrocode} +% \end{macro} +% +% \begin{switch}{direct} +% The encoding aspect of a font can to a large extent be understood +% as a mapping from the set of slots to the set of glyphs---such +% mappings are for example realised by PostScript encoding vectors +% (mapping slots to glyph names) and virtual fonts (mapping slots to +% DVI commands for drawing a glyph). In some cases however, encodings +% are rather used to specify an inverse mapping going the opposite +% way. Since encodings are in general many-to-one, this means there +% need not be a proper inverse to a given encoding; instead the +% inverse image of a glyph is in practice chosen randomly\footnote{In +% the sense: according to a very deterministic (but not particularly +% useful) rule which depends completely on details in the +% implementation, and therefore should not be relied upon anyway.} +% among the slots that are mapped to it. This is not always desirable. +% +% The \texttt{direct} switch can be used to check whether an encoding +% is interpreted in the direct (slots to glyphs) or inverse (glyphs to +% slots) manner. If those |\setslot| commands which are undesirable +% under the inverse interpretation are put inside an |\ifdirect| +% \dots\ |\Fi| construction, then these will be ignored in that +% circumstance, thus allowing the programmer to exactly specify both +% the direct and the inverse mappings. +% \changes{1.924}{2003/02/08}{Command added. (LH)} +% +% In \package{fontinst}, this command is a switch, which is usually +% true. +% \begin{macrocode} +%<pkg|misc>\newif\ifdirect \directtrue +% \end{macrocode} +% In \package{fontdoc}, this is a conditional that will be typeset +% if |\showbranches| is being used. +% \begin{macrocode} +%<doc>\newcommand\ifdirect{\generic@if{direct}} +% \end{macrocode} +% \end{switch} +% +% \begin{macro}{\input_mtx_as_etx} +% The |\input_mtx_as_etx| command is syntactically similar to the +% |\inputetx| command, but it inputs an MTX file instead of an ETX +% file and redefines |\setscaledrawglyph| so that it expands to a +% |\nextslot| followed by a |\setslot| \dots\ |\endsetslot|. This is +% useful when making proofs of fonts with nonstandard encodings, as +% the MTX of a font can be used to specify ``the default encoding'' +% of that font. +% +% \textbf{Warning:} Since this macro redefines a lot of the metric +% commands, you'll probably only want to call it inside a group. +% \changes{1.923}{2002/10/24}{Macro added. (LH)} +% \begin{macrocode} +%<*pkg|misc> +\def\input_mtx_as_etx#1{ + \def\setscaledrawglyph##1##2##3##4##5##6##7##8##9{ + \nextslot{##5} + \setslot{##1}\endsetslot + } + \offcommand\setscalednotglyph + \let\setglyph=\gobble_glyph + \offcommand\setkern + \inputmtx{#1} +} +%</pkg|misc> +% \end{macrocode} +% \end{macro} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \section{Metric files} +% \label{Sec:Metric files} +% +% \changes{1.911}{1999/11/17}{Definitions of metric file commands +% added to \protect\protect\protect\Module{misc}. (LH)} +% +% \DescribeMacro{\inputmtx} +% The macro +% \begin{quote} +% |\inputmtx|\marg{filename} +% \end{quote} +% inputs \meta{filename}|.mtx|, ignoring anything between |\relax| and +% |\metrics|, and anything after |\endmetrics|. +% +% \begin{macro}{\inputmtx} +% \begin{macro}{\metrics} +% \changes{1.914}{2000/05/26}{Fixed typo: \cs{x@relax} instead of +% \cs{x_relax}. (LH)} +% \usechange{raggedright} +% \begin{macro}{\endmetrics} +% \changes{1.900}{1999/02/08}{Made it outer. (LH)} +% \usechange{raggedright} +% \begin{macro}{\endmetrics_text} +% \begin{macro}{\endmetrics@hook} +% The |\endmetrics_text| macro expands to |\endmetrics| (eleven +% `other' tokens, not one control sequence token). It is used instead +% of |\string\endmetrics|, which does not work since |\endmetrics| is +% outer. +% \begin{macrocode} +%<*pkg|misc> +\def\inputmtx#1{ + \def\relax{\let\relax=\x_relax\iffalse} + \let\metrics=\fi + \primitiveinput #1.mtx\x_relax + \let\relax=\x_relax +} +\let\metrics=\x_relax +\edef\endmetrics_text{\string\endmetrics} +\outer\def\endmetrics{\endinput} +%</pkg|misc> +% \end{macrocode} +% |\inputmtx| used to set |\a_count|, but we haven't been able to +% find a reason for this, so it was removed. +% +% In \package{fontdoc}, the |\metrics| and |\endmetrics| macros +% initially just define a group, but |\inputmtx| redefines them to +% work as they do in \package{fontinst}. |\endmetrics@hook| is a +% macro that gets executed just before the |\endgroup| in +% |\endmetrics|; it is normally |\@empty|, and it is set to this value +% at each |\metrics|, but the metric package system redefines it. +% \multchanges{\cs{endmetrics_hook}}{1.914}{2000/05/27}{Macro added. +% (LH)} +% \multchanges{\cs{inputetx}\cs{inputmtx}}{1.914}{2000/05/27} +% {New \package{fontdoc} definition, using \cs{IfFileExists}. (LH)} +% \begin{macrocode} +%<*doc> +\def\inputmtx#1{% + \begingroup + \edef\lowercase@file{\lowercase{% + \edef\noexpand\lowercase@file{#1}% + }}% + \lowercase@file + \let\endmetrics@hook=\@empty + \IfFileExists{\lowercase@file.mtx}{% + \skip@mtx@preamble + \@@input \@filef@und + \let\relax=\x@relax + }{% + \PackageError{fontdoc}{File #1.mtx not found}% + {\@eha\MessageBreak You can \protect\inputmtx\space + some other file now, if you want.}% + } + \endmetrics@hook + \endgroup +} +\def\skip@mtx@preamble{% + \def\relax{\let\relax=\x@relax\iffalse}% + \let\metrics=\fi + \outer\x@cs\def{endmetrics}{\endinput}% +} +\def\metrics{% + \begin{flushleft}% + \let\endmetrics@hook=\@empty +} +\outer\def\endmetrics{% + \endmetrics@hook + \end{flushleft}% +} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% +% +% \begin{macro}{\ProvidesMtxPackage} +% \changes{1.923}{2003/01/05}{Redesigned the headings for metric +% packages, since they interact poorly with \cs{section} headings. +% (LH)} +% \begin{switch}{@mtxpackage@headed@} +% \begin{macro}{\announce@package} +% \begin{macro}{\finish@package} +% \multchanges{\cs{ProvidesMtxPackage}\cs{usemtxpackage}}{1.914} +% {2000/05/27}{New \package{fontdoc} implementation---the packages +% are actually loaded (they have to, since they can define +% commands). Multiple loading is prevented as in +% \package{fontinst}. (LH)} +% The call +% \begin{quote} +% |\ProvidesMtxPackage|\marg{package~name} +% \end{quote} +% signals to the package managing system that there is no need to load +% this package again. +% \begin{macrocode} +%<pkg>\def\ProvidesMtxPackage#1{\x_cs\let{pack-#1}P} +%<*doc> +\def\ProvidesMtxPackage#1{% + \endmetrics@hook +% \@mtxpackage@headed@false +% \everypar={ + \announce@package{#1}% +% }% + \def\endmetrics@hook{\finish@package{#1}} + \global\x@cs\let{FD@pack-#1}\@empty +} +% \end{macrocode} +% \begin{macrocode} +% \newif\if@mtxpackage@headed@ +% \end{macrocode} +% \begin{macrocode} +\def\announce@package#1{% +% \everypar={}% +% \@mtxpackage@headed@true + \Aheading{[Start of metric package \textsf{#1}.}% +} +% \end{macrocode} +% \begin{macrocode} +\def\finish@package#1{% +% \if@mtxpackage@headed@ + \Aheading{End of metric package \textsf{#1}.]}% +% \else +% \everypar={}% +% \Aheading{(Metric package \textsf{#1}.)}% +% \fi + \par\addvspace\medskipamount +} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro}\end{switch}\end{macro} +% +% +% \begin{macro}{\usemtxpackage} +% The call +% \begin{quote} +% |\usemtxpackage|\marg{package~list} +% \end{quote} +% inputs those of the packages in the list that have not been loaded +% yet (i.e., those for which no |\ProvidesMtxPackage| has been made). +% Each package is assumed to reside in the metric file that +% |\inputmtx| loads when given the name of the package as argument. +% +% The call +% \begin{quote} +% |\usemtxpackage|\oarg{filename}\marg{package~list} +% \end{quote} +% inputs the packages in the list if at least one of them has not been +% loaded yet. In this case, all the packages are assumed to reside in +% the single metric file that |\inputmtx| loads when given +% \meta{filename} as argument. +% +% \begin{macrocode} +%<*pkg> +\def\usemtxpackage{\futurelet\next_token\test_UseMtxPkg_arguments} +\def\test_UseMtxPkg_arguments{\ifx\next_token[ + \expandafter\mtx_package_given_file + \else + \expandafter\mtx_package_separate_files + \fi +} +% \end{macrocode} +% \begin{macrocode} +\def\mtx_package_given_file[#1]#2{ + \_a_false + \process_csep_list\load_true_unless_loaded #2,\process_csep_list, + \if_a_ \inputmtx{#1} \fi +} +\def\load_true_unless_loaded#1{ + \x_cs\ifx{pack-#1}P\else\_a_true\fi +} +% \end{macrocode} +% \begin{macrocode} +\def\mtx_package_separate_files#1{ + \process_csep_list\load_file_unless_loaded #1,\process_csep_list, +} +\def\load_file_unless_loaded#1{ + \x_cs\ifx{pack-#1}P\else \inputmtx{#1} \fi +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\usemtxpackage[2][\x@relax]{% + \ifx \x@relax#1% + \@for\@tempa:=#2\do{% + \x@cs\ifx{FD@pack-\@tempa}\@empty \else + \inputmtx{\@tempa}% + \fi + }% + \else + \@tempswafalse + \@for\@tempa:=#1\do{% + \x@cs\ifx{FD@pack-\@tempa}\@empty \else \@tempswatrue \fi + }% + \if@tempswa + \inputmtx{#2}% + \fi + \fi +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\glyph_name_modifier} +% The |\glyph_name_modifier| macro is applied to all glyph names +% supplied to commands that are allowed in transformable MTX files +% (see Subsection~\ref{Ssec:TransMTX}). The syntax is +% \begin{quote} +% |\glyph_name_modifier|\marg{glyph name} +% \end{quote} +% and the above must expand fully to a valid glyph name in \TeX's +% mouth. +% +% \changes{1.923}{2002/10/20}{Macro added. (LH)} +% The normal definition is to simply expand to the \meta{glyph name}, +% i.e., +% \begin{macrocode} +%<pkg>\let\glyph_name_modifier=\identity_one +% \end{macrocode} +% but the command may expand to any sequence of character tokens. It +% was introduced to support (simple) automatic renaming of glyphs +% in cases where the |\reglyphfont| command would not be appropriate, +% such as when the wanted renaming is simply to add a short suffix to +% the glyph names. +% +% The reason it only affects the commands allowed in transformable +% MTX files is that the macro isn't meant as a generic override for +% metric commands. +% \end{macro} +% +% +% \subsection{Kerning information} +% +% The kerning information is kept in the macros +% \describecsfamily{l-\meta{name}}|\l-|\meta{name} and +% \describecsfamily{r-\meta{name}}|\r-|\meta{name}, containing +% information about how \meta{name} kerns on the left and on the right, +% respectively. The |\l-|\meta{name} macro should expand out to a +% series of +% \begin{quote} +% \DescribeMacro{\k}|\k|\,|\r-|\meta{name}\,|\|\meta{amount} +% \end{quote} +% control sequences, and vice versa. Examples of +% \describecsfamily{\meta{amount}} |\|\meta{amount} +% control sequences are: |\0|, |\1|, |\1000|, |\-50|, |\33|; these +% corresponds to the kern amounts $0$, $1$, $1000$ (which would be +% a very large kern), $-50$, and $33$ respectively. +% +% +% \begin{macro}{\setkern} +% |\setkern|\marg{glyph1}\marg{glyph2}\marg{integer expression} +% +% Sets a kern pair between \meta{glyph1} and \meta{glyph2} to the +% specified value, which is typically a value returned by +% |\kerning|\marg{glyph3}\marg{glyph4}. If there already is a kern +% set between \meta{glyph1} and \meta{glyph2} then this will not affect +% the output, but it will use up another 3 units of token memory. +% +% \begin{macrocode} +%<*pkg> +\def\setkern#1#2#3{ + \x_cs\ifx{i-rawscale}\x_relax + \expandafter\set_kern + \csname~r-\glyph_name_modifier{#1}\expandafter\endcsname + \csname~l-\glyph_name_modifier{#2}\endcsname + {#3} + \else + \expandafter\set_kern + \csname~r-\glyph_name_modifier{#1}\expandafter\endcsname + \csname~l-\glyph_name_modifier{#2}\endcsname + {\scale{#3}{\int{rawscale}}} + \fi +} +\def\set_kern#1#2#3{ + \eval_expr{#3} + \expandafter\set_kern_cs\csname\the\result\endcsname#1#2 +} +\def\set_kern_cs#1#2#3{ + \add_to#2{\k#3#1} + \add_to#3{\k#2#1} +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\setkern[3]{% + \Bheading{Kern} \typeset@glyph{#1}${{}+{}}$\typeset@glyph{#2}% + ${}\rightarrow \TypesetIntegerExpression{#3}$% +} +%</doc> +%<misc>\let\setkern=\gobble_three +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\resetkern} +% |\resetkern|\marg{glyph1}\marg{glyph2}\marg{integer expression} +% +% Resets the kern pair between \meta{glyph1} and \meta{glyph2} to +% the specified value. Note however that this does not relieve \TeX\ +% of the burden to remember the previous kerning pair between these +% two glyphs (if there was one). +% +% \begin{macrocode} +%<*pkg> +\def\resetkern#1#2#3{ + \x_cs\ifx{i-rawscale}\x_relax + \expandafter\reset_kern + \csname~r-#1\expandafter\endcsname + \csname~l-#2\endcsname{#3} + \else + \expandafter\reset_kern + \csname~r-#1\expandafter\endcsname + \csname~l-#2\endcsname{\scale{#3}{\int{rawscale}}} + \fi +} +\def\reset_kern#1#2#3{ + \eval_expr{#3} + \expandafter\reset_kern_cs\csname\the\result\endcsname#1#2 +} +\def\reset_kern_cs#1#2#3{ + \prep_to#2{\k\expandafter#3\expandafter#1} + \prep_to#3{\k\expandafter#2\expandafter#1} +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\resetkern[3]{% + \Bheading{Override kern} \typeset@glyph{#1}${{}+{}}$\typeset@glyph{#2}% + ${}\rightarrow \TypesetIntegerExpression{#3}$% +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\setleftkerning} +% \begin{macro}{\setrightkerning} +% \begin{macro}{\setleftrightkerning} +% |\setleftkerning|\marg{glyph1}\marg{glyph2}\marg{scaled}\\ +% |\setrightkerning|\marg{glyph1}\marg{glyph2}\marg{scaled}\\ +% |\setleftrightkerning|\marg{glyph1}\marg{glyph2}\marg{scaled} +% +% Sets left or right kerning of \meta{glyph1} to that of \meta{glyph2} +% scaled by \meta{scaled} (which is an integer expression). +% |\setleftrightkerning| does both. +% +% \begin{macrocode} +%<*pkg> +\def\setleftkerning#1#2#3{ + \eval_expr_to\b_count{#3} + \expandafter\set_kerning + \csname~l-#1\expandafter\endcsname + \csname~l-#2\endcsname +} +\def\setrightkerning#1#2#3{ + \eval_expr_to\b_count{#3} + \expandafter\set_kerning + \csname~r-#1\expandafter\endcsname + \csname~r-#2\endcsname +} +\def\setleftrightkerning#1#2#3{ + \eval_expr_to\b_count{#3} + \expandafter\set_kerning + \csname~l-#1\expandafter\endcsname + \csname~l-#2\endcsname + \expandafter\set_kerning + \csname~r-#1\expandafter\endcsname + \csname~r-#2\endcsname +} +\def\set_kerning#1#2{ + \if\b_count=\one_thousand + \def\k##1##2{ + \set_kern_cs##2##1#1 + } + \else + \def\k##1##2{ + \set_kern##1#1{ + \scale\b_count{\expandafter\gobble_one\string##2} + } + } + \fi + #2 +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\setleftkerning[3]{% + \Bheading{Kern} \typeset@glyph{#1} on the left like + \typeset@glyph{#2} \ConditionallyScaled{#3}} +\newcommand\setrightkerning[3]{% + \Bheading{Kern} \typeset@glyph{#1} on the right like + \typeset@glyph{#2} \ConditionallyScaled{#3}} +\newcommand\setleftrightkerning[3]{% + \Bheading{Kern} \typeset@glyph{#1} on the left and right like + \typeset@glyph{#2} \ConditionallyScaled{#3}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\ConditionallyScaled} +% \changes{1.916}{2001/01/06}{Command added. (LH)} +% Several metric commands have take a scaling factor argument which is +% rendered by \package{fontdoc} as ``scaled \meta{argument}''. The by +% far most common value for this argument is however the constant +% number 1000 (no scaling), and in those cases the ``scaled +% \textellipsis'' feels a bit long-winded. The cure for this is the +% |\Conditionally|\-|Scaled| command, which takes an integer expression +% as its argument and typesets the ``scaled \meta{integer expression}'' +% \emph{unless} that expression evaluates to 1000, in which case +% |\Conditionally|\-|Scaled| simply gobbles any spaces following it. +% \begin{macrocode} +\newcommand\ConditionallyScaled[1]{% + \FD@evaluate@true + \FD@eval@expr{#1}% + \@tempswatrue + \ifFD@evaluate@ \ifnum \FD@result=\@m \@tempswafalse \fi\fi + \FD@evaluate@false + \if@tempswa scaled \(\FD@expression\)\else \ignorespaces \fi +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\kerning} +% |\kerning|\marg{glyph1}\marg{glyph2} +% +% Returns the value of kern pair between \meta{glyph1} and +% \meta{glyph2} as an integer. Returns a value of zero if such a kern +% pair doesn't exist. +% +% \begin{macrocode} +%<*pkg> +\def\kerning#1#2{0\x_relax + \def\k##1{\csname~set-\string##1\endcsname\gobble_one} + \bgroup + \x_cs\def{set-\string\l-#2}##1##2{ + \global\result=\expandafter\gobble_one\string##2\egroup + } + \csname~r-#1\endcsname + \csname~set-\string\l-#2\endcsname\gobble_one{00} +} +%</pkg> +% \end{macrocode} +% \changes{1.909}{1999/10/19}{A use of \#1 where it should have +% been \#2 was corrected. (LH)} +% \begin{macrocode} +%<*doc> +\DeclareRobustCommand\kerning[2]{% + \begingroup + \MakePrintable\@tempa{FD@swa}{#1}% + \MakePrintable\@tempb{FD@swa}{#2}% + \protected@xdef\FD@expression{% + \mathop{\protect\mathrm{k{}}}(% + \text{\protect\FD@typeset@string{\@tempa}}% + ,\penalty\FD@commapenalty + \text{\protect\FD@typeset@string{\@tempb}}% + )% + }% + \global\chardef\FD@priority=5% + \global\FD@bracket@level=\@ne + \FD@evaluate@false + \endgroup +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifiskern} +% |\ifiskern|\marg{glyph1}\marg{glyph2}|\then| +% +% This command tests if there is a kern pair between \meta{glyph1} and +% \meta{glyph2}. It's hard to say if there is a use for it, but it is +% included for symmetry. +% +% \begin{macrocode} +%<*pkg> +\def\ifiskern#1#2\then{ + \def\k##1##2{\ifx T##1 \let\k\gobble_two \fi} + \bgroup + \x_cs\let{l-#2}T + \csname r-#1\endcsname + \expandafter\egroup \ifx\k\gobble_two +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\def\ifiskern#1#2\then{% + \generic@if{kern \typeset@glyph{#1}${}+{}$\typeset@glyph{#2} set}% +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\unsetkerns} +% |\unsetkerns|\marg{left~glyph~list}\marg{right~glyph~list} +% +% This command unsets all kerns with a glyph in the \meta{left~glyph~list} +% on the left and a glyph in the \meta{right~glyph~list} on the right. +% The lists themselves are ordinary comma-separated lists. Unlike +% |\setkern| and |\resetkern|, |\unsetkerns| actually removes the +% kerning pairs from \TeX's memory. +% +% The implementation itself simply goes through |\r-|\meta{left~glyph} +% for each element \meta{left~glyph} in \meta{left~glyph~list} and +% |\l-|\meta{right~glyph} for each element \meta{right~glyph} in +% \meta{right~glyph~list}, removing each |\k|\meta{token}\meta{token} +% tripple that refers to a glyph from the opposite list as it goes +% along. To make this test reasonably fast, the routine first ``marks'' +% the glyphs in the other list by setting the control sequences +% |\slots-|\meta{glyph} to |U| (the letter token U). This mark is +% later removed when the |\r-|\meta{glyph} or |\l-|\meta{glyph} +% respectively control sequences have been gone through; the +% |\slots-|\meta{glyph} control sequences are then set to |\relax|. +% +% \begin{macrocode} +%<*pkg> +\def\unsetkerns#1#2{ + \let\k\k_unless_to_U + \process_csep_list\make_slots_U#1,\process_csep_list, + \def\do##1{\x_cs\main_remove_Us{l-##1}} + \process_csep_list\do#2,\process_csep_list, + \process_csep_list\make_slots_relax#1,\process_csep_list, + \process_csep_list\make_slots_U#2,\process_csep_list, + \def\do##1{\x_cs\main_remove_Us{r-##1}} + \process_csep_list\do#1,\process_csep_list, + \process_csep_list\make_slots_relax#2,\process_csep_list, +} +\def\make_slots_U#1{\x_cs\let{slots-#1}U} +\def\make_slots_relax#1{\x_cs\let{slots-#1}\x_relax} +\def\k_unless_to_U#1#2{ + \x_cs\ifx{slots-\expandafter\gobble_three\string#1}U \else + \noexpand\k\noexpand#1\noexpand#2 + \fi +} +\def\main_remove_Us#1{ + \ifx#1\x_relax \else + \edef#1{#1} + \ifx#1\empty_command \let#1\x_relax \fi + \fi +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\unsetkerns[2]{% + \Bheading{Remove} all kerning pairs in + \FD@typeset@string@set{#1}${}\times{}$\FD@typeset@string@set{#2}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\FD@typeset@string@set} +% \begin{macro}{\FD@typeset@string@set@} +% \multchanges{\cs{FD@typeset@string@set}^^A +% \cs{FD@typeset@string@set@}}{1.916}{2001/01/02}{Macros added. +% \cs{FD@typeset@string@set} should be used instead of +% \cs{print@csep@list} in most occations. (LH)} +% The |\FD@typeset@string@set| macro takes a comma-separated list of +% string expressions as argument and typesets that list as elements of +% a set, e.g. +% \begin{quote} +% |\FD@typeset@string@set{a,b,\str{c}}| +% \end{quote} +% is typeset as +% \begin{quote} +% $\{$\texttt{a}$,{}$\texttt{b}$,\mathrm{s}($\texttt{c}$)\}$ +% \end{quote} +% \begin{macrocode} +\def\FD@typeset@string@set#1{% + \toks@={}% + \@for\@tempa:=#1\do{% + \protected@edef\@tempa{% + \noexpand\MakePrintable \noexpand\@tempa {FD@swa}{\@tempa}% + }% + \@tempa + \toks@=\expandafter{\the\expandafter\toks@ + \expandafter\do \expandafter{\@tempa}}% + }% + \expandafter\FD@typeset@string@set@ \expandafter{\the\toks@}% +} +\def\FD@typeset@string@set@#1{% + \TypesetList{$\{$}{$,\penalty\FD@commapenalty{}$}% + {$,\penalty\FD@commapenalty{}$}{$,\penalty\FD@commapenalty{}$}% + {$\}$}{$\emptyset$}{\FD@typeset@string}{#1}% +} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \begin{macro}{\noleftkerning} +% \changes{1.906}{1999/07/30}{Macro added. (LH)} +% \begin{macro}{\norightkerning} +% \changes{1.906}{1999/07/30}{Macro added. (LH)} +% \begin{macro}{\noleftrightkerning} +% \changes{1.906}{1999/07/30}{Macro added. (LH)} +% The argument of these commands is the name of a glyph. The commands +% removes all kerns on the left, on the right, and on both sides +% respectively, of this glyph. +% +% \begin{macrocode} +%<*pkg> +\def\noleftkerning#1{\no_kerning{l}{#1}} +\def\norightkerning#1{\no_kerning{r}{#1}} +\def\noleftrightkerning#1{\no_kerning{l}{#1}\no_kerning{r}{#1}} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\noleftkerning[1]{% + \Bheading{Remove kerns} on the left of glyphs in + \FD@typeset@string@set{#1}.} +\newcommand\norightkerning[1]{% + \Bheading{Remove kerns} on the right of glyphs in + \FD@typeset@string@set{#1}.} +\newcommand\noleftrightkerning[1]{% + \Bheading{Remove kerns} on any side of glyphs in + \FD@typeset@string@set{#1}.} +%</doc> +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\no_kerning} +% \changes{1.906}{1999/07/30}{Macro added. (LH)}^^A +% \changes{1.906}{1999/08/01}{Macro thoroughly rewritten. (LH)}^^A +% This macro is called as +% \begin{quote} +% |\no_kerning|\marg{side}\marg{glyph list} +% \end{quote} +% where \meta{side} is |l| or |r|, and \meta{glyph list} is a +% comma-separated list of glyph names. The macro unsets all kerns on +% the \meta{side} side of the glyphs in the \meta{glyph list}. +% +% \begin{macrocode} +%<*pkg> +\def\no_kerning#1#2{ + \let\k\no_kerning_i + \def\do##1{\csname #1-##1\endcsname} + \bgroup + \aftergroup\def \aftergroup\a_macro \aftergroup{ + \process_csep_list\do #2,\process_csep_list, + \aftergroup} + \egroup + \def\do##1{\expandafter\let \csname #1-##1\endcsname \x_relax} + \process_csep_list\do #2,\process_csep_list, + \let\k\no_kerning_ii + \def\do##1{\edef##1{##1}} + \a_macro +} +% \end{macrocode} +% \begin{macro}{\no_kerning_i} +% The |\no_kerning_i| macro is used by |\no_kerning| in constructing +% a list of all glyphs that a glyph in the \meta{glyph list} has a +% \meta{side} kern to, while avoiding repetitions. +% \begin{macrocode} +\def\no_kerning_i#1#2{ + \ifx #1\x_relax \else + \aftergroup\do \aftergroup#1 + \let #1\x_relax + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\no_kerning_ii} +% The |\no_kerning_ii| macro is similar to the |\k_unless_to_U| +% macro. +% \begin{macrocode} +\def\no_kerning_ii#1#2{ + \ifx #1\x_relax \else \noexpand\k \noexpand#1 \noexpand#2 \fi +} +%</pkg> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% \subsection{Glyph information} +% \label{Ssec:Glyph-info} +% +% The glyph information is kept in the macros +% \describecsfamily{g-\meta{name}}|\g-|\meta{name}, which expands +% out to: +% \begin{quote} +% \marg{width}\marg{height}\marg{depth}\marg{italic}^^A +% \marg{mapcommands}\marg{mapfonts} +% \end{quote} +% where the \meta{mapcommands} will write out VPL |MAP| fragments to a +% |.vpl| file, and the \meta{mapfonts} will produce any |MAPFONT| +% instructions that are needed. +% +% +% \begin{macro}{\typeset@glyph} +% \changes{1.909}{1999/10/20}{Macro added, and most commands that +% print a glyph name changed to use this macro. (LH)} +% \changes{1.916}{2001/01/02}{Macro redefined (made synonymous to +% \cs{Typeset\-String\-Expression}). (LH)} +% The |\typeset@glyph| macro takes a string expression and typesets +% that as the name of a glyph. Currently names of glyphs are formatted +% precisely the same as any other string expression. +% \begin{macrocode} +%<doc>\let\typeset@glyph=\TypesetStringExpression +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\width} +% \begin{macro}{\height} +% \begin{macro}{\depth} +% \begin{macro}{\italic} +% |\width|\marg{glyph}\\ +% |\height|\marg{glyph}\\ +% |\depth|\marg{glyph}\\ +% |\italic|\marg{glyph} +% +% In \package{fontinst}, these macros return the width, height, +% depth, and italic correction of \meta{glyph} as an integer. +% \begin{macrocode} +%<*pkg> +\def\width{\glyph_parameter\first_of_six} +\def\height{\glyph_parameter\second_of_six} +\def\depth{\glyph_parameter\third_of_six} +\def\italic{\glyph_parameter\fourth_of_six} +%</pkg> +% \end{macrocode} +% +% In \package{fontdoc}, they print symbolic representations for the +% corresponding integer expressions. +% \begin{macrocode} +%<*doc> +\DeclareRobustCommand\width[1]{\FD@glyph@metric{w}{#1}} +\DeclareRobustCommand\height[1]{\FD@glyph@metric{h}{#1}} +\DeclareRobustCommand\depth[1]{\FD@glyph@metric{d}{#1}} +\DeclareRobustCommand\italic[1]{\FD@glyph@metric{i}{#1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\FD@glyph@metric} +% The |\FD@glyph@metric| macro is a convenient shorthand to use when +% defining integer-valued functions which represents some glyph +% metric (e.g.\ \cs{height}). Its syntax is +% \begin{quote} +% |\FD@glyph@metric|\marg{func-name}\marg{string expression} +% \end{quote} +% The \meta{string expression} must be expanded. +% \begin{macrocode} +\def\FD@glyph@metric#1#2{% + \begingroup + \MakePrintable\@tempa{FD@swa}{#2}% + \protected@xdef\FD@expression{% + \protect\FD@integer@func{#1}{\@tempa}% + }% + \global\chardef\FD@priority=5% + \global\FD@bracket@level=\@ne + \FD@evaluate@false + \endgroup +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\mapcommands} +% \begin{macro}{\mapfonts} +% These are similar to |\width| and its companions, but they are not +% user level commands. +% \begin{macrocode} +%<*pkg> +\def\mapcommands{\glyph_parameter\fifth_of_six} +\def\mapfonts{\glyph_parameter\sixth_of_six} +%</pkg> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\glyph_parameter} +% \begin{macro}{\first_of_six} +% \begin{macro}{\second_of_six} +% \begin{macro}{\third_of_six} +% \begin{macro}{\fourth_of_six} +% \begin{macro}{\fifth_of_six} +% \begin{macro}{\sixth_of_six} +% \begin{macro}{\glyph_metrics} +% These macros are used to define |\width| and its friends. +% |\glyph_parameter| takes one of the other seven for its first +% argument and a glyph name for its second argument. The +% |\glyph_metrics| macro can be used if one wants to get all the +% metric variables at once. +% \begin{macrocode} +%<*pkg> +\def\glyph_parameter#1#2{ + \expandafter\expandafter\expandafter + #1\csname g-#2\endcsname +} +% \end{macrocode} +% \begin{macrocode} +\def\first_of_six#1#2#3#4#5#6{#1} +\def\second_of_six#1#2#3#4#5#6{#2} +\def\third_of_six#1#2#3#4#5#6{#3} +\def\fourth_of_six#1#2#3#4#5#6{#4} +\def\fifth_of_six#1#2#3#4#5#6{#5} +\def\sixth_of_six#1#2#3#4#5#6{#6} +% \end{macrocode} +% \begin{macrocode} +\def\glyph_metrics#1#2#3#4#5#6{ + \a_count=#1 + \b_count=#2 + \c_count=#3 + \d_count=#4~ +} +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} +% \end{macro} \end{macro} \end{macro} +% +% +% \begin{macro}{\saved_scale} +% \begin{macro}{\saved_mapfont} +% \begin{macro}{\saved_raw} +% \begin{macro}{\saved_rule} +% \begin{macro}{\saved_special} +% \begin{macro}{\saved_warning} +% \begin{macro}{\saved_movert} +% \begin{macro}{\saved_moveup} +% \begin{macro}{\saved_push} +% \begin{macro}{\saved_pop} +% These are the commands allowed inside a glyph. They are initally +% set to |\relax|, so we can |\edef| with them safely. +% \begin{macrocode} +\let\saved_scale\x_relax +\let\saved_mapfont\x_relax +\let\saved_raw\x_relax +\let\saved_rule\x_relax +\let\saved_special\x_relax +\let\saved_warning\x_relax +\let\saved_movert\x_relax +\let\saved_moveup\x_relax +\let\saved_push\x_relax +\let\saved_pop\x_relax +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} +% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} +% +% When the glyph is being constructed by +% \begin{quote} +% |\setglyph|\marg{glyph} \meta{glyph commands} |\endsetglyph| +% \end{quote} +% the values of each of these parameters are kept in the following +% variables. Except for |\glyph_width|, these are kept globally, +% so they survive through |\push| \textellipsis\ |\pop| pairs. In +% addition, the current vertical offset is kept locally in +% |\glyph_voffset|. The |\glyph_maxhpos| variable globally keeps track +% of the largest horizontal offset position reached so far (with the +% possible exception of the current position, i.e.\ width, which may +% well be larger). +% +% +% \begin{macro}{\glyph_width} +% \begin{macro}{\glyph_height} +% \begin{macro}{\glyph_depth} +% \begin{macro}{\glyph_italic} +% \begin{macro}{\glyph_map_commands} +% \begin{macro}{\glyph_map_fonts} +% \begin{macro}{\glyph_voffset} +% \begin{macro}{\glyph_maxhpos} +% \changes{1.903}{1999/05/20}{Variable added. (LH)} +% \begin{macrocode} +\newcount\glyph_width +\newcount\glyph_height +\newcount\glyph_depth +\newcount\glyph_italic +\newtoks\glyph_map_commands +\newtoks\glyph_map_fonts +\newcount\glyph_voffset +\newcount\glyph_maxhpos +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} +% \end{macro} \end{macro} \end{macro} +% +% \begin{macro}{\setglyph} +% \changes{1.916}{2001/01/06}{Added `set' to \package{fontdoc} text. +% (LH)} +% \begin{macro}{\gobble_glyph} +% The |\setglyph|\marg{name} command defines |\g-|\meta{name}, +% unless |\g-|\meta{name} has already been defined. +% +% The reason |\g-|\meta{name} is defined before calling |\resetglyph| +% is to make it possible to refer to ``the glyph constructed so far'' +% using |\width|\marg{name}, |\height|\marg{name}, etc. +% \begin{macrocode} +\def\setglyph#1{ + \ifisglyph{\glyph_name_modifier{#1}}\then + \expandafter\gobble_glyph + \else + \x_cs\def{g-\glyph_name_modifier{#1}}{ + {\the\glyph_width}{\the\glyph_height} + {\the\glyph_depth}{\the\glyph_italic} + {\the\glyph_map_commands}{\the\glyph_map_fonts} + } + \resetglyph{\glyph_name_modifier{#1}} + \fi +} +\long\def\gobble_glyph#1\endsetglyph{} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\setglyph[1]{% + \FD@tight@true + \Aheading{Set glyph `\typeset@glyph{#1}'}% +} +%</doc> +%<misc>\long\def\setglyph#1\endsetglyph{} +% \end{macrocode} +% +% LH 2003/01/05: A very useful trick, which unfortunately used to be +% undocumented, is to put kerning or variable assignment commands +% between |\setglyph| and the corresponding |\endsetglyph|. These +% commands will then only be executed if the glyph is being set by +% that |\setglyph|. Typical application: If \texttt{Aacutesmall} +% is being made by skrinking \texttt{Aacute}, then it is reasonable +% to make \texttt{Aacutesmall} kern like \texttt{Aacute} (modulo +% some scaling factor). If on the other hand \texttt{Aacutesmall} +% has already been set then there is less reason to believe +% \texttt{Aacutesmall} should kern like \texttt{Aacute} (a more +% probable guess is that it should kern like \texttt{Asmall}). +% \end{macro} \end{macro} +% +% \begin{macro}{\resetglyph} +% The |\resetglyph|\marg{name} command redefines |\g-|\meta{name}, +% regardless of whether |\g-|\meta{name} has already been defined. +% \changes{1.923}{2002/10/20}{\cs{edef}ing \cs{glyphname}, for +% consistency with \cs{setslot}. In principle, this could break +% MTX files, but I doubt that it will. (LH)} +% +% \begin{macrocode} +%<*pkg> +\def\resetglyph#1{ + \edef\glyphname{#1} + \glyph_width=0 + \global\glyph_height=0 + \global\glyph_depth=0 + \global\glyph_italic=0 + \glyph_voffset=0 + \global\glyph_maxhpos=0 + \global\glyph_map_commands={} + \global\glyph_map_fonts={} +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\resetglyph[1]{% + \FD@tight@true + \Aheading{Reset glyph `\typeset@glyph{#1}'}} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endsetglyph} +% \begin{macro}{\endresetglyph} +% \begin{macrocode} +%<*pkg> +\def\endsetglyph{ + \x_cs\edef{g-\glyphname} + {{\the\glyph_width}{\the\glyph_height} + {\the\glyph_depth}{\the\glyph_italic} + {\the\glyph_map_commands}{\the\glyph_map_fonts}} +} +\let\endresetglyph=\endsetglyph +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\let\endsetglyph=\FD@tight@false +\let\endresetglyph=\FD@tight@false +%</doc> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\setscaledrawglyph} +% \changes{1.922}{2002/09/07}{Corrected typo: should test whether the +% \texttt{rawscale} integer exists, not whether the +% \texttt{i-rawscale} integer exists. (LH)} +% \begin{macro}{\setrawglyph} +% The |\setscaledrawglyph| has the syntax +% \begin{isyntax} +% |\setscaledrawglyph|\marg{glyph}\marg{font}\marg{design size}^^A +% \marg{scale}\penalty0\marg{slot}\penalty0\marg{width}\penalty0 +% \marg{height}\penalty0\marg{depth}\penalty0\marg{italic} +% \end{isyntax} +% It is a generalized form of the old |\setrawglyph| command, which +% has the syntax +% \begin{isyntax} +% |\setrawglyph|\marg{glyph}\marg{font}\marg{design size}^^A +% \marg{slot}\penalty0\marg{width}\penalty0 +% \marg{height}\penalty0\marg{depth}\penalty0\marg{italic} +% \end{isyntax} +% |\setrawglyph| is now syntactic sugar for the equivalent call of +% |\set|\-|scaled|\-|raw|\-|glyph|. +% \begin{macrocode} +%<*pkg> +\def\setrawglyph#1#2#3{ + \setscaledrawglyph{#1}{#2}{#3}\one_thousand +} +% \end{macrocode} +% +% These commands are generated automatically, when an |.mtx| file is +% written out by |\afmtomtx|, |\pltomtx|, or |\mtxtomtx|. +% +% To illustrate the difference between |\setrawglyph| and the new +% |\set|\-|scaled|\-|raw|\-|glyph|, note that +% \begin{quote} +% |\setscaledrawglyph{fscaled}{xfont}{10pt}{800}{102}%|\\ +% | {300}{600}{300}{40}| +% \end{quote} +% produces the same \texttt{fscaled} glyph as +% \begin{quote} +% |\setrawglyph{f}{xfont}{10pt}{102}{375}{750}{375}{50}|\\ +% |\setglyph{fscaled} \glyph{f}{800} \endsetglyph| +% \end{quote} +% +% \begin{macrocode} +\def\setscaledrawglyph#1#2#3#4#5#6#7#8#9{ + \if_undefined{g-\glyph_name_modifier{#1}}\then + \eval_expr{#4} + \ifnum \result=\one_thousand + \let\a_macro\identity_one + \else + \edef\a_macro##1{\saved_scale{\the\result}{##1}} + \fi + \eval_expr_to\a_count{#6} + \eval_expr_to\b_count{#7} + \eval_expr_to\c_count{#8} + \eval_expr_to\d_count{#9} + \ifisint{rawscale}\then + \e_count=\int{rawscale} + \multiply \a_count \e_count \l_rounded_thousandths\a_count + \multiply \b_count \e_count \l_rounded_thousandths\b_count + \multiply \c_count \e_count \l_rounded_thousandths\c_count + \multiply \d_count \e_count \l_rounded_thousandths\d_count + \edef\a_macro##1{\saved_scale{\the\e_count}{\a_macro{##1}}} + \fi + \x_cs\edef{g-\glyph_name_modifier{#1}}{ + {\the\a_count} + {\the\b_count} + {\the\c_count} + {\the\d_count} + {\a_macro{\saved_raw{#2}{#5}{#1}}} + {\a_macro{\saved_mapfont{#2}{#3}}} + } + \fi +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\setrawglyph[8]{% + \Aheading{Glyph `\typeset@glyph{#1}'} + \Bheading{Taken from} slot $\TypesetIntegerExpression{#4}$ in + font \TypesetStringExpression{#2}% +} +\newcommand\setscaledrawglyph[9]{% + \Aheading{Glyph `\typeset@glyph{#1}'} + \Bheading{Taken from} slot $\TypesetIntegerExpression{#5}$ in + font \TypesetStringExpression{#2} \ConditionallyScaled{#4}% +} +%</doc> +%<misc>\def\setrawglyph#1#2#3#4#5#6#7#8{} +%<misc>\def\setscaledrawglyph#1#2#3#4#5#6#7#8#9{} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\setscalednotglyph} +% \changes{1.917}{2001/03/13}{This macro should set +% \cs{g-\meta{glyph}-not}, not \cs{g-\meta{glyph}}. (LH)} +% \changes{1.922}{2002/09/07}{Corrected typo: should test whether +% the \texttt{rawscale} integer exists, not whether the +% \texttt{i-rawscale} integer exists. (LH)} +% \begin{macro}{\setnotglyph} +% The |\setscalednotglyph| command has the same syntax as the +% |\set|\-|scaled|\-|raw|\-|glyph| command, i.e., +% \begin{isyntax} +% |\setscalednotglyph|\marg{glyph}\marg{font}\marg{design size}^^A +% \marg{scale}\penalty0\marg{slot}\penalty0\marg{width}\penalty0 +% \marg{height}\penalty0\marg{depth}\penalty0\marg{italic} +% \end{isyntax} +% It is a generalized form of the old |\setnotglyph| command, which +% has the syntax +% \begin{isyntax} +% |\setnotglyph|\marg{glyph}\marg{font}\marg{design size}^^A +% \marg{slot}\penalty0\marg{width}\penalty0\marg{height}\penalty0 +% \marg{depth}\penalty0\marg{italic} +% \end{isyntax} +% |\setnotglyph| is now syntactic sugar for the equivalent call of +% |\set|\-|scaled|\-|not|\-|glyph|. +% \begin{macrocode} +%<*pkg> +\def\setnotglyph#1#2#3{ + \setscalednotglyph{#1}{#2}{#3}\one_thousand +} +% \end{macrocode} +% +% Note that only the \meta{glyph}, \meta{width}, \meta{height}, +% \meta{depth}, and \meta{italic} parameters are used. The reason for +% having the other parameters is that |\set|\-|scaled|\-|not|\-^^A +% |glyph| commands can be converted to |\set|\-|scaled|\-|raw|\-^^A +% |glyph| commands when a font is reencoded. Therefore all the +% information must be present, even if it is not used by the main +% definition. +% +% To think about (LH 2000/03/02): Perhaps the \meta{mapcommands} field +% of a \texttt{-not}-glyph should contain a |\glyphwarning|, just in +% case anyone tries to use one? +% \begin{macrocode} +\def\setscalednotglyph#1#2#3#4#5#6#7#8#9{ + \if_undefined{g-\glyph_name_modifier{#1}-not}\then + \eval_expr_to\a_count{#6} + \eval_expr_to\b_count{#7} + \eval_expr_to\c_count{#8} + \eval_expr_to\d_count{#9} + \ifisint{rawscale}\then + \e_count=\int{rawscale} + \multiply \a_count \e_count \l_rounded_thousandths\a_count + \multiply \b_count \e_count \l_rounded_thousandths\b_count + \multiply \c_count \e_count \l_rounded_thousandths\c_count + \multiply \d_count \e_count \l_rounded_thousandths\d_count + \fi + \x_cs\edef{g-\glyph_name_modifier{#1}-not}{ + {\the\a_count} + {\the\b_count} + {\the\c_count} + {\the\d_count} + {}{} + } + \fi +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\setnotglyph[8]{% + \Aheading{Pseudoglyph `\typeset@glyph{#1-not}'}% +} +\newcommand\setscalednotglyph[9]{% + \setnotglyph{#1}{#2}{#3}{#5}{#6}{#7}{#8}{#9}% +} +%</doc> +%<misc>\let\setnotglyph=\setrawglyph +%<misc>\let\setscalednotglyph=\setscaledrawglyph +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\unsetglyph} +% The |\unsetglyph|\marg{name} command makes |\g-|\meta{name} +% undefined. +% +% \begin{macrocode} +%<pkg>\def\unsetglyph#1{\x_cs\let{g-#1}\x_relax} +%<doc>\newcommand\unsetglyph[1]{% +%<doc> \Aheading{Unset glyph `\typeset@glyph{#1}'}} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Glyph commands} +% +% The \meta{glyph commands} are: +% \changes{1.908}{1999/08/22}{Glyph commands avoid \cs{edef}ing old +% contents of \cs{glyph_map_commands} and \cs{glyph_map_fonts}. (LH)} +% \begin{macro}{\glyph} +% |\glyph|\marg{glyph}\marg{scale} +% \changes{1.900}{1999/02/08}{Avoids scaling by 1000. (LH)} +% +% \begin{macrocode} +%<*pkg> +\def\glyph#1#2{ + \glyph_parameter\glyph_metrics{#1} + \eval_expr_to\e_count{#2} + \ifnum \e_count=\one_thousand + \edef\a_macro{\mapcommands{#1}} + \global\glyph_map_commands\expandafter{ + \the\expandafter\glyph_map_commands \a_macro + } + \edef\a_macro{\mapfonts{#1}} + \else + \multiply \a_count \e_count \l_rounded_thousandths\a_count + \multiply \b_count \e_count \l_rounded_thousandths\b_count + \multiply \c_count \e_count \l_rounded_thousandths\c_count + \multiply \d_count \e_count \l_rounded_thousandths\d_count + \edef\a_macro{\saved_scale{\the\e_count}{\mapcommands{#1}}} + \global\glyph_map_commands\expandafter{ + \the\expandafter\glyph_map_commands \a_macro + } + \edef\a_macro{\saved_scale{\the\e_count}{\mapfonts{#1}}} + \fi + \advance \glyph_width \a_count + \advance \b_count \glyph_voffset + \ifnum \glyph_height<\b_count \global\glyph_height=\b_count \fi + \advance \c_count -\glyph_voffset + \ifnum \glyph_depth<\c_count \global\glyph_depth=\c_count \fi + \global\glyph_italic=\d_count + \global\glyph_map_fonts\expandafter{ + \the\expandafter\glyph_map_fonts \a_macro + } +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\glyph[2]{% + \Bheading{Glyph} `\typeset@glyph{#1}' \ConditionallyScaled{#2}% +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\glyphrule} +% |\glyphrule|\marg{width}\marg{height} +% +% \begin{macrocode} +%<*pkg> +\def\glyphrule#1#2{ + \eval_expr_to\b_count{#1} \eval_expr_to\c_count{#2} + \advance\glyph_width by \b_count + \g_eval_expr_to\glyph_depth{\max\glyph_depth{-\glyph_voffset}} + \g_eval_expr_to\glyph_height{ + \max\glyph_height{\add\glyph_voffset\c_count} + } + \global\glyph_italic=0 + \edef\a_macro{\saved_rule{\the\b_count}{\the\c_count}} + \global\glyph_map_commands\expandafter{ + \the\expandafter\glyph_map_commands \a_macro + } +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\glyphrule[2]{% + \Bheading{Rule} $\TypesetIntegerExpression{#1}$ by + $\TypesetIntegerExpression{#2}$% +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\glyphspecial} +% \begin{macro}{\glyphwarning} +% |\glyphspecial|\marg{string}\\ +% |\glyphwarning|\marg{string} +% +% \begin{macrocode} +%<*pkg> +\def\glyphspecial#1{ + \edef\a_macro{\saved_special{#1}} + \global\glyph_map_commands\expandafter{ + \the\expandafter\glyph_map_commands \a_macro + } +} +\def\glyphwarning#1{ + \edef\a_macro{\saved_warning{#1}} + \global\glyph_map_commands\expandafter{ + \the\expandafter\glyph_map_commands \a_macro + } +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\glyphspecial[1]{% + \Bheading{Special} `\TypesetStringExpression{#1}'} +\newcommand\glyphwarning[1]{% + \Bheading{Warning} `\TypesetStringExpression{#1}'} +%</doc> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\movert} +% \changes{1.903}{1999/05/20}{Added update of \cs{glyph_maxhpos}. (LH)} +% \begin{macro}{\moveup} +% |\movert|\marg{xoffset}\\ +% |\moveup|\marg{yoffset} +% +% \begin{macrocode} +%<*pkg> +\def\movert#1{ + \eval_expr{#1} + \ifnum \glyph_maxhpos<\glyph_width + \global\glyph_maxhpos\glyph_width + \fi + \ifnum 0=\result \else + \advance\glyph_width by \result + \edef\a_macro{\saved_movert{\the\result}} + \global\glyph_map_commands\expandafter{ + \the\expandafter\glyph_map_commands \a_macro + } + \fi +} +% \end{macrocode} +% \begin{macrocode} +\def\moveup#1{ + \eval_expr{#1} + \ifnum\result=0\else + \advance\glyph_voffset by \result + \edef\a_macro{\saved_moveup{\the\result}} + \global\glyph_map_commands\expandafter{ + \the\expandafter\glyph_map_commands \a_macro + } + \fi +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\movert[1]{\Bheading{Rt}~$\TypesetIntegerExpression{#1}$} +\newcommand\moveup[1]{\Bheading{Up}~$\TypesetIntegerExpression{#1}$} +%</doc> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\push} +% \changes{1.907}{1999/08/02}{Removed the \cs{edef}. (LH)} +% \begin{macro}{\pop} +% \changes{1.903}{1999/05/20}{Added update of \cs{glyph_maxhpos}. (LH)} +% \changes{1.907}{1999/08/02}{Removed the \cs{edef}. (LH)} +% \begin{macrocode} +%<*pkg> +\def\push{ + \bgroup + \global\glyph_map_commands\expandafter{ + \the\glyph_map_commands \saved_push + } +} +% \end{macrocode} +% \begin{macrocode} +\def\pop{ + \ifnum \glyph_maxhpos<\glyph_width + \global\glyph_maxhpos\glyph_width + \fi + \egroup + \global\glyph_map_commands\expandafter{ + \the\glyph_map_commands \saved_pop + } +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\push{\Bheading{Push}} +\newcommand\pop{\Bheading{Pop}} +%</doc> +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\resetwidth} +% \begin{macro}{\resetheight} +% \begin{macro}{\resetdepth} +% \begin{macro}{\resetitalic} +% |\resetwidth|\marg{width}\\ +% |\resetheight|\marg{height}\\ +% |\resetdepth|\marg{depth}\\ +% |\resetitalic|\marg{italic} +% +% \begin{macrocode} +%<*pkg> +\def\resetwidth#1{\movert{\sub{#1}\glyph_width}} +\def\resetheight{\g_eval_expr_to\glyph_height} +\def\resetdepth{\g_eval_expr_to\glyph_depth} +\def\resetitalic{\g_eval_expr_to\glyph_italic} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\resetwidth[1]{% + \Bheading{Reset width to $\TypesetIntegerExpression{#1}$}% +} +\newcommand\resetheight[1]{% + \Bheading{Reset height to $\TypesetIntegerExpression{#1}$}% +} +\newcommand\resetdepth[1]{% + \Bheading{Reset depth to $\TypesetIntegerExpression{#1}$}% +} +\newcommand\resetitalic[1]{% + \Bheading{Reset italic to $\TypesetIntegerExpression{#1}$}% +} +%</doc> +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\glyphpcc} +% Some syntactic sugar: |\glyphpcc| could do with optimization. +% \begin{quote} +% |\glyphpcc|\marg{glyph}\marg{xoffset}\marg{yoffset} +% \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)} +% +% \begin{macrocode} +%<*pkg> +\def\glyphpcc#1#2#3{ + \ifisglyph{\glyph_name_modifier{#1}}\then + \push + \movert{#2} + \moveup{#3} + \glyph{\glyph_name_modifier{#1}}{\one_thousand} + \pop + \else + \fontinsterror{\string\glyphpcc}{ + Base~glyph~not~set.\messagebreak + This~could~be~a~sign~that~the~AFM~file~is~buggy + }\error_help_a + \fi +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\def\glyphpcc#1#2#3{ + \push + \movert{#2} + \moveup{#3} + \glyph{#1}{1000} + \pop +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\glyphbboxright} +% \changes{1.903}{1999/05/20}{Macro added. (LH)} +% The |\glyphbboxright| command is a valid integer expression, but +% its value is only meaningful inside a |\setglyph| \textellipsis\ +% |\endsetglyph| or |\resetglyph| \textellipsis\ |\endresetglyph| +% structure. There its value is almost the horizontal position of +% the right edge of the bounding box for the glyph constructed so +% far---in reality it is the greatest horizontal offset reached so +% far. +% +% \begin{macrocode} +%<pkg>\def\glyphbboxright{\max\glyph_width\glyph_maxhpos} +%<*doc> +\DeclareRobustCommand\glyphbboxright{% + \gdef\FD@expression{\protect\mathrm{glyphbboxright}} + \global\chardef\FD@priority=\tw@ + \global\FD@bracket@level=\z@ + \FD@evaluate@false +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\samesize} +% \changes{1.903}{1999/05/20}{Added behaviour for nonexistent glyph +% (based on a suggestion from Hilmar Schlegel) and fixed typo in +% \package{fontdoc}. (LH)} +% |\samesize|\marg{glyph} +% +% \begin{macrocode} +%<*pkg> +\def\samesize#1{ + \if_undefined{g-\glyph_name_modifier{#1}}\then + \resetwidth{\glyphbboxright} + \else + \expandafter\expandafter\expandafter + \same_size\csname g-\glyph_name_modifier{#1}\endcsname + \fi +} +\def\same_size#1#2#3#4#5#6{ + \movert{\sub{#1}\glyph_width} + \global\glyph_height=#2 + \global\glyph_depth=#3 + \global\glyph_italic=#4 +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\newcommand\samesize[1]{% + \Bheading{Reset dimensions to those of `\typeset@glyph{#1}'.}% +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifisglyph} +% The control flow command: +% \changes{1.923}{2002/10/20}{Using \cs{if_defined}. (LH)} +% \begin{macrocode} +%<pkg>\def\ifisglyph#1\then{\if_defined{g-#1}\then} +% \end{macrocode} +% \changes{1.911}{1999/11/30}{\protect\protect\protect\Module{misc} +% definition added. (LH)} +% |\ifisglyph| evaluates to false in \Module{misc}, since this avoids +% uses of various metric integer expressions (such as |\width|, +% |\height|, etc.) that are not defined there. +% \begin{macrocode} +%<doc>\def\ifisglyph#1\then{\generic@if{glyph \typeset@glyph{#1} set}} +%<misc>\def\ifisglyph#1\then{\iffalse} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifareglyphs} +% \changes{1.917}{2001/03/17}{Macro added. (LH)} +% The |\ifareglyphs| command test if all glyphs in a comma-separeted +% list of glyphs are set. The syntax is +% \begin{quote} +% |\ifareglyphs|\marg{glyph list}|\then| +% \end{quote} +% The implementation relies on that |\if_true| and |\if_false| do not +% count when \TeX\ is skipping text that is balanced with respect to +% |\if|s and |\fi|s. +% \begin{macrocode} +%<*pkg> +\def\ifareglyphs#1\then{ + \process_csep_list{\if_is_glyph}#1,\process_csep_list, + \if_true +} +\def\if_is_glyph#1{ + \if_undefined{g-#1}\then \expandafter\if_false \fi +} +%</pkg> +%<misc>\let\ifareglyphs=\ifisglyph +%<*doc> +\def\ifareglyphs#1\then{% + \generic@if{all glyphs in \FD@typeset@string@set{#1} are set}% +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \section{Converting an ETX file to a (V)PL file} +% +% \subsection{Lowest-level user interface} +% +% \DescribeMacro{\etxtovpl} +% The macro: +% \begin{quote} +% |\etxtovpl|\marg{encoding list}\marg{vplfile} +% \end{quote} +% writes a virtual font (as a virtual property list) with the +% encoding specified by the items in the \meta{encoding list}, +% which typically are names of ETX files. +% (This macro is called by |\installfont|.) +% +% \DescribeMacro{\etxtopl} +% The macro: +% \begin{quote} +% |\etxtopl|\marg{encoding list}\marg{plfile} +% \end{quote} +% writes a font (as a property list) with the encoding +% specified by the items in the \meta{encoding list}, +% which typically are names of ETX files. +% (This macro is called by |\installrawfont|.) +% +% \multchanges{\cs{etxtovpl}\cs{etxtopl}}{1.923}{2002/10/24}{The +% first argument of these macros is now a comma-separated list +% of ETX files, and the items may be subjected to modifier +% clauses. (LH)} +% +% \begin{macro}{\etxtovpl} +% \changes{1.923}{2002/10/25}{The program is called \texttt{vptovf}, +% not \texttt{vpltovf}. (LH)} +% \begin{macro}{\etxtopl} +% \begin{macrocode} +%<*pkg> +\def\etxtovpl#1#2{{ + \def\vpl_extension{vpl} + \def\vpl_title{COMMENT} + \def\vpl_font{virtual~font} + \def\vpl_Font{Virtual~font} + \def\vpl_call{\string\etxtovpl{#1}{#2}} + \def\vpl_to_vf##1{vptovf~##1.vpl~##1.vf~##1.tfm} + \a_toks={} + \process_csep_list\make_inputetx #1,\process_csep_list, + \expandafter\etx_to_font \expandafter{\the\a_toks}{#2} +}} +\def\etxtopl#1#2{{ + \def\vpl_extension{pl} + \def\vpl_title{COMMENT} + \def\vpl_font{font} + \def\vpl_Font{Font} + \def\vpl_call{\string\etxtopl{#1}{#2}} + \def\vpl_to_vf##1{pltotf~##1.pl~##1.tfm} + \_including_map_false + \global\rawfont_scaling=-\p@ + \a_toks={} + \process_csep_list\make_inputetx #1,\process_csep_list, + \expandafter\etx_to_font \expandafter{\the\a_toks}{#2} +}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{switch}{_including_map_} +% \changes{1.900}{1998/10/02}{New switch that can inhibit writing of +% VPL-specific properties. (LH)} +% The v\,1.5 method of controlling whether \texttt{MAP} and +% \texttt{MAPFONT} properties should be written requires that some +% code is put in an awkward place (in |\make_mapfonts| rather than +% |\make_characters|). As the code was being reorganised anyway, it +% seemed best to let a switch control this instead. If +% |\if_including_map_| is true, \texttt{MAP} and \texttt{MAPFONT} +% properties are written to the file (which should be a VPL), if it is +% false then they are not written to the file (which is then a normal +% PL). +% \begin{macrocode} +\newif\if_including_map_ +\_including_map_true +% \end{macrocode} +% \end{switch} +% +% \begin{macro}{\make_inputetx} +% The |\make_inputetx| macro takes a single argument that should have +% the form +% \begin{quote} +% \meta{file name root}\meta{optional modifiers} +% \end{quote} +% as explained in the comments to |\input_mtx_file|. The effect of +% this macro is to append some commands (usually +% |\inputetx|\marg{file name root}) to |\a_toks|. This may however +% change if some clause in the \meta{optional modifiers} redefines +% |\a_macro|. +% \changes{1.923}{2002/10/24}{Macro added. (LH)} +% \begin{macrocode} +\def\make_inputetx#1{ + \def\a_macro{\noexpand\inputetx{\file_name}} + \get_file_name #1~{}~\par + \edef\a_macro{\a_macro} + \a_toks=\expandafter{ \the\expandafter\a_toks \a_macro} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IFKW-mtxasetx} +% The \texttt{mtxasetx} modifier clause causes the \meta{encoding +% list} item in question to be input using |\input_mtx_as_etx| rather +% than |\inputetx|. This makes it possible to use the |\setrawglyph| +% and |\setscaledrawglyph| commands in an MTX file as a poor +% substitute for a proper ETX file. This is sometimes useful for +% making proofs. +% \changes{1.923}{2002/10/24}{Macro added. (LH)} +% \begin{macrocode} +\x_cs\def{IFKW-mtxasetx}{ + \def\a_macro{\noexpand\input_mtx_as_etx{\file_name}} + \get_keyword +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\etx_to_font} +% |\etx_to_font|\marg{encoding commands}\marg{fontfile} makes +% a (V)PL file whose encoding is specified by the \meta{encoding +% commands}. These are usually just one or a few |\inputetx| +% commands, as the specification of an encoding usually requires much +% more code than is convenient to provide as an argument. +% \changes{1.923}{2002/10/24}{Made the first argument a list of +% commands. Renamed \cs{vpl_caller} to \cs{vpl_call}; it is now +% assumed to contain the arguments as well. (LH)} +% \begin{macrocode} +\def\etx_to_font#1#2{ + \make_assignments{#1} + \open_out{#2.\vpl_extension} + \top_of_pl_hook + \out_line{(\vpl_title\space\vpl_font\space + #2~created~by~fontinst~v\fontinstversion)} + \out_line{} + \out_line{(COMMENT~Filename:~#2.\vpl_extension)} + \out_line{(COMMENT~Created~by:~tex~\jobname)} + \out_line{(COMMENT~Created~using:~\vpl_call)} + \out_line{} + \out_line{(COMMENT~This~file~can~be~turned~into~a~\vpl_font\space + with)} + \out_line{(COMMENT~\vpl_to_vf{#2})} + \out_line{} + \out_line{(COMMENT~THIS~FILE~CAN~THEN~BE~DELETED.)} + \out_line{} + \make_header{#1} + \if_including_map_ \make_mapfonts{#1} \fi + \make_fontdimens{#1} + \make_ligtable{#1} + \make_characters{#1} + \make_tidy{#1} + \out_line{} + \out_line{(COMMENT~END~OF~FILE~#2.\vpl_extension)} + \close_out{\vpl_Font} +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\pre_first_etx_pass_hook} +% \begin{macro}{\pre_second_etx_pass_hook} +% \begin{macro}{\pre_third_etx_pass_hook} +% \begin{macro}{\pre_fourth_etx_pass_hook} +% \begin{macro}{\post_first_etx_pass_hook} +% \begin{macro}{\post_second_etx_pass_hook} +% \begin{macro}{\post_third_etx_pass_hook} +% \begin{macro}{\post_fourth_etx_pass_hook} +% \begin{macro}{\tidying_up_hook} +% \multchanges{\cs{pre_first_etx_pass_hook}^^A +% \cs{pre_second_etx_pass_hook}\cs{pre_third_etx_pass_hook}^^A +% \cs{pre_fourth_etx_pass_hook}\cs{post_first_etx_pass_hook}^^A +% \cs{post_second_etx_pass_hook}\cs{post_third_etx_pass_hook}^^A +% \cs{post_fourth_etx_pass_hook}\cs{tidying_up_hook}}{1.900}^^A +% {1998/09/30}{ETX-to-VPL hooks added. (LH)} +% \begin{macro}{\top_of_pl_hook} +% \changes{1.912}{2000/01/29}{Property list hook added. (LH)} +% As the |\etxtovpl| and |\etxtopl| macros are the +% lowest-level interfaces to what they do that are available in +% \package{fontinst} and as the amount of code they execute is really +% quite large, I suspect that users may occationally have need of +% some robust mechanism for inserting extra code at well specified +% positions. Such a mechanism is provided by the following hooks: +% \begin{macrocode} +\let\pre_first_etx_pass_hook\x_relax +\let\pre_second_etx_pass_hook\x_relax +\let\pre_third_etx_pass_hook\x_relax +\let\pre_fourth_etx_pass_hook\x_relax +\let\post_first_etx_pass_hook\x_relax +\let\post_second_etx_pass_hook\x_relax +\let\post_third_etx_pass_hook\x_relax +\let\post_fourth_etx_pass_hook\x_relax +\let\tidying_up_hook\x_relax +\let\top_of_pl_hook\x_relax +% \end{macrocode} +% The first nine are executed at the positions of the ETX-to-VPL +% file generation that their name indicate. |\top_of_pl_hook| is +% slightly different---it is executed right after a PL or VPL file +% is opened for writing. Thus it is also used by the MTX-to-PL system. +% +% To include code in one of them, one should write things like +% \begin{quote} +% |\add_to\pre_first_etx_pass_hook|\marg{extra code} +% \end{quote} +% I (LH) have the following in my \texttt{fontinst.rc} file\relax +% \SortIndex{fontinst.rc file}{\texttt{fontinst.rc} file} +% \begin{quote} +% |\add_to\top_of_pl_hook{\out_line{(COMMENT~-*-Text-*-)}}| +% \end{quote} +% Without it, my text editor annoys me by assuming that \texttt{.pl} +% stands for Perl. +% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} +% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} +% +% +% \subsection{Glyph to slot assignments} +% +% \changes{1.900}{1998/12/06}{New method of storing slot assignments. +% (LH)} +% The way \package{fontinst} has traditionally kept track +% of which glyph goes to which slot---information which is needed when +% writing the |LIGTABLE| in a (V)PL, for |\nextlarger|, and for the +% varchar commands---is by storing the slot number in the integer +% whose name is the name of the glyph. There are two main problems with +% this implementation: (i)~If a user sets an integer which happens to +% have the same name as a glyph that is not assigned to any slot, then +% kerns for that unused glyph might be written to the file, accidentally +% creating a kerning pair where there should be none. (ii)~It is only +% possible to store one slot number per glyph, so if one uses the same +% glyph for several slots then \package{fontinst} can only write kerns +% (and ligatures) for one of the occurences, despite the fact that all +% occurences have the same typographical need for them. These problems +% do only occur for glyphs on the right side of a ligature/kerning +% pair, but they are still serious enough. This part of +% \package{fontinst} has therefore been reimplemented. +% +% \changes{1.910}{1999/11/04}{Changed the way slot numbers are stored +% in \cs{slots-}\meta{glyph} control sequences. (LH)} +% The new implementation does not use integers, instead it uses a new +% family of macros with names on the form |\slots-|\meta{glyph}^^A +% \describecsfamily{slots-\meta{glyph}}. These macros expand to +% sequences of |\do|\thinspace\meta{character}, where \meta{character} +% 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 +% 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 +% marker glyph). To detect whether there is a collision between these two +% uses of the slot, the right boundary marker glyph uses |\rboundary_do| +% instead of |\do| and the glyph whose slot serves as boundarychar uses +% |\rbserver_do| instead of |\do|. By redefining these two control +% sequences to generate a warning message when appropriate, the occurence +% of such a collision can be brought to the user's attention. +% +% \changes{1.900}{1998/12/11}{Added compability code for the old +% interface for boundary ligatures and kerns. (LH)} +% As it turned out to not be such a big deal, some extra code (protected +% by a \package{docstrip} switch called \Module{boundaryCompability}) +% that makes \package{fontinst} compatible with the previous syntax for +% boundary handling has been included. I don't recommend using +% it though, since it makes \package{fontinst} store almost all slot +% numbers in two places. +% +% +% \begin{macro}{\make_assignments} +% \begin{macrocode} +\def\make_assignments#1{ + \let\do_slot=\assign_slot + \let\end_do_slot=\end_assign_slot + \def\do_boundary{\bgroup + \let\makerightboundary=\bad_makerightboundary + } + \let\endsetleftboundary=\egroup + \let\makerightboundary=\assign_rboundary + \pre_first_etx_pass_hook + #1 + \post_first_etx_pass_hook + \let\end_do_slot=\empty_command + \let\do_boundary=\x_relax + \let\endsetleftboundary=\x_relax + \let\makerightboundary=\gobble_one +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\assign_slot} +% \begin{macro}{\end_assign_slot} +% \changes{1.907}{1999/08/20}{Slots are not assigned to glyphs that +% do not exist. (LH)} +% |\assign_slot| begins the assignment of a slot to a glyph. +% |\end_assign_slot| completes it. In the time between these two, +% some information is stored in |\a_toks|, so that it can be +% modified by an intervening |\makerightboundary| (which is then +% |\assign_rboundary|). +% +% Note that the code below will not reset |\lccode0|. The value of +% this register should be considered uncertain while a ligful PL +% or VPL file is written, i.e., in ETX files. +% \SortIndex{lccode0}{\cs{lccode\,0} register\encapchar usage} +% \begin{macrocode} +\def\assign_slot{\a_toks={\do}} +\begingroup + \catcode0=12 + \gdef\end_assign_slot{ + \ifisglyph\slot_name\then + \lccode0=\slot_number + \lowercase{ + \expandafter\add_to + \csname slots-\slot_name\expandafter\endcsname + \expandafter{\the\a_toks^^@} + } +%<boundaryCompability> \x_resetint\slot_name\slot_number + \fi + } +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \begin{macro}{\assign_rboundary} +% \begin{macro}{\bad_makerightboundary} +% |\assign_rboundary| is what |\makerightboundary| is when it is +% assigning a slot to act as right boundary marker. +% +% |\bad_makerightboundary| is what |\makerightboundary| temporarily +% gets set to between |\setleftboundary| and |\endsetleftboundary|. +% \begin{macrocode} + \gdef\assign_rboundary#1{ + \lccode0=\slot_number + \lowercase{\x_cs\add_to{slots-#1}{\rboundary_do^^@}} + \x_setint{\percent_char boundarychar}\slot_number + \a_toks={\rbserver_do} + } +\endgroup +\def\bad_makerightboundary#1{ + \errhelp={The~left~boundary~is~not~a~slot,~so~it~cannot~serve~ + as~right~boundary.} + \errmessage{Incorrect~use~of~\string\makerightboundary} +} +% \end{macrocode} +% \end{macro} \end{macro} +% +% \begin{macro}{\get_slot_num} +% \changes{1.910}{1999/11/04}{Removed redefinition of \cs{do} to +% \cs{gobble_one} from temporary definition of \cs{do}, since a +% \cs{slots-} list usually contains only one or two elements +% anyway. (LH)} +% It is sometimes necessary to get the number of an arbitrary slot +% given only the name of the glyph which has been assigned to the +% slot. In such situations, the call +% \begin{quote} +% |\get_slot_num{|\meta{glyph}|}| +% \end{quote} +% will set |\result| to the number of one such slot if the glyph has +% been assigned to some slot, or set |\result| to minus one if the glyph +% has not been assigned to a slot. +% \begin{macrocode} +\def\get_slot_num#1{ +%<*!boundaryCompability> + \global\result=-1 + \bgroup + \def\do{\global\result=`} + \let\rbserver_do=\do + \let\rboundary_do=\gobble_one + \csname slots-#1\endcsname + \egroup +%</!boundaryCompability> +%<*boundaryCompability> + \ifisint{#1}\then + \global\result=\int{#1} + \else + \global\result=-1 + \fi + \x_relax +%</boundaryCompability> +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\ifisinslot} +% The call |\ifisinslot|\marg{glyph}\marg{slot}|\then| can be used to +% test whether glyph \meta{glyph} has been assigned to slot \meta{slot}. +% Both then-part and else-part of the conditional will however be +% ignored when the ETX file is read the first time, since the +% assignment of glyph to slots need not have been completed yet. +% \begin{macrocode} +\def\ifisinslot#1#2\then{ + \ifx \makerightboundary\gobble_one +% \end{macrocode} +% This is used to test if the ETX file is being read in for the first +% time. It is a bit hacky, but it is efficient. +% \begin{macrocode} + \eval_expr{#2} + \begingroup + \def\do##1{\ifnum `##1=\result \let\do=\gobble_one \fi} + \def\rbserver_do{\do} + \let\rboundary_do=\gobble_one + \csname slots-#1\endcsname + \expandafter\endgroup + \ifx \do\gobble_one + \expandafter\expandafter \expandafter\if_true + \else + \expandafter\expandafter \expandafter\if_false + \fi + \else + \expandafter\gobble_if + \fi +} +%</pkg> +% \end{macrocode} +% \begin{macrocode} +%<*doc> +\def\ifisinslot#1#2\then{% + \generic@if{glyph \typeset@glyph{#1} assigned to slot + $\TypesetIntegerExpression{#2}$}% +} +%</doc> +% \end{macrocode} +% \end{macro} +% +% +% \subsection{The header, mapfonts, and fontdimens} +% +% \changes{1.913}{2000/02/26}{Using \cs{make_factor} for making PL +% reals, rather than \cs{afm_convert}+\cs{vpl_real}. +% \cs{scaled_design_size} replaced by new dimen \cs{mapfont_scaling} for +% determining mapfont atsize. (LH)} +% +% \begin{macro}{\mapfont_scaling} +% The |\mapfont_scaling| dimen is used for calculating how much a mapfont +% has been scaled, for use in \texttt{FONTAT} properties, and for +% selecting the correct mapfont. It is initialized to $1$. +% \begin{macrocode} +%<*pkg> +\newdimen\mapfont_scaling +\mapfont_scaling=1pt +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rawfont_scaling} +% The |\rawfont_scaling| dimen is used for communicating the scaling +% that has been applied to a raw font---a font being installed using +% |\install|\-|rawfont|\penalty0---out to that macro. |\rawfont_|\-^^A +% |scaling| should always be globally assigned. +% \changes{1.913}{2000/03/21}{Dimen added. (LH)} +% \begin{macrocode} +\newdimen\rawfont_scaling +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\scaled_design_size} +% \begin{macro}{\afm_convert} +% The call +% \begin{quote} +% |\afm_convert|\meta{dimen}|=|\meta{integer expression}|;| +% \end{quote} +% converts a count into a dimen, assuming the count is a number +% of AFM units. I'll assume that the largest dimension I'll have +% to deal with is 131\,pt, to try to minimize rounding errors. +% +% \begin{macrocode} +% \newdimen\scaled_design_size +% \end{macrocode} +% \begin{macrocode} +% \def\afm_convert#1=#2;{ +% \eval_expr{#2} +% #1=\scaled_design_size +% \divide#1 by 8 +% \multiply #1 by \result +% \divide #1 by \one_thousand +% \multiply#1 by 8 +% } +% \end{macrocode} +% \end{macro} \end{macro} +% +% \begin{macro}{\vpl_real} +% \begin{macro}{\vpl_int} +% The commands |\vpl_real|\meta{dimen} and |\vpl_int|\meta{count} print +% a dimension and integer respectively in (V)PL syntax. +% +% \begin{macrocode} +\def\vpl_real#1{R~\expandafter\lose_measure\the#1} +\def\vpl_int#1{D~\the#1} +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% The count register |\boundary_char| has been removed, since +% the reimplementation of the left and right boundaries have drastically +% decreased the need to check which slot serves as the right boundary. +% Instead the integer |%boundarychar| (whose name cannot normally be typed) +% is used to store the number of this slot, but the user need never (and +% should not) access this integer directly. If the integer is not set +% then no slot serves as boundarychar. +% \changes{1.900}{1998/12/04}{\cs{boundary_char} count register +% removed. Right boundary slot number is now stored in the +% \texttt{\%boundarychar} integer instead. (LH)} +% +% \begin{macro}{\side_bearings} +% \begin{macro}{\curr_bearings} +% These two dimens are used by the letterspacing mechanism. +% \begin{macrocode} +\newdimen\side_bearings +\newdimen\curr_bearings +% \end{macrocode} +% \end{macro} \end{macro} +% +% \begin{macro}{\make_header} +% \begin{macrocode} +\def\make_header#1{ + \global\font_count=0 + \setdim{designsize}{10pt} + \a_dimen=\dim{designsize} + \out_line{(DESIGNSIZE~\vpl_real\a_dimen)} + \x_setstr{codingscheme}{UNKNOWN} + \out_line{(CODINGSCHEME~\str{codingscheme})} +%<*boundaryCompability> + \ifisint{boundarychar}\then + \x_setint{\percent_char boundarychar}{\int{boundarychar}} + \immediate\write16{Please~use~\string\setleftboundary\space + and/or~\string\makerightboundary^^J + instead~of~setting~the~boundarychar~integer.} + \fi +%</boundaryCompability> + \ifisint{\percent_char boundarychar}\then + \a_count=\int{\percent_char boundarychar} + \out_line{(BOUNDARYCHAR~\vpl_int\a_count)} + \fi + \x_setint{letterspacing}{0} + \side_bearings=\make_factor{\int{letterspacing}}\half_point + \x_setint{minimumkern}{0} + \minimum_kern=\int{minimumkern} + \out_line{} +} +% \end{macrocode} +% \changes{1.900}{1999/01/20}{Removed test for no letterspacing. (LH)} +% \changes{1.900}{1999/01/20}{Made integer expression \cs{div} a +% dimen \cs{divide}. (LH)} +% \end{macro} +% +% +% \begin{macro}{\make_mapfonts} +% \begin{macrocode} +\def\make_mapfonts#1{ + \let\saved_scale\vpl_scale + \let\saved_mapfont\vpl_mapfont + \let\do_slot=\do_mapfont + \pre_second_etx_pass_hook + #1 + \post_second_etx_pass_hook + \out_line{} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\do_mapfont} +% |\do_mapfont| produces a |MAPFONT| entry for each font used by +% glyph |\slot_name|. +% \begin{macrocode} +\def\do_mapfont{ + \ifisglyph\slot_name\then + \mapfonts\slot_name + \fi +} +% \end{macrocode} +% \end{macro} +% +% The following commands can be used in the \meta{mapfonts} glyph +% parameter. +% +% \begin{macro}{\vpl_scale} +% \begin{macrocode} +\def\vpl_scale#1#2{{ + \mapfont_scaling=\make_factor{#1}\mapfont_scaling + #2 +}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vpl_mapfont} +% \changes{1.904}{1999/06/16}{Added \cs{record_usage}. (LH)} +% \changes{1.913}{2000/02/26}{Mapfont number control sequences are +% named \cs{\meta{scaling factor}pt-\meta{font}} instead of +% \cs{\meta{font}-\meta{scaling factor}pt}. They are also made +% \cs{mathchardef}s. (LH)} +% \begin{macrocode} +\def\vpl_mapfont#1#2{ + \a_dimen=#2 + \if_undefined{\the\mapfont_scaling-#1}\then + \global\x_cs\mathchardef{\the\mapfont_scaling-#1}=\font_count + \x_cs\xdef{f-\the\font_count}{\the\mapfont_scaling-#1} + \out_line{(MAPFONT~\vpl_int\font_count\space + (FONTNAME~#1)~ + (FONTDSIZE~\vpl_real\a_dimen)~ + (FONTAT~\vpl_real\mapfont_scaling))} + \record_usage{#1} + \global\advance\font_count by 1 + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\pl_mapfont} +% As PL files have no \texttt{MAPFONT} properties, the |\pl_mapfont| +% macro only needs to do one thing: copy the current value of +% |\mapfont_|\-|scaling| to |\rawfont_|\-|scaling|. This is necessary +% since if the raw font for which a ligful PL is being written has +% been scaled, then that scaling factor must be put in the appropriate +% place in the FD file entry, and the simplest way to determine this +% scaling factor is to execute the |\mapfonts| of some glyph in the +% font. +% +% Due to the fact that the second ETX file pass (that during which the +% \texttt{MAPFONT} properties are written) is skipped when a PL file +% is being written, the |\mapfonts| get executed during the fourth ETX +% file pass instead of the second. This works fine since the +% |\mapcommands| that are executed at that time when a VPL file is +% being written aren't needed for PL files. +% \changes{1.913}{2000/03/21}{Macro added. (LH)} +% \begin{macrocode} +\def\pl_mapfont#1#2{\global\rawfont_scaling=\mapfont_scaling} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\font_count} +% \begin{macro}{\next_mapfont} +% \begin{macro}{\prev_mapfont} +% \begin{macrocode} +\newcount\font_count +\newcount\next_mapfont +\newcount\prev_mapfont +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} +% +% +% \begin{macro}{\make_fontdimens} +% This macro writes the \texttt{FONTDIMEN} property list. Note that +% there is a difference between fontdimen 1 and the others, in that +% fontdimen 1 is always in \texttt{pt}, not in the atsize-relative +% \texttt{FONTUNITS} unit that the others are. Nonetheless, they can +% both be treated the same here. This relies on (i) that 1000 denotes +% the factor 1, and (ii) that 1000 AFM units equals 1 fontunit. +% \begin{macrocode} +\def\make_fontdimens#1{ + \out_line{(FONTDIMEN} + \a_count=1 + \loop\ifnum 256>\a_count + \ifisint{fontdimen(\the\a_count)}\then + \out_lline{(PARAMETER~\vpl_int\a_count\space + R~\make_factor{\int{fontdimen(\the\a_count)}})} + \fi + \advance \a_count \@ne + \repeat + \out_lline{)} + \out_line{} +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{The ligtable} +% +% \begin{macro}{\make_ligtable} +% \changes{1.927}{2003/12/08}{Changed the surrounding group to +% \cs{begingroup} type. This helps contain errors that arise when +% the \cs{setslot}s and \cs{endsetslot}s aren't properly balanced. +% (LH)} +% \begin{macrocode} +\def\make_ligtable#1{ + \begingroup + \out_line{(LIGTABLE} +%<!boundaryCompability> \let\do_slot=\bgroup +%<*boundaryCompability> + \def\do_slot{\bgroup + \ifisint{boundarychar}\then + \ifnum \int{boundarychar}=\slot_number + \def\vpl_liglabel{\out_liglabel\boundary_liglabel} + \fi + \fi + } +%</boundaryCompability> + \let\end_do_slot=\vpl_kerning + \def\do_boundary{\bgroup \let\vpl_liglabel=\boundary_liglabel} + \let\endsetleftboundary=\vpl_kerning + \let\ligature=\vpl_ligature + \let\k=\vpl_kern + \let\rbserver_do=\vpl_rbserver_do + \let\rboundary_do=\vpl_rboundary_do + \pre_third_etx_pass_hook + #1 + \post_third_etx_pass_hook + \out_lline{)} + \endgroup + \out_line{} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vpl_rbserver_do} +% \begin{macro}{\vpl_rboundary_do} +% \begin{macro}{\wrn_rboundary_do} +% |\vpl_rbserver_do| and |\vpl_rboundary_do| are what |\rbserver_do| +% and |\rboundary_do| respectively are when a ligkern program is being +% written and no entry has yet been written for the boundarychar +% slot. |\wrn_rboundary_do| is what one of them will get set to +% afterwards, so that warnings are written when collisions between +% using the slot as a right boundary marker and using the slot for +% the actual glyph occur. +% \begin{macrocode} +\def\vpl_rbserver_do#1{ + \do{#1} + \let\rboundary_do=\wrn_rboundary_do +} +\def\vpl_rboundary_do#1{ + \do{#1} + \let\rbserver_do=\wrn_rboundary_do +} +\def\wrn_rboundary_do#1{ + \do{#1} + \immediate\write16{Boundarychar~slot~usage~collision~in~ + `\slot_name'~ligkern~program.} +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% \begin{macro}{\vpl_ligature} +% |\vpl_ligature{|\meta{type}|}{|\meta{glyph}|}{|\meta{glyph}|}| +% produces a ligtable entry for glyph |\slot_name|. +% +% The double spaces in the |\out_lline| statement below might look +% strange, but |\number| will always gobble the first one. +% \begin{macrocode} +\def\vpl_ligature#1#2#3{ + \get_slot_num{#3} + \ifnum -1=\result + \immediate\write16{Warning:~\string\ligature\space + for~unknown~slot~`#3'.} + \else + \x_cs\ifx{slots-#2}\x_relax + \immediate\write16{Warning:~\string\ligature\space + for~unknown~slot~`#2'.} + \else + \def\do##1{ + \vpl_liglabel + \out_lline{(#1~D~\number`##1~\space\vpl_int\result)~ + (COMMENT~#2~#3)} + } + \csname slots-#2\endcsname + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\vpl_kerning} +% |\vpl_kerning| writes out kerning instructions. +% \begin{macrocode} +\def\vpl_kerning{ + \let\do=\vpl_kern_do + \csname~r-\slot_name\endcsname + \vpl_ligstop + \egroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vpl_kern} +% |\vpl_kern|\,|\l-|\meta{name}\,|\|\meta{amount} writes out a |KRN| +% instruction. +% +% \changes{1.900}{1998/10/02}{Macro modified to avoid duplicate kerns. +% (LH)} +% |\vpl_kern| has been modified so that at most one +% \texttt{KRN} instruction is written for each (ordered) pair of +% characters. The idea is basically to make \package{fontinst} forget, +% until the end of |\vpl_kerning|, that the glyph for which |\vpl_kern| +% is being called has been assigned a slot, as this stops any more +% \texttt{KRN} instructions for that particular glyph from being +% written. |\vpl_kern| has also been modified so that it will not write +% out any \texttt{KRN} instructions for kerns whose absolute value is +% less than or equal to |\minimum_kern|. |\minimum_kern| gets set to +% the value of the integer \texttt{minimumkern} in |\make_header|. If +% the user has not set \texttt{minimumkern}, a default value of 0 will +% be supplied by \package{fontinst}. +% +% \changes{1.900}{1998/12/07}{Much of the code from \cs{vpl_kern} has +% been moved to \cs{vpl_kern_do}. (LH)} +% \changes{1.913}{2000/02/26}{Using a nested \cs{ifnum} construct to +% test the condition $\left\protect\vert +% \protect\mbox{\cs{a_count}}\right\protect\vert \quotechar > +% \protect\mbox{\cs{minimum_kern}}$. (LH)} +% \begin{macrocode} +\def\vpl_kern#1#2{ + \edef\a_macro{\expandafter\gobble_three\string#1} + \a_count=\expandafter\gobble_one\string#2\x_relax + \ifnum \ifnum -\a_count>\a_count - \fi\a_count>\minimum_kern + \edef\b_macro{~R~\make_factor\a_count} + \csname slots-\a_macro\endcsname + \fi + \x_cs\let{slots-\a_macro}=\x_relax +} +% \end{macrocode} +% Observation (LH 1999/03/16): The above construction has the +% side-effect that a direct contradiction between a right boundary +% glyph and a glyph in the |%boundarychar| slot won't be detected if +% one of the items in contradiction is a kern less than or equal to +% |\minimum_kern|. Perhaps this should be changed (letting |\do| equal +% to |\gobble_one| would let the dectection mechanism work, but |\do| +% would have to be restored afterwards and it is doubtful if it is +% worth it). +% \end{macro} +% +% +% \begin{macro}{\vpl_kern_do} +% |\vpl_kern_do| is what |\do| is defined to be when kerns are written. +% \begin{macrocode} +\def\vpl_kern_do#1{ + \vpl_liglabel + \out_lline{ + (KRN~D~\number`#1~\b_macro)~ + (COMMENT~\a_macro) + } +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\out_liglabel} +% \begin{macro}{\boundary_liglabel} +% \begin{macro}{\vpl_liglabel} +% |\out_liglabel| writes out a |LIGLABEL| instruction for a slot. +% |\boundary_liglabel| writes out a |LIGLABEL| instruction for the +% |BOUNDARYCHAR| ligkern program. |\vpl_liglabel| writes out the +% correct |LIGLABEL| instruction for the current ligkern program, if it +% is approriate. +% +% \begin{macrocode} +\def\out_liglabel{ + \out_lline{(LABEL~\vpl_int\slot_number)~(COMMENT~\slot_name)} + \let\vpl_liglabel=\x_relax + \let\vpl_ligstop=\out_ligstop +} +\def\boundary_liglabel{ + \out_lline{(LABEL~BOUNDARYCHAR)~(COMMENT~\slot_name)} + \let\vpl_liglabel=\x_relax + \let\vpl_ligstop=\out_ligstop +} +\let\vpl_liglabel=\out_liglabel +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\out_ligstop} +% \begin{macro}{\vpl_ligstop} +% |\vpl_ligstop| writes out a |LIGSTOP| instruction if appropriate. +% \begin{macrocode} +\def\out_ligstop{\out_lline{(STOP)} + \let\vpl_liglabel=\out_liglabel + \let\vpl_ligstop=\x_relax} +\let\vpl_ligstop=\x_relax +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% \subsection{The characters} +% +% \begin{macro}{\make_characters} +% \begin{macrocode} +\def\make_characters#1{ + \bgroup + \let\do_slot=\do_character + \let\end_do_slot=\end_do_character + \let\nextlarger=\vpl_nextlarger + \let\varchar=\vpl_varchar + \let\endvarchar=\end_vpl_varchar + \let\vartop=\vpl_vartop + \let\varmid=\vpl_varmid + \let\varbot=\vpl_varbot + \let\varrep=\vpl_varrep + \if_including_map_ + \let\saved_raw\vpl_raw + \let\saved_rule\vpl_rule + \let\saved_special\vpl_special + \let\saved_warning\vpl_warning + \let\saved_movert\vpl_movert + \let\saved_moveup\vpl_moveup + \let\saved_push\vpl_push + \let\saved_pop\vpl_pop + \else + \def\do_character_map{ + \ifdim \rawfont_scaling=-\p@ + \mapfonts\slot_name + \else + \let\do_character_map=\x_relax + \fi + } + \let\saved_mapfont\pl_mapfont + \let\saved_scale\vpl_scale + \fi + \pre_fourth_etx_pass_hook + #1 + \post_fourth_etx_pass_hook + \egroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\do_character} +% \changes{1.913}{2000/03/10}{Negative italic corrections \emph{are} +% written to the (V)PL being generated. (LH)} +% \changes{1.927}{2004/07/13}{Added flag for emitting warning message +% when a glyph is missing. (LH) Requested by Werner Lemberg.} +% |\do_character| produces a character entry for glyph |\slot_name| in +% slot |\slot_number|. +% +% \begin{macrocode} +\def\do_character{ + \if_undefined{g-\slot_name}\then + \ifisint{requireglyphs}\then + \fontinstwarning{ETX~to~(V)PL}{ + Undefined~glyph~`\slot_name'~requested\message_break + for~slot~\the\slot_number\message_number} + \fi + \expandafter\gobble_setslot + \else + \ifx\slot_name\notdef_name\else + \out_line{(CHARACTER~\vpl_int\slot_number\space + (COMMENT~\slot_name)} + \glyph_parameter\glyph_metrics\slot_name + \a_dimen=\make_factor\a_count \p@ + \do_character_sidebearings + \out_lline{(CHARWD~\vpl_real\a_dimen)} + \ifnum \z@=\b_count \else + \out_lline{(CHARHT~R~\make_factor\b_count)} + \fi + \ifnum \z@=\c_count \else + \out_lline{(CHARDP~R~\make_factor\c_count)} + \fi + \ifnum \z@=\d_count \else + \out_lline{(CHARIC~R~\make_factor\d_count)} + \fi + \do_character_map + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\do_character_sidebearings} +% \begin{macrocode} +\def\do_character_sidebearings{ + \ifisint{\slot_name-spacing}\then + \curr_bearings=\make_factor{\int{\slot_name-spacing}}\half_point + \else + \curr_bearings=\side_bearings + \fi + \advance\a_dimen by 2\curr_bearings +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\do_character_map} +% \begin{macrocode} +\def\do_character_map{ + \global\prev_mapfont=0 + \out_lline{(MAP} + \ifdim 0pt=\curr_bearings + \mapcommands\slot_name + \else + \out_llline{(MOVERIGHT~\vpl_real\curr_bearings)} + \mapcommands\slot_name + \out_llline{(MOVERIGHT~\vpl_real\curr_bearings)} + \fi + \out_llline{)} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\do_character_no_letterspacing} +% LH 1999/03/27: This is an alternative version of |\do_character| +% which I think is now antiquated. It used to have an advantage over +% |\do_character| in that it did not do any letterspacing (in v\,1.5, +% that was good since |\do_character| used to write code for +% letterspacing to the VPL regardless of whether is was needed or +% not), but that advantage is gone since |\do_character_map| is now +% a bit less stupid than it used to be. +% +% For the record, I don't think there ever was a user interface for +% using this macro instead of |\do_character|, but I suspect there +% are plenty of people around who have hacked it into being used. +% +% With v\,1.913 I commented it out completely, since I didn't feel +% like updating the calls to |\afm_convert|. +% \begin{macrocode} +%<*obsolete> +% \def\do_character_no_letterspacing{ +% \x_cs\ifx{g-\slot_name}\x_relax +% \expandafter\gobble_setslot +% \else +% \ifx\slot_name\notdef_name\else +% \out_line{(CHARACTER~\vpl_int\slot_number\space +% (COMMENT~\slot_name)} +% \afm_convert\a_dimen=\width\slot_name; +% \out_lline{(CHARWD~\vpl_real\a_dimen)} +% \afm_convert\a_dimen=\height\slot_name; +% \out_lline{(CHARHT~\vpl_real\a_dimen)} +% \afm_convert\a_dimen=\depth\slot_name; +% \out_lline{(CHARDP~\vpl_real\a_dimen)} +% \afm_convert\a_dimen=\italic\slot_name; +% \ifnum\a_dimen>0 \out_lline{(CHARIC~\vpl_real\a_dimen)} \fi +% \global\prev_mapfont=0 \out_lline{(MAP} +% \mapcommands\slot_name +% \out_llline{)} +% \fi +% \fi +% } +%</obsolete> +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\gobble_setslot} +% \begin{macrocode} +\long\def\gobble_setslot#1\endsetslot{\endsetslot} +% \end{macrocode} +% \changes{1.901}{1999/03/27}{Made \cs{gobble_setslot} a \cs{long} +% macro. (LH)} +% \end{macro} +% +% \begin{macro}{\end_do_character} +% \begin{macrocode} +\def\end_do_character{ + \ifisglyph\slot_name\then + \out_lline{)} + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\notdef_name} +% \begin{macrocode} +\def\notdef_name{.notdef} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Slot commands that put things in a character property list} +% +% Here follows the active definitions for those slot commands that +% causes things to be put in |CHARACTER| property lists. +% +% \begin{macro}{\vpl_nextlarger} +% |\vpl_nextlarger|\marg{name} produces a |NEXTLARGER| entry. +% \begin{macrocode} +\def\vpl_nextlarger#1{ + \get_slot_num{#1} + \ifnum -1<\result + \out_lline{(NEXTLARGER~D~\the\result)~(COMMENT~#1)} + \else + \immediate\write16{Warning:~\string\nextlarger\space + for~unknown~slot~`#1'} + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vpl_varchar} +% \begin{macro}{\end_vpl_varchar} +% |\vpl_varchar| \meta{varchar commands} |\end_vpl_varchar| produces +% a |VARCHAR| entry. +% +% \begin{macrocode} +\def\vpl_varchar{\out_lline{(VARCHAR}} +% \end{macrocode} +% \begin{macrocode} +\def\end_vpl_varchar{\out_llline{)}} +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% \begin{macro}{\vpl_vartop} +% \begin{macrocode} +\def\vpl_vartop#1{ + \get_slot_num{#1} + \ifnum -1<\result + \out_llline{(TOP~D~\the\result)~(COMMENT~#1)} + \else + \immediate\write16{Warning:~\string\vartop\space + for~unknown~slot~`#1'} + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vpl_varmid} +% \begin{macrocode} +\def\vpl_varmid#1{ + \get_slot_num{#1} + \ifnum -1<\result + \out_llline{(MID~D~\the\result)~(COMMENT~#1)} + \else + \immediate\write16{Warning:~\string\varmid\space + for~unknown~slot~`#1'} + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vpl_varbot} +% \begin{macrocode} +\def\vpl_varbot#1{ + \get_slot_num{#1} + \ifnum -1<\result + \out_llline{(BOT~D~\the\result)~(COMMENT~#1)} + \else + \immediate\write16{Warning:~\string\varbot\space + for~unknown~slot~`#1'} + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vpl_varrep} +% \begin{macrocode} +\def\vpl_varrep#1{ + \get_slot_num{#1} + \ifnum -1<\result + \out_llline{(REP~D~\the\result)~(COMMENT~#1)} + \else + \immediate\write16{Warning:~\string\varrep\space + for~unknown~slot~`#1'} + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Saved map commands} +% +% The following commands (and |\vpl_scale|, which is defined above) can +% be used in the \meta{mapcommands} glyph parameter. +% +% \begin{macro}{\vpl_raw} +% This macro writes the entries in a \texttt{MAP} that are needed for +% the given raw character. Note that the `at' comment below gives the +% scaling relative to the atsize of the virtual font, not the physical +% atsize. +% \IndexEntry{\LevelSame{PL properties:}^^A +% \LevelSorted{SELECTFONT}{\texttt{SELECTFONT}}^^A +% }{usage}{\thepage} +% \begin{macrocode} +\def\vpl_raw#1#2#3{ + \global\next_mapfont=\csname\the\mapfont_scaling-#1\endcsname + \ifnum \next_mapfont=\prev_mapfont \else + \out_llline{(SELECTFONT~\vpl_int\next_mapfont)~ + (COMMENT~#1~at~ + \expandafter\lose_measure \the\mapfont_scaling)} + \fi + \out_llline{(SETCHAR~D~#2)~(COMMENT~#3)} + \global\prev_mapfont=\next_mapfont +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vpl_rule} +% \begin{macrocode} +\def\vpl_rule#1#2{ + \a_dimen=\make_factor{#2}\mapfont_scaling + \b_dimen=\make_factor{#1}\mapfont_scaling + \out_llline{(SETRULE~\vpl_real\a_dimen\space\vpl_real\b_dimen)} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\vpl_special} +% \begin{macro}{\vpl_warning} +% \begin{switch}{warningspecials} +% \changes{1.913}{2000/02/26}{Switch controlling whether +% \cs{glyphwarning}s should put \texttt{SPECIALS} in the VPL was +% added. (LH)} +% \begin{macrocode} +\def\vpl_special#1{ + \out_llline{(SPECIAL~#1)}} +% \end{macrocode} +% \begin{macrocode} +\def\vpl_warning#1{ + \ifwarningspecials + \out_llline{(SPECIAL~Warning:~#1)} + \fi + \immediate\write16{Warning:~#1.} +} +% \end{macrocode} +% \begin{macrocode} +\newif\ifwarningspecials +\warningspecialstrue +% \end{macrocode} +% \end{switch}\end{macro}\end{macro} +% +% \begin{macro}{\vpl_movert} +% \begin{macro}{\vpl_moveup} +% \begin{macrocode} +\def\vpl_movert#1{ + \a_dimen=\make_factor{#1}\mapfont_scaling + \out_llline{(MOVERIGHT~\vpl_real\a_dimen)} +} +% \end{macrocode} +% \begin{macrocode} +\def\vpl_moveup#1{ + \a_dimen=\make_factor{#1}\mapfont_scaling + \out_llline{(MOVEUP~\vpl_real\a_dimen)} +} +% \end{macrocode} +% \end{macro} \end{macro} +% +% \begin{macro}{\vpl_push} +% \begin{macro}{\vpl_pop} +% \begin{macrocode} +\def\vpl_push{\out_llline{(PUSH)}} +% \end{macrocode} +% \begin{macrocode} +\def\vpl_pop{\out_llline{(POP)}} +% \end{macrocode} +% \end{macro} \end{macro} +% +% +% \subsection{Tidying up} +% +% \begin{macro}{\make_tidy} +% If a VPL file was written, the tidying up consists of clearing the +% list of mapfont numbers, since that is stored globally. If a PL +% file was written, the tidying up consists of writing a +% \texttt{DESIGNUNITS} property for those fonts which need one. +% \begin{macrocode} +\def\make_tidy#1{ + \tidying_up_hook + \if_including_map_ + \a_count=0 + \loop\ifnum \a_count<\font_count + \edef\a_macro{\csname~f-\the\a_count\endcsname} + \global\x_cs\let\a_macro\x_relax + \advance\a_count by 1 + \repeat + \global\font_count=0 + \else + \ifdim \rawfont_scaling<\z@ + \fontinstwarning{ETX~to~(V)PL}{The~font~ + \out_filename\space doesn't~contain~any~characters} + \global\rawfont_scaling=\p@ + \fi + \ifdim \rawfont_scaling=\p@ \else + \out_line{(DESIGNUNITS~\vpl_real\rawfont_scaling)} + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \section{Font installation commands and \texttt{.fd} files} +% +% \DescribeMacro{\installfonts} +% \DescribeMacro{\endinstallfonts} +% The call +% \begin{quote} +% |\installfonts| \meta{install commands} |\endinstallfonts| +% \end{quote} +% is the top-level interface for installing a number of fonts +% and creating |.fd| files for them. +% +% \DescribeMacro{\installfamily} +% \DescribeMacro{\installfont} +% \DescribeMacro{\installrawfont} +% The \meta{install commands} are: +% \begin{isyntax} +% |\installfamily|\marg{encoding}\marg{family}\marg{FD-commmands}\\ +% |\installfont|\marg{font-name}\marg{file-list}\marg{etx}\penalty0 +% \marg{encoding}\marg{family}\marg{series}\marg{shape}\marg{size}\\ +% |\installrawfont|\marg{font-name}\marg{file-list}\marg{etx}^^A +% \penalty0 +% \marg{encoding}\marg{family}\marg{series}\marg{shape}\marg{size}\\ +% |\installfontas|\marg{font-name}\penalty0\marg{encoding}^^A +% \marg{family}\marg{series}\marg{shape}\marg{size} +% \end{isyntax} +% +% Each |\installfamily| command causes the generation of an |.fd| file +% for \meta{encoding} and \meta{family}, which is writen out by the time +% |\endinstallfonts| is processed. +% +% Each |\installfont| generates a |.vpl| font by calling |\etxtovpl| +% and adds an |.fd| entry. +% Each |\installrawfont| generates a ligfull |.pl| font by calling +% |\etxtopl| and adds an |.fd| entry. (Raw |.pl| fonts, containing only +% the glyph metrics without any ligaturing or kerning information, +% are also generated by |\mtxtopl| called from |\transformfont| +% statements.) +% +% \changes{1.912}{2000/01/15}{\cs{install}\dots\ commands updated to +% set \cs{setsomething_global} to \cs{global} around themselves. This +% reduces problems with assignments ``not working'' due to the +% unintuitive grouping. (LH) Problem pointed out by Hilmar +% Schlegel, , and others.} +% +% \begin{macro}{\installfonts} +% Initializes the |\family_toks| token register, which is used to store +% the information which is written out to |.fd| files at the end of the +% job. +% +% \begin{macrocode} +\newtoks\family_toks +\def\installfonts{ + \bgroup + \global\family_toks={} + \gdef\prev_file_list{} + \global\let\setsomething_global=\global +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\installfamily} +% |\installfamily|\marg{encoding}\marg{family}\marg{FD-commmands} +% +% Adds the command +% \begin{quote} +% |\fd_family|\marg{encoding}\marg{family}\marg{FD-commmands} +% \end{quote} +% to the token list |\family_toks| and defines a macro +% |\|\meta{encoding}|-|\meta{family}.^^A +% \describecsfamily{\meta{encoding}-\meta{family}} +% +% \begin{macrocode} +\def\installfamily#1#2#3{ + \global\family_toks= + \expandafter{\the\family_toks\fd_family{#1}{#2}{#3}} + \global\x_cs\let{#1-#2}\empty_command +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\installfont} +% \begin{macro}{\installrawfont} +% \changes{1.904}{1999/06/16}{Added \cs{record_usage}. (LH)} +% \multchanges{\cs{installfont}\cs{installrawfont}}{1.913}{2000/03/21} +% {Moved some code from \cs{install_font} to these commands. (LH)} +% |\installfont|\marg{font-name}\marg{file-list}\marg{etx}\\ +% \vadjust{}\qquad \marg{encoding}\marg{family}\marg{series}^^A +% \marg{shape}\marg{size}\\ +% |\installrawfont|\marg{font-name}\marg{file-list}\marg{etx}\\ +% \vadjust{}\qquad \marg{encoding}\marg{family}\marg{series}^^A +% \marg{shape}\marg{size} +% +% \begin{macrocode} +\def\installfont#1#2#3#4#5#6#7#8{ + \global\let\setsomething_global=\x_relax + \input_metrics{}{#2} + \etxtovpl{#3}{#1} + \installfontas{#1}{#4}{#5}{#6}{#7}{#8} + \global\let\setsomething_global=\global +} +\def\installrawfont#1#2#3#4#5#6#7#8{ + \global\let\setsomething_global=\x_relax + \xdef\out_filename{#1} + \input_metrics{\let\storemapdata=\installraw_storemap}{#2} + \let\storemapdata=\gobble_three + \etxtopl{#3}{#1} + \record_usage{#1} + \installfontas{ + \ifdim \rawfont_scaling=\p@ \else + [\expandafter\lose_measure\the\rawfont_scaling]~ + \fi #1 + }{#4}{#5}{#6}{#7}{#8} + \global\let\setsomething_global=\global +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\installraw_storemap} +% The |\installraw_storemap| macro is a definition of |\storemapdata| +% that is used when the metrics for a ligful PL file is being inputed. +% Its job is to write a |\storemapdata| command for this PL to the +% transforms record file if the PL being written does not have the +% same name as the MTX that the metrics are taken from (the +% information is already stored if both files have the same name). +% |\out_filename| is prematurely set by |\installrawfont| (i.e., long +% before the PL file is actually opened) so that it can be used in +% comparing the file names. +% \changes{1.913}{1999/03/23}{Macro added. (LH)} +% \begin{macrocode} +\def\installraw_storemap#1#2#3{ + \def\a_macro{#1} + \ifx \a_macro\out_filename \else + \record_transform{\out_filename}{\string\frommtx{#1}}{}\if_false + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\input_metrics} +% The |\input_metrics| macro takes a comma-separated list of metric +% files as its second argument and sees to that exactly these metrics +% are loaded. If the list is identical to that used in the last call +% to |\input_metrics|, then this is already the case and +% |\input_metrics| simply refrains from flushing those previous +% metrics from \TeX's memory. Otherwise it closes a group (flushing +% the metrics from a previous call), opens a group (so that these +% metrics can be flushed at the next |\installfont| or +% |\installrawfont| command, if necessary), and starts inputting the +% metrics files in question. +% +% The first argument consists of code that will be executed after the +% group has been closed and opened, but before any metrics is inputed. +% \changes{1.900}{1999/02/13} +% {Use \cs{process_csep_list} for file-list. (LH)} +% \changes{1.914}{2000/05/26}{Redefined to suite \cs{file_list_metrics}. +% In particular, there will now be a comma at the end of +% \cs{curr_file_list} and \cs{prev_file_list}. (LH)} +% \begin{macrocode} +\def\input_metrics#1#2{ + \let\metrics=\file_list_metrics + \xdef\curr_file_list{#2,} + \let\metrics=\x_relax + \ifx\prev_file_list\curr_file_list\else + \egroup\bgroup + #1 + \expandafter\process_csep_list \expandafter\input_mtx_file + \curr_file_list\process_csep_list, + \global\let\prev_file_list=\curr_file_list + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\file_list_metrics} +% The |\file_list_metrics| macro is a definition of |\metrics| that +% is used in the \meta{file-list} argument of |\install|\-|font| and +% |\install|\-|raw|\-|font| when that is |\xdef|ed by |\input_metrics|. +% This special definition prevents the succeeding \meta{metric +% commands} from getting expanded. +% \changes{1.914}{2000/05/26}{Macro added. (LH)} +% \begin{macrocode} +\def\file_list_metrics#1,{ + \iffalse{\fi} + \a_toks=\expandafter{\curr_file_list\x_relax#1,} + \xdef\curr_file_list{\the\a_toks \iffalse}\fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\installfontas} +% The |\installfontas| command has the syntax +% \begin{isyntax} +% |\installfontas|\marg{font-info}\marg{encoding}\marg{family}^^A +% \penalty0\marg{series}\penalty0\marg{shape}\penalty0\marg{size} +% \end{isyntax} +% The precise definition of a \meta{font-info} can be found in +% \cite[Sec.~4]{fntguide}, here it suffices to say that a font name +% (name of (V)PL file) is a valid \meta{font-info}. The |\installfontas| +% command adds an entry for the \meta{font-info} font to a font +% definition file, giving it the NFSS attributes \meta{encoding}^^A +% \texttt{/}\nolinebreak[1]\meta{family}\texttt{/}\nolinebreak[1]^^A +% \meta{series}\texttt{/}\nolinebreak[1]\meta{shape}\texttt{/}^^A +% \nolinebreak[1]\meta{size}. The substitution mechanism will act on +% \meta{series} and \meta{shape}, and it is therefore possible that +% \meta{font-info} will appear in more than one |\Declare|\-|Font|\-^^A +% |Shape| command. \meta{size} can be either some \meta{size-infos}, +% as defined in \cite[Sec.~4]{fntguide}, or a \package{fontinst} +% shorthand for a such, declared using |\declaresize|. +% \changes{1.912}{2000/01/16}{Command added. (LH)} +% \changes{1.913}{2000/03/02}{Specification changed to allow +% arbitrary \meta{font-info}s as first argument. (LH)} +% \changes{1.921}{2002/03/27}{Automatically doing an +% \cs{installfamily} if that has not been done. (LH) Suggested +% by Rowland McDonnell.} +% \begin{macrocode} +\def\installfontas#1#2#3#4#5#6{ + \if_undefined{#2-#3-#4-#5}\then + \let\do_shape=\x_relax + \if_undefined{#2-#3}\then + \x_cs\let{#2-#3}\empty_command + \autoinstallfamily{#2}{#3} + \fi + \x_cs\xdef{#2-#3}{ + \csname#2-#3\endcsname + \do_shape{#2}{#3}{#4}{#5} + } + \fi + \let\do_size=\x_relax + \x_cs\xdef{#2-#3-#4-#5}{ + \if_defined{#2-#3-#4-#5}\then + \csname#2-#3-#4-#5\endcsname + \fi + \do_size{#6}{#1} + } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\autoinstallfamily} +% This command is called by |\installfontas| when it is asked to +% install a font for which no |\installfamily| has been given. The +% syntax is +% \begin{quote} +% |\autoinstallfamily|\marg{encoding}\marg{family} +% \end{quote} +% It defaults to calling |\installfamily| in the obvious way, but +% it can be redefined if the user wants something different. +% \changes{1.924}{2003/02/08}{Macro added. (LH)} +% \begin{macrocode} +\def\autoinstallfamily#1#2{\installfamily{#1}{#2}{}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endinstallfonts} +% Finish the installation by processing the |\family_toks| +% token register, which contains the accumulated information +% to be written out to |.fd| files. +% +% \begin{macrocode} +\def\endinstallfonts{ + \global\let\setsomething_global=\x_relax + \let\do_shape=\fd_shape + \let\do_size=\fd_size + \the\family_toks + \global\family_toks{} + \egroup +} +% \end{macrocode} +% \end{macro} +% +% +% The |\installfont| command has traditionally allowed that names of +% base fonts (MTX files) are suffixed by a +% \verb*" scaled "\meta{factor} that would cause the \texttt{rawscale} +% integer to be set and thereby scale everything that was in that base +% font by the said \meta{factor}. There is now a more general approach +% to this. If the control sequence +% \describecsfamily{IFKW-\meta{keyword}}|IFKW-|\meta{keyword} is +% defined then \meta{keyword} may be used as \texttt{scaled} is above; +% this control sequence should grab all the ``arguments'' of the +% keyword, process them as necessary, and end with the |\get_keyword| +% macro so that another keyword may be processed. As a rule, the +% arguments and keywords are delimited from each other by single spaces. +% A macro grabbing an argument grabs also the space after it. The +% \texttt{IFKW} is for \texttt{I}nstall\texttt{F}ont +% \texttt{K}ey\texttt{W}ord. +% +% \changes{1.923}{2002/10/09}{Added support for keywords other than +% \texttt{scaled} in the second argument of \cs{installfont} and +% such. (LH)} +% +% \begin{macro}{\input_mtx_file} +% The |\input_mtx_macro| takes one undelimited argument. It +% interprets this argument as if it was one item in the \meta{file-list} +% argument of |\install|\-|font| or |\install|\-|rawfont|, and does +% the corresponding processing. The argument should be one of the +% following three things: +% \begin{quote} +% \meta{font}\meta{optional modifiers}\\ +% |\metrics| \meta{metric commands}\\ +% \meta{nothing} +% \end{quote} +% If, in the first case, an MTX file for \meta{font} does not +% exist then it is generated on the fly from a corresponding |.pl|, +% |.afm|, or |.vpl| file in the call to |\fromany|. In the second +% case, the \meta{metric commands} simply get executed. In the third +% case, nothing happens. +% +% The \meta{optional modifiers} is either empty or has the form +% \meta{modifier clause}\meta{optional modifiers}. A \meta{modifier +% clause} generally has the form +% \begin{quote} +% \verb*" "\meta{keyword}\verb*" "\meta{argument(s)} +% \end{quote} +% e.g., +% \begin{quote} +% \verb*| scaled |\meta{rawscale factor} +% \end{quote} +% +% \changes{1.904}{1999/06/16}{Now using \cs{fromany} to make an MTX +% file when necessary. Furthermore testing for empty argument using +% \cs{ifx} rather than \cs{if}. (LH)} +% \changes{1.912}{2000/01/15}{Added error message. (LH) Suggested by +% Alexei Kostin.} +% \changes{1.914}{2000/05/26}{Can now accept arbitrary metric +% commands in argument. (LH)} +% \begin{macrocode} +\def\input_mtx_file#1{ + \reset_modifiers_hook + \ifx\x_relax#1\x_relax +% \end{macrocode} +% This tests for an empty argument, but it also lets explicit metric +% commands be executed. +% \begin{macrocode} + \else + \identity_one{\get_file_name #1~}~\par +% \end{macrocode} +% The two spaces have the effect of putting an empty keyword modifier +% last in the \meta{optional modifiers}. If everything is all right +% then this will gobble the |\par|. However, if the user forgot some +% argument of the last keyword then there will be an error message +% when |\get_keyword| will try to grab the next keyword. +% +% If an encoding has been specified then the source file must be a PL +% or VPL file (since these are the only ones for which it makes sense +% to specify an encoding), otherwise we rely on |\fromany| to find a +% font metrics file. +% \changes{1.926}{2003/07/10}{Only looking for PL and VPL files when +% an encoding is specified. (LH)} +% \begin{macrocode} + \ifx \pl_encoding\empty_command + \fromany\file_name + \else + \metrics_given_encoding{\file_name}{\pl_encoding} + \fi + \ifisstr{afm-name}\then + \inputmtx{\str{afm-name}} + \else + \fontinsterror{\string\install...}{ + Font/MTX~file~\file_name\space not found + }{ + You~can~insert~an~\string\inputmtx\space command~here + \messagebreak to~input~some~other~MTX~file~instead. + \ifisint{rawscale}\then \messagebreak + The~requested~raw~scaling~will~then~be~applied~on~that. + \fi + } + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\metrics_given_encoding} +% This macro is a cousin of |\fromany|, for the case that metrics are +% taken from a (V)PL file that furthermore is assigned nonstandard +% metrics. The syntax is +% \begin{quote} +% |\metrics_given_encoding|\marg{font}\marg{etx} +% \end{quote} +% and the generated MTX file is named +% \meta{font}\texttt{-}\meta{etx}\texttt{.mtx} to avoid that it is +% picked up by |\fromany| by mistake. +% \begin{macrocode} +\def\metrics_given_encoding#1#2{ + \x_setstr{afm-name}{#1-#2} + \if_file_exists{#1.pl}\then + \generalpltomtx{#1}{#1-#2}{pl}{#2} + \else + \if_file_exists{#1.vpl}\then + \generalpltomtx{#1}{#1-#2}{vpl}{#2} + \else + \unsetstr{afm-name} + \fi\fi +} +% \end{macrocode} +% \end{macro} +% +% +% \definechange{option-keyword}{1.924}{2002/02/16}{Added mechanism +% for passing options to MTX and ETX files. (LH)} +% +% \begin{macro}{\reset_modifiers_hook} +% The |\reset_modifiers_hook| macro contains code that initialises +% all parameters that are modified by some \meta{modifier clause} to +% their default values. If you need to add some initialisations due +% to that you define additional keywords then you should append +% these initialisations to this macro. +% \usechange{option-keyword} +% \begin{macrocode} +\def\reset_modifiers_hook{ + \unsetint{rawscale} + \let\glyph_name_modifier\identity_one + \let\pl_encoding\empty_command + \let\list_of_options\empty_command +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\get_file_name} +% The macro |\get_file_name| grabs the base font (or other MTX file) +% name and starts the processing of the \meta{optional modifiers}. +% \begin{macrocode} +\def\get_file_name #1~{ + \edef\file_name{#1} + \get_keyword +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\get_keyword} +% \begin{macro}{\gobble_keywords} +% The |\get_keyword| macro expects to be expanded in the context +% \begin{quote} +% |\get_keyword|\,\meta{keyword}\verb*" " +% \end{quote} +% where the \meta{keyword} is a possible keyword. If +% |\IFKW-|\meta{keyword} is defined then the above expands to it, +% otherwise the above expands to an error message followed by a +% |\gobble_keywords|, which will gobble the rest of the list of +% keywords and arguments. +% \begin{macrocode} +\def\get_keyword #1~{ + \if_defined{IFKW-#1}\then + \csname IFKW-#1 \expandafter\endcsname + \else + \fontinsterror{\string\install...}{ + `#1'~is~not~a~defined~keyword + }{ + \error_help_a\messagebreak + Extra~tokens~will~be~flushed. + } + \expandafter\gobble_keywords + \fi +} +% \end{macrocode} +% \begin{macrocode} +\def\gobble_keywords#1\par{} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\IFKW-} +% The empty keyword is used to flag the end of the \meta{optional +% modifiers}. +% \begin{macrocode} +\x_cs\let{IFKW-}=\gobble_keywords +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IFKW-scaled} +% This macro handles grabbing the argument of the traditional +% \texttt{scaled} keyword. +% \changes{1.900}{1999/02/05}{Changed \cs{setint} to \cs{resetint}. +% (LH)} +% \begin{macrocode} +\x_cs\def{IFKW-scaled}#1~{ + \ifnum #1=\one_thousand + \unsetint{rawscale} + \else + \x_resetint{rawscale}{#1} + \fi + \get_keyword +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IFKW-suffix} +% This macro handles grabbing the argument of the \texttt{suffix} +% keyword. The effect of `\texttt{suffix} \meta{suffix}' is that +% \meta{suffix} will be appended to the name of every glyph defined +% by the next MTX file to be read in. +% \begin{macrocode} +\x_cs\def{IFKW-suffix}#1~{ + \def\glyph_name_modifier##1{##1#1} + \get_keyword +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IFKW-encoding} +% \begin{macro}{\pl_encoding} +% This macro handles grabbing the argument of the \texttt{encoding} +% keyword. The effect of `\texttt{encoding} \meta{etx}' is that +% \meta{etx} will be used as encoding when converting a PL or VPL +% file to MTX. |\pl_encoding| is used for storing the argument +% value. Its expansion is normally empty, which means |\fromafm| +% handles locating the metrics file and the encoding used for a PL +% or VPL is determined by its codingscheme. +% \begin{macrocode} +\x_cs\def{IFKW-encoding}#1~{ + \def\pl_encoding{#1} + \get_keyword +} +\let\pl_encoding=\empty_command +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \begin{macro}{\IFKW-option} +% This macro handles grabbing the argument of the \texttt{option} +% keyword. One can test using |\ifoption| whether a particular option +% was specified. +% \usechange{option-keyword} +% \begin{macrocode} +\x_cs\def{IFKW-option}#1~{ + \add_to\list_of_options{\do{#1}} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifoption} +% \usechange{option-keyword} +% \begin{macro}{\list_of_options} +% \usechange{option-keyword} +% The |\ifoption| command is used to test whether a particular option +% is present on the list of options. The syntax is +% \begin{quote} +% |\ifoption|\marg{string}|\then| +% \end{quote} +% and it is tested whether the \meta{string} was one of the options +% given. Like strings in general, the \meta{string} is expanded +% before it is compared to the options listed in |\list_of_options|. +% +% The |\list_of_options| is a sequence of items on the form +% \begin{quote} +% |\do|\marg{option} +% \end{quote} +% where each \meta{option} is an already expanded string of +% characters. +% \begin{macrocode} +\def\ifoption#1\then{ + \_a_false + \edef\a_macro{#1} + \def\do##1{ + \if_a_ \else + \def\b_macro{##1} + \ifx \a_macro\b_macro \_a_true \fi + \fi + } + \list_of_options + \if_a_ +} +%</pkg> +%<*doc> +\def\ifoption#1\then{% + \generic@if{option \TypesetStringExpression{#1}}% +} +%</doc> +%<*pkg> +\let\list_of_options\empty_command +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \subsection{Writing font definition files} +% +% \begin{macro}{\fd_family} +% |\fd_family{ENCODING}{FAMILY}{FD-COMMANDS}| +% +% Writes out an |.fd| file for the specified |ENCODING| and |FAMILY| +% processing the accumulated information and default substitutions. +% +% \begin{macrocode} +\def\fd_family#1#2#3{ + \a_toks{#3} + \edef\lowercase_file{\lowercase{ + \edef\noexpand\lowercase_file{#1#2.fd}}} + \lowercase_file + \open_out{\lowercase_file} + \out_line{\percent_char~Filename:~\lowercase_file} + \out_line{\percent_char~Created~by:~tex~\jobname} + \out_line{\percent_char~Created~using~fontinst~v\fontinstversion} + \out_line{} + \out_line{\percent_char~THIS~FILE~SHOULD~BE~PUT~IN~A~TEX~INPUTS~ + DIRECTORY} + \out_line{} + \out_line{\string\ProvidesFile{\lowercase_file}} + \out_lline{[ + \the\year/ + \ifnum10>\month0\fi\the\month/ + \ifnum10>\day0\fi\the\day\space + Fontinst~v\fontinstversion\space + font~definitions~for~#1/#2. + ]} + \out_line{} + \out_line{\string\DeclareFontFamily{#1}{#2}{\the\a_toks}} + { + \csname #1-#2\endcsname + \out_line{} + \let\do_shape=\substitute_shape + \csname #1-#2\endcsname + \let\do_shape=\remove_shape + \csname #1-#2\endcsname + } + \x_cs\g_let{#1-#2}\x_relax + \out_line{} + \out_line{\string\endinput} + \close_out{Font~definitions} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fd_shape} +% |\fd_shape{ENCODING}{FAMILY}{SERIES}{SHAPE}| +% +% \begin{macrocode} +\def\fd_shape#1#2#3#4{ + \out_line{} + \out_line{\string\DeclareFontShape{#1}{#2}{#3}{#4}\left_brace_char} + \csname #1-#2-#3-#4\endcsname + \x_cs\g_let{#1-#2-#3-#4}\empty_command + \out_line{\right_brace_char{}} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\fd_size} +% |\fd_size{SIZE}{FONT-NAME}| +% +% \begin{macrocode} +\def\fd_size#1#2{ + \x_cs\ifx{siz-#1}\x_relax + \out_lline{#1~#2} + \else + \out_lline{\csname siz-#1\endcsname\space #2} + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\remove_shape} +% |\remove_shape{ENCODING}{FAMILY}{SERIES}{SHAPE}| +% +% \begin{macrocode} +\def\remove_shape#1#2#3#4{ + \x_cs\g_let{#1-#2-#3-#4}\x_relax +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\substitute_shape} +% |\substitute_shape{ENCODING}{FAMILY}{SERIES}{SHAPE}| +% +% \begin{macrocode} +\def\substitute_shape#1#2#3#4{ + \edef\orig_shape{#4} + \substitute_series{#1}{#2}{#3}{\orig_shape} + \x_cs\ifx{sub-\orig_shape}\x_relax\else + \edef\subst_shape{\csname sub-\orig_shape\endcsname} + \x_cs\ifx{#1-#2-#3-\subst_shape}\x_relax + \out_line{ + \string\DeclareFontShape{#1}{#2}{#3}{\subst_shape}{ + <->\csname typ-\orig_shape\endcsname\space + *~#2/#3/\orig_shape + }{} + } + \x_cs\let{#1-#2-#3-\subst_shape}\empty_command + \substitute_shape{#1}{#2}{#3}{\subst_shape} + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\substitute_series} +% |\substitute_series{ENCODING}{FAMILY}{SERIES}{SHAPE}| +% +% \begin{macrocode} +\def\substitute_series#1#2#3#4{ + \edef\orig_series{#3} + \x_cs\ifx{sub-\orig_series}\x_relax\else + \edef\subst_series{\csname sub-\orig_series\endcsname} + \x_cs\ifx{#1-#2-\subst_series-#4}\x_relax + \out_line{ + \string\DeclareFontShape{#1}{#2}{\subst_series}{#4}{ + <->\csname typ-\orig_series\endcsname\space + *~#2/\orig_series/#4 + }{} + } + \x_cs\let{#1-#2-\subst_series-#4}\empty_command + \substitute_series{#1}{#2}{\subst_series}{#4} + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \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} +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +\substitutesilent{bx}{b} +\substitutesilent{b}{bx} +\substitutesilent{b}{sb} +\substitutesilent{b}{db} +\substitutesilent{m}{mb} +\substitutesilent{m}{l} +% \end{macrocode} +% \begin{macrocode} +\substitutenoisy{ui}{it} +% \end{macrocode} +% +% I don't think we want these since in OT1 encoding it will +% cause the old |<sterling>| vs |<dollar>| problem. (ASAJ) +% --- Oh yes we do. (SPQR) +% +% \begin{macrocode} +\substitutesilent{sl}{it} +\substitutesilent{it}{sl} +% \end{macrocode} +% +% +% \subsection{The font substitution mechanism} +% +% \textbf{Note:} This subsection contains (part of) a new implementation +% of the font substitution mechanism, but it is uncertain whether it +% will ever be completed. +% \begin{macrocode} +%<*underconstruction> +% \end{macrocode} +% +% +% \subsubsection{The substitution graph} +% +% Which substitutions are performed are determined by the substitution +% graph. The vertices of this graph are all combinations of a series and +% a shape. The arcs (directed edges) of this graph are the substitutions +% that can be made. Each arc has a wheight---a real number in the range +% $[0,1]$---that describes how much of the quality of the font that is +% preserved with this substitution. +% +% As an example, consider the case that there is an arc from \texttt{m/it} +% to \texttt{m/sl} and that the wheight of this arc is $0.5$. This means +% that it is OK to substitute the medium italic (\texttt{m/it}) font as a +% medium slanted (\texttt{m/sl}) font if there is no medium slanted font, +% but that the medium italic font is only considered as being half +% ($0.5$) as good a medium slanted font as it is a medium italic font. +% +% The main problem the substitution mechanism has to solve in this +% context is to find the best possible way of substituting a font, given +% the real fonts which has actually been installed (using |\installfont| +% or |\installrawfont|). The solution to this problem is computed by a +% brute force approach---all possible substitution paths are followed +% and during this process the best solution so far, for each vertex +% separately, is stored. +% \medskip +% +% In practice, the substitution graph $G$ is constructed as the cartesian +% product of one graph $G\sb{1}$ of series substitutions and one graph +% $G\sb{2}$ of shape substitutions, with the option of adding some +% additional arcs to this product. The reason for this is that one +% usually wants to make the same shape substitutions in all series and +% vice versa, so by only storing the $G\sb{1}$ and $G\sb{2}$ graphs, plus +% perhaps a handfull of extra edges, one gets away with using fewer +% tokens. +% The wheights of the arcs are stored as integers in the range 0--1000, +% where 0 means the real number $0$ and 1000 means the real number $1$. +% \medskip +% +% \DescribeMacro\do_arc +% The |\do_arc| macro is probably the most common in the data +% structures that constitute the substitution graph. Its syntax is +% always +% \begin{quote} +% |\do_arc|\marg{series}\marg{shape}\marg{wheight} +% \end{quote} +% but it is meant to be redefined whenever one needs to do something +% ``for all arcs'' (usually all arcs at a given vertex or so). There are +% three families of macros which consist of |\do_arc| lists, namely +% \begin{quote} +% |\sub1-|\meta{series}\\ +% |\sub2-|\meta{shape}\\ +% |\sub-|\meta{series}|-|\meta{shape} +% \end{quote} +% These macros store arcs going out from a vertex. The +% |\sub1-|\meta{series} macross store the arcs incident with the vertex +% \meta{series} in the series substitution graph $G\sb{1}$. The +% |\sub2-|\meta{shape} macros store the arcs incident with the vertex +% \meta{shape} in the shape substitution graph $G\sb{2}$. The +% |\sub-|\meta{series}|-|\meta{shape} macros store the arcs of $G$ that +% are incident with the vertex \meta{series}|/|\meta{shape} but do +% \emph{not} appear in the cartesian product $G\sb{1} \times G\sb{2}$. +% +% The \meta{series} and \meta{shape} arguments of |\do_arc| tells which +% vertex the arc goes to, hence for example |\do_arc{b}{it}{600}| in the +% macro |\sub-db-sl| corresponds to an arc going from the |db/sl| vertex +% to the |b/it| vertex and having a wheight of $0.6$. +% +% \DescribeMacro\curr_series +% \DescribeMacro\curr_shape +% The above omits one important detail, namely that the \meta{shape} +% argument for a |\do_arc| in a |\sub1-|\textellipsis\ must be able to +% be \emph{all} shapes since the shape is not determined for arcs in +% $G\sb{1}$ and the series is likewise for arcs in $G\sb{2}$. To make things +% work anyway, there are two macros |\curr_series| and |\curr_shape| +% which contain this missing information. Furthermore, a |\do_arc| item +% for an arc in $G\sb{1}$ will always have the structure +% \begin{quote} +% |\do_arc|\marg{series}|\curr_shape|\marg{wheight} +% \end{quote} +% and a |\do_arc| item for an arc in $G\sb{2}$ will have the structure +% \begin{quote} +% |\do_arc\curr_series|\marg{shape}\marg{wheight} +% \end{quote} +% +% +% \begin{macro}{\substituteshape} +% \begin{macro}{\substituteseries} +% \begin{macro}{\substituteseriesshape} +% |\substituteshape|\marg{to}\marg{from}\marg{wheight}\\ +% |\substituteseries|\marg{to}\marg{from}\marg{wheight}\\ +% |\substituteseriesshape|\marg{toseries}\marg{toshape}^^A +% \marg{fromseries}\marg{fromshape}\marg{wheight} +% +% \begin{macrocode} +\def\substituteshape#1#2#3{ + \round_wheight{#3} + \edef\temp_command{#1} + \edef\sub_suffix{#2} + \ifx \temp_command\sub_suffix \else + \def\sub_suffix##1##2{2-##2} + \def\do_arc##1##2##3{ + \x_cs\ifx{sub2-##2}R \else + \noexpand\do_arc\noexpand\curr_series{##2}{##3} + \fi + } + \update_do_arc_list{}{#2}{}{#1}{\noexpand\curr_series{#1}} + \fi +} +% \end{macrocode} +% \begin{macrocode} +\def\substituteseries#1#2#3{ + \round_wheight{#3} + \edef\temp_command{#1} + \edef\sub_suffix{#2} + \ifx \temp_command\sub_suffix \else + \def\sub_suffix##1##2{1-##1} + \def\do_arc##1##2##3{ + \x_cs\ifx{sub1-##1}R \else + \noexpand\do_arc{##1}\noexpand\curr_shape{##3} + \fi + } + \update_do_arc_list{#2}{}{#1}{}{{#1}\noexpand\curr_shape} + \fi +} +% \end{macrocode} +% \begin{macrocode} +\def\substituteseriesshape#1#2#3#4#5{ + \round_wheight{#5} + \edef\temp_command{#1-#2} + \edef\sub_suffix{#3-#4} + \ifx \temp_command\sub_suffix \else + \def\sub_suffix##1##2{-##1-##2} + \def\do_arc##1##2##3{ + \x_cs\ifx{sub-##1-##2}R \else + \noexpand\do_arc{##1}{##2}{##3} + \fi + } + \update_do_arc_list{#3}{#4}{#1}{#2}{{#1}{#2}} + \fi +} +% \end{macrocode} +% \begin{macrocode} +\def\round_wheight#1{ + \eval_expr{#1} + \ifnum \one_thousand<\result + \result=\one_thousand + \else \ifnum 0>\result + \result=\z@ + \fi\fi +} +% \end{macrocode} +% +% |\update_do_arc_list|\marg{update-series}\marg{update-shape}^^A +% \allowbreak\marg{tag-series}\allowbreak\marg{tag-shape}^^A +% \allowbreak\marg{inserted series+shape} +% +% \begin{macrocode} +\def\update_do_arc_list#1#2#3#4#5{ + \bgroup + \edef\temp_command{sub\sub_suffix{#1}{#2}} + \x_cs\let{sub\sub_suffix{#3}{#4}}=R + \x_cs\xdef\temp_command{ + \x_cs\ifx\temp_command\relax \else + \csname\temp_command\endcsname + \fi + \ifnum 0<\result + \noexpand\do_arc #5{\the\result} + \fi + } + \egroup +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% +% \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{ + \substituteseries{#1}{#2}{900} + \substituteshape{#1}{#2}{900} +} +\def\substitutenoisy#1#2{ + \substituteseries{#1}{#2}{500} + \substituteshape{#1}{#2}{500} +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +\a_count=900 % Silent substitution wheight +\b_count=500 % Noisy substitution wheight +\substituteseries{bx}{b}{\a_count} +\substituteseries{b}{bx}{\a_count} +\substituteseries{b}{sb}{\a_count} +\substituteseries{b}{db}{\a_count} +\substituteseries{m}{mb}{\a_count} +\substituteseries{m}{l}{\a_count} +% \end{macrocode} +% \begin{macrocode} +\substituteshape{ui}{it}{\b_count} +% \end{macrocode} +% +% I don't think we want these since in OT1 encoding it will +% cause the old |<sterling>| vs |<dollar>| problem. (ASAJ) +% --- Oh yes we do. (SPQR) +% +% \begin{macrocode} +\substituteshape{sl}{it}{\a_count} +\substituteshape{it}{sl}{\a_count} +% \end{macrocode} +% +% +% \subsubsection{Listing reachable vertices} +% +% While determining the optimal substitutions, there is a need to store +% some---more or less temporary---information for each vertex. Such +% information will be called a \emph{property} of the vertex and it is +% stored in the |\v-|\meta{series}|-|\meta{shape} family of macros. +% +% The following are the basic properties: +% \begin{list}{}{^^A +% ^^A How does one make the label go on a line of its own?? +% } +% \item[\cs{real_font}\marg{quality}] +% This expresses that this vertex corresponds to a font that has +% actually been installed with a nominal quality of \meta{quality}. +% \item[\cs{subs_font}\marg{series}\marg{shape}\marg{quality}] +% This expresses that this vertex corresponds to a font for which +% the font \meta{series}|/|\meta{shape} has been substituted. +% \meta{quality} is the quality this substitution is considered to +% have. +% \item +% \end{list} +% +% +% There will also be some lists of vertices. These will consist of simple +% |\do|\marg{series}\marg{shape} triples. +% +% \begin{macrocode} +\def\list_subs_vertices{ + \def\subs_vertex_list{} + \let\do_arc=\subs_do_arc + \let\do=\never_do + \def\real_font##1{\c_count=\@MM} + \def\subs_font##1##2##3{\c_count=##3\relax} + \real_vertex_list +} +\def\subs_do_arc#1#2#3{ + \b_count=#3 + \multiply \b_count \a_count + \divide \b_count \one_thousand + \c_count=-\max_mathchardef + \csname v-#1-#2\endcsname + \ifnum \c_count<\b_count + \ifnum \c_count=-\max_mathchardef + \edef\subs_vertex_list{\subs_vertex_list\do{#1}{#2}} + \fi + \x_cs\edef{v-#1-#2}{\noexpand\subs_font{\subs_series} + {\subs_shape}{\the\b_count}} + \toks_a=\expandafter{\the\a_toks \do_subs{#1}{#2}} + \fi +} +\def\do_subs#1#2{ + \edef\curr_series{#1} + \edef\curr_shape{#2} + \csname v-#1-#2\endcsname + \a_count=\c_count + \a_toks={} + \csname sub-#1-#2\endcsname + \csname sub1-#1\endcsname + \csname sub2-#2\endcsname + \the\a_toks +} +\def\start_subs_at#1#2{ + \edef\subs_series{#1} \let\curr_series=\subs_series + \edef\subs_shape{#2} \let\curr_shape=\subs_shape + \a_count=\x_cs\second_of_two{v-#1-#2} + \a_toks={} + \csname sub-#1-#2\endcsname + \csname sub1-#1\endcsname + \csname sub2-#2\endcsname + \the\a_toks +} +% \end{macrocode} +% +% +% \begin{macrocode} +%</underconstruction> +% \end{macrocode} +% +% +% \subsection{Default encodings and font sizes} +% +% \begin{macro}{\declareencoding} +% |\declareencoding{CODINGSCHEME}{ENCODING}| +% +% Declare a macro |\enc-CODINGSCHEME| which expands to |ENCODING|. +% This is used to determine the encoding in |\pltomtx|. +% \changes{1.927}{2004/07/31}{Lowercased encoding file names. (LH)} +% +% \begin{macrocode} +\def\declareencoding#1#2{\x_cs\edef{enc-#1}{#2}} +% \end{macrocode} +% \end{macro} +% +% Old \TeX{} text font encodings. +% \begin{macrocode} +\declareencoding{TEX~TEXT}{ot1} +\declareencoding{TEX~TEXT~WITHOUT~F-LIGATURES}{ot1} +\declareencoding{TEX~TYPEWRITER~TEXT}{ot1tt} +% \end{macrocode} +% +% Old \TeX{} math font encodings. +% \begin{macrocode} +\declareencoding{TEX~MATH~ITALIC}{oml} +\declareencoding{TEX~MATH~SYMBOLS}{oms} +\declareencoding{TEX~MATH~EXTENSION}{omx} +\declareencoding{LATEX~SYMBOLS}{lasy} +% \end{macrocode} +% +% Euler math font encodings. +% \begin{macrocode} +\declareencoding{TEX~TEXT~SUBSET}{eufrak} +\declareencoding{TEX~MATH~ITALIC~SUBSET}{eurm} +\declareencoding{TEX~MATH~SYMBOLS~SUBSET}{euscr} +\declareencoding{EULER~SUBSTITUTIONS~ONLY}{euex} +% \end{macrocode} +% +% New \TeX{} text font encodings. +% \begin{macrocode} +\declareencoding{EXTENDED~TEX~FONT~ENCODING~-~LATIN}{t1} +\declareencoding{TEX~TEXT~COMPANION~SYMBOLS~1---TS1}{ts1} +% \end{macrocode} +% +% Rencoded PostScript font encdings. +% \begin{macrocode} +\declareencoding{TEXBASE1ENCODING}{8r} +\declareencoding{TEX~TYPEWRITER~AND~WINDOWS~ANSI}{8y} +% \end{macrocode} +% +% \begin{macro}{\declaresize} +% |\declaresize{FONTSIZE}{LATEXSIZE}| +% +% \begin{macrocode} +\def\declaresize#1#2{\x_cs\edef{siz-#1}{#2}} +% \end{macrocode} +% \end{macro} +% +% Default sizes. An empty size argument is equivalent to |<->|, +% for use with scalable fonts. +% +% \begin{macrocode} +\declaresize{}{<->} +\declaresize{5}{<5>} +\declaresize{6}{<6>} +\declaresize{7}{<7>} +\declaresize{8}{<8>} +\declaresize{9}{<9>} +\declaresize{10}{<10>} +\declaresize{11}{<10.95>} +\declaresize{12}{<12>} +\declaresize{14}{<14.4>} +\declaresize{17}{<17.28>} +\declaresize{20}{<20.74>} +\declaresize{25}{<24.88>} +% \end{macrocode} +% +% +% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% \section{Debugging} +% +% \begin{macro}{\NOFILES} +% |\NOFILES| switches off file generation, and causes +% \package{fontinst} to only generate empty files. It only affects the +% user level commands, so it is primarily of use when debugging +% commands that build on these, such as for example the +% |\latin|\-|family| command. +% \changes{1.914}{2000/05/20}{Added \cs{reglyphfont}. (LH)} +% \begin{macrocode} +\def\NOFILES{ + \def\transformfont##1##2{ + \touch_file{##1.mtx} + \touch_file{##1.pl} + } + \def\reglyphfont##1##2{\touch_file{##1.mtx}} + \def\installfonts{} + \def\endinstallfonts{} + \def\installfont##1##2##3##4##5##6##7##8{ + \touch_file{##1.vpl} + } + \def\installrawfont##1##2##3##4##5##6##7##8{ + \touch_file{##1.pl} + } + \def\installfamily##1##2##3{\touch_file{##1##2.fd}} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\touch_file} +% \begin{macrocode} +\def\touch_file#1{ + \edef\lowercase_file{\lowercase{ + \edef\noexpand\lowercase_file{#1}}} + \lowercase_file + \open_out{\lowercase_file} + \out_line{\percent_char~TEST~FILE.} + \out_line{\percent_char~Created~whilst~debugging~fontinst.} + \close_out{Test~file} +} +%</pkg> +% \end{macrocode} +% \end{macro} +% +% \Finale +\endinput diff --git a/Master/texmf-dist/source/fontinst/base/fimapgen.dtx b/Master/texmf-dist/source/fontinst/base/fimapgen.dtx new file mode 100644 index 00000000000..bce3a5a99fd --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/fimapgen.dtx @@ -0,0 +1,1533 @@ +% \CheckSum{873} +% \iffalse meta-comment +% +% Copyright 1999 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. +% ----------------------------------------------------- +% +% 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.0 or, at your option, any later version. +% +%%% From file: fimapgen.dtx +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{fisource} + +\title{\texttt{fimapgen.dtx}} +\author{Lars Hellstr\"om} +\begin{document} +\maketitle + +\DocInput{fimapgen.dtx} + +\end{document} +%</driver> +% \fi +% +% +% \section{Generating map file fragments} +% \label{Sec:Mapfiles} +% \changes{1.904}{1999/06/15}{Completed rudimentary map file fragment +% generator, made it part of \texttt{finstmsc.sty}. (LH)} +% \newcommand\OzTeX{O\kern-.03em z\kern-.15em\TeX} +% +% A \emph{map file} is a file which is used by some DVI driver to link +% various kinds of font information to each other, as is needed for the +% driver's operation. Examples of such files are the file +% \texttt{psfonts.map} used by \texttt{dvips} and the config files of +% \OzTeX. There are however many other such files around in the \TeX\ +% world. +% +% Not all of a map file need to be related to linking specific kinds of +% font information to each other. \OzTeX\ config files can for example +% be used to set the values of \TeX\ implementation parameters\footnote +% {The kind of things that were Pascal constants in the original \Web\ +% sources for \TeX.} and there need not be any font-related information +% at all in them. The important thing is however that there can be map +% information in them---that information could be automatically written +% by the routines described here. +% +% Since there may be other kinds of information in these files (and often +% enough need to be for everthing to work right), the routines described +% here will only generate map file \emph{fragments}. These fragments +% will then have to be inserted in the final map files somehow, usually +% through manual editing. The purpose of the routines described here is +% only to save the user a good deal of (often quite boring) typing, not +% to actually install everything where it needs to be. +% +% \StopEventually{} +% +% \begin{macro}{\mapfrags_subsystem} +% This macro holds the name of the automatic map file fragments +% writer subsystem of \package{fontinst}, as it appears in error +% messages. +% \begin{macrocode} +\def\mapfrags_subsystem{Map~fragments~writer} +% \end{macrocode} +% \end{macro} +% +% \subsection{Interface to main \package{fontinst}} +% \label{Ssec:interface} +% +% The automatic generation of map file fragments is based on the two +% commands |\storemapdata| and |\makemapentry|. Their respective +% syntaxes are +% \begin{quote} +% |\storemapdata|\marg{\TeX\ font name}\marg{source}^^A +% \marg{transforms}\\ +% |\makemapentry|\marg{\TeX\ font name} +% \end{quote} +% +% \DescribeMacro{\storemapdata}|\storemapdata| commands are written when +% a metric file \meta{\TeX\ font name}|.mtx| is generated. The purpose +% of these commands is to record where the data for that file came from, +% and what was done to these data. The source of the data is specified +% in the \meta{source} argument, which can contain one of +% \begin{quote} +% |\fromafm|\marg{AFM name}\marg{PS name}\\ +% |\frompl|\marg{PL name}\\ +% |\frommtx|\marg{MTX name}\\ +% |\fromvpl| +% \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 +% 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 +% 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. +% +% What was done to the data is specified by the \meta{transforms} +% argument, which is a possibly empty sequence of commands, in which +% each item is one of +% \begin{isyntax} +% |\transformfont|\marg{x-scale}\marg{slant-scale}\\ +% |\reencodefont|\marg{etx}\\ +% |\reglyphfont| +% \end{isyntax} +% The order is interpreted so that the thing done first appear first in +% the sequence. In normal cases there is at most one of each, and then +% the order is not important. \meta{x-scale}, \meta{slant-scale}, and +% \meta{y-scale} are the values of these variables used for the +% transformation, as \TeX\ numbers. \meta{etx} is the name of the ETX +% file used for the font reencoding. +% |\reglyphfont| is an error marker. It will not be encountered (but +% it may well get stored in some table) unless a metric font transform +% is applied to a font that has been reglyphed, which is illegal. +% +% \changes{1.911}{1999/11/17}{\cs{storemapdata} commands are also +% written to metric files when they are generated. (LH)} +% In addition to being written to a transforms record file (if one is +% open), |\storemapdata| commands are also written to the actual metric +% file. This makes it possible to find out where the data for a file +% comes from even if the file was made on a previous \package{fontinst} +% run, but since it requires reading an additional file just to find one +% command, it will be slower than if the |\storemapdata| appeared in a +% transforms records file. +% +% \DescribeMacro{\makemapentry}|\makemapentry| commands are written when +% a VPL that uses or a ligfull PL for a font is generated. These +% commands are the ones which actually cause the map file fragment +% generator to write an entry, but entries are only written if they +% haven't been written before. |\makemapentry| uses information that +% was stored by a previous call to |\storemapdata|. +% +% |\storemapdata| stores its arguments in one of the control sequences +% \describecsfamily{Tf-\meta{font}}|\Tf-|\meta{font}, where \meta{font} +% is the same thing as \meta{\TeX\ font name} above. |Tf| stands for +% ``\TeX\ font''. The control sequences in this family are paramterless +% macros whose replacement texts have the following form: +% \changes{1.914}{2000/05/30}{Contents of \cs{Tf-\meta{font}} control +% sequences changed to allow processing the same file of recorded +% transformations several times on the same run. (LH)} +% \begin{quote} +% \marg{made}\marg{source}\marg{transforms} +% \end{quote} +% Here \meta{source} and \meta{transforms} are exactly as above. +% \meta{made} is a number which describes the current status of this font. +% If \meta{made} is even then the font has been defined but no entry for +% it has subsequently been written to the map file, whereas if it is odd +% then an entry for it has been written to the map file. If the value of +% \meta{made} is less than |\process_generation| then the data in the +% other two arguments is from a previous run and should be ignored. +% The |\Tf-|\meta{font} control sequences should always be set globally. +% +% \begin{macro}{\process_generation} +% \begin{macro}{\process_generation_succ} +% |\process_generation| is a counter which stores the number of the +% current ``entry generation''. It starts at 0 and is increased by +% two at each |\donedrivers|. |\process_generation_succ| is a macro +% which expands to a number one larger than that in |\process_generation|. +% \multchanges{\cs{process_generation}\cs{process_generation_succ}} +% {1.914}{2000/05/30}{Control sequences added. (LH)} +% \begin{macrocode} +%<*map> +\newcount\process_generation +\process_generation=0 +\def\process_generation_succ{1} +%</map> +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\recordtransforms} +% \begin{macro}{\endrecordtransforms} +% \begin{macro}{\transform_record_file} +% In main \package{fontinst}, the command +% \begin{quote} +% |\recordtransforms|\marg{filename} +% \end{quote} +% starts a block of code within which font transforms will be recorded +% in the file \meta{filename}. |\endrecordtransforms| ends such a block. +% \begin{macrocode} +%<*pkg> +\def\recordtransforms#1{\open_pout\transform_record_file{#1}} +\def\endrecordtransforms{ + \close_pout\transform_record_file{Font~transformation~records} +} +\chardef\transform_record_file=\closed_stream +%</pkg> +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} +% +% +% \begin{macro}{\extract_font_generation} +% The |\extract_font_generation| macro takes the name of a font and +% returns the \meta{made} component from the |\Tf-|\meta{font} macro +% for that font, or minus one if that macro hasn't been defined. +% \changes{1.914}{2000/05/30}{Macro added. (LH)} +% \begin{macrocode} +%<*map> +\def\extract_font_generation#1{ + \if_defined{Tf-#1}\then + \expandafter\expandafter \expandafter\first_of_three + \csname Tf-#1\endcsname + \else + \m@ne + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\storemapdata} +% There should not be two |\storemapdata| for the same font, hence +% the check below. (Note that a `font' in this case is an MTX file. +% It is quite possible (and legal) to generate the PL file for that +% MTX file more than once.) +% \changes{1.927}{2004/07/12}{Improved wording of warning message +% and downgraded it to an info in the case when the two +% definitions are the same. (LH)} +% \begin{macrocode} +\def\storemapdata#1#2#3{ + \expandafter\def \expandafter\a_macro + \expandafter{ \expandafter{ \the\process_generation}{#2}{#3}} + \ifnum \extract_font_generation{#1}<\process_generation \else + \x_cs\ifx{Tf-#1}\a_macro + \fontinstinfo\mapfrags_subsystem + {Repeated~definition~of~font~#1} + \else + \fontinstwarning\mapfrags_subsystem + {Inconsistent~redefinition~of~font~#1} + \fi + \fi + \x_cs\let{Tf-#1}=\a_macro +} +%</map> +% \end{macrocode} +% In main \package{fontinst}, |\storemapdata| should be a noop so +% that it can appear in metric files. +% \begin{macrocode} +%<pkg>\let\storemapdata=\gobble_three +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\record_transform} +% \changes{1.911}{1999/11/18}{\cs{storemapdata} lines are optionally +% written to the main output file as well. (LH)} +% In main \package{fontinst}, the call +% \begin{quote} +% |\record_transform|\marg{TFM name}\marg{source}^^A +% \marg{transforms}\marg{if} +% \end{quote} +% writes +% \begin{quote} +% |\storemapdata|\marg{TFM name}\marg{source}\marg{transforms} +% \end{quote} +% to the transformation recordings file (if font transforms are being +% recorded) and to the main output file (if the \meta{if} evaluates +% to true). Note that the caller of |\record_transform| must see to +% that macros in \meta{source} and \meta{transforms} are written +% correctly to the file (this is usually accomplished by adding +% |\string| in suitable places of these arguments during their +% construction). +% +% \begin{macrocode} +%<*pkg> +\def\record_transform#1#2#3#4{ + \ifnum \transform_record_file=\closed_stream \else + \pout_line\transform_record_file{\string\storemapdata{#1}{#2}{#3}} + \fi + #4 \out_line{\string\storemapdata{#1}{#2}{#3}} \fi +} +%</pkg> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\transformfont} +% \changes{1.913}{2000/03/11}{Third argument removed, since it isn't +% used anymore. This change is harmless, since the worst thing +% that can happen to this argument is that it is typeset. (LH)} +% \begin{macro}{\reencodefont} +% \begin{macro}{\reglyphfont} +% These are initially |\relax|, so they can be |\edef|ed with safely. +% \begin{macrocode} +%<*map> +\let\transformfont\x_relax +\let\reencodefont\x_relax +\let\reglyphfont\x_relax +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% \changes{1.914}{2000/05/30}{The total transform applied for a font is +% determined before the entry makers are called. (LH)} +% \begin{macro}{\makemapentry} +% |\makemapentry| sets |\TeX_font_name|, checks if any map data have +% been stored for the font in question, and passes them on to +% |\make_map_entry| if they have; otherwise it raises an error. There +% is also a group which is begun and ended by |\makemapentry|, to stop +% values deduced for one entry to interfere with the deduction of values +% in the following. +% \changes{1.911}{1999/11/20}{When map data are not known, try to +% get them from the MTX file before declaring the source unknown. +% (LH)} +% \begin{macrocode} +\def\makemapentry#1{\begingroup + \def\TeX_font_name{#1} + \ifnum \extract_font_generation{#1}<\process_generation + \if_file_exists{#1.mtx}\then + \inputmtx{#1} + \fi\fi + \ifnum \extract_font_generation{#1}<\process_generation + \from_unknown{#1} + \x_cs\xdef{Tf-#1}{ + {\process_generation_succ}{\noexpand\from_unknown{#1}}{} + } + \else + \expandafter\expandafter \expandafter\make_map_entry + \csname Tf-#1\endcsname + \fi + \endgroup +} +% \end{macrocode} +% +% \begin{macro}{\make_map_entry} +% |\make_map_entry| oversees the interpretation of the +% \meta{source} part of the map data, something which sets +% |\source_font_TeX_name| and possibly |\PS_font_name|. It also +% collects the transforms applied in |\font_transforms|, +% concatenates them, and calls a list macro |\entry_makers_list| which +% causes the actual entries to be written, and records in +% |\Tf-|\meta{\TeX\ font name} that the entries have been written. +% \begin{macrocode} +\def\make_map_entry#1#2#3{ + \ifnum #1=\process_generation + \def\font_transforms{#3} + #2 + \_a_false + \let\transformfont\concat_transformfont + \let\reencodefont\concat_reencodefont + \let\reglyphfont\_a_true + \font_transforms + \if_a_ + \fontinsterror\mapfrags_subsystem{ + \string\makemapentry\space for~reglyphed~font + }{ No~entry~for~font~\TeX_font_name\space + can~be~written,\messagebreak + since~it~had~been~reglyphed!~\error_help_a + } + \else + \entry_makers_list + \fi + \expandafter\gdef \csname Tf-\TeX_font_name \expandafter\endcsname + \expandafter{\expandafter{\process_generation_succ}{#2}{#3}} + \fi +} +%</map> +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \begin{macro}{\record_usage} +% In main \package{fontinst}, the call +% \begin{quote} +% |\record_usage|\marg{TFM name} +% \end{quote} +% writes +% \begin{quote} +% |\makemapentry|\marg{TFM name} +% \end{quote} +% to the transformation recordings file, if font transforms are being +% recorded. The |\record_usage| command is, roughly speaking, only used +% by |\installfont| and |\installrawfont|. +% \begin{macrocode} +%<*pkg> +\def\record_usage#1{ + \ifnum \transform_record_file=\closed_stream \else + \pout_line\transform_record_file{\string\makemapentry{#1}} + \fi +} +%</pkg> +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\fromafm} +% |\fromafm| saves its two arguments in the suitable string macros. +% \begin{macrocode} +%<*map> +\def\fromafm#1#2{ + \def\source_font_TeX_name{#1} + \def\PS_font_name{#2} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\frompl} +% |\frompl| saves its argument in the suitable string macro. +% \begin{macrocode} +\def\frompl#1{ + \def\source_font_TeX_name{#1} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\frommtx} +% This one is tricky, since it will have to work recursively, +% fetching data that were stored for some other font. If it cannot +% find those data in memory, then it tries to get them from the +% metric file itself. +% \changes{1.911}{1999/11/17}{When map data are not known, try to +% get them from the MTX file before declaring the source unknown. +% (LH)} +% \begin{macrocode} +\def\frommtx#1{% + \ifnum \extract_font_generation{#1}<\process_generation + \if_file_exists{#1.mtx}\then + \inputmtx{#1} + \fi\fi + \ifnum \extract_font_generation{#1}<\process_generation + \from_unknown{#1} + \x_cs\xdef{Tf-#1}{ + {\the\process_generation}{\noexpand\from_unknown{#1}}{} + } + \else + \expandafter\expandafter \expandafter\from_mtx + \csname Tf-#1\endcsname + \fi +} +% \end{macrocode} +% \begin{macro}{\from_mtx} +% \begin{macrocode} +\def\from_mtx#1#2#3{ + \edef\font_transforms{#3\font_transforms} + #2 +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\fromvpl} +% The |\fromvpl| command checks if |\font_transforms| is empty. If it +% is then everything is fine, but no entry should be written for this +% font. If it isn't then someone has tried to make a transformation of +% a virtual font, which doesn't work. +% \begin{macrocode} +\def\fromvpl{ + \ifx \empty_command\font_transforms \else + \fontinsterror\mapfrags_subsystem{ + Font~is~virtual,~it~cannot~be~transformed}{ + No~entry~for~font~\TeX_font_name\space can~be~written. + \messagebreak\error_help_a + } + \fi + \let\maker_do\gobble_one +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\AssumeMetafont} +% The |\AssumeMetafont| general settings command makes |\frompl| +% behave like |\fromvpl|. +% \begin{macrocode} +\def\AssumeMetafont{ + \def\frompl{ + \ifx \empty_command\font_transforms \else + \fontinsterror\mapfrags_subsystem{ + A~Metafont~cannot~be~transformed}{ + No~entry~for~font~\TeX_font_name\space can~be~written. + \messagebreak\error_help_a + } + \fi + \let\maker_do\gobble_one + } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\from_unknown} +% This special value for \meta{source} is used for fonts that are +% referenced by some |\frommtx| but which have no |\storemapdata| +% themselves. +% \begin{macrocode} +\def\from_unknown#1{ + \fontinstwarningnoline\mapfrags_subsystem{ + No~map~data~stored~for~font~#1.\messagebreak + No~entry~for~\TeX_font_name\space will~be~written,\messagebreak + due~to~insufficient~information} + \includewarning\warn_unknown_source + \let\maker_do\gobble_one +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\font_transforms} +% This macro is used to collect all transformations that have been +% applied to a font in, before they are concatenated. +% \begin{macrocode} +\let\font_transforms\empty_command +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\xscale_factor} +% \begin{macro}{\slant_factor} +% \begin{macro}{\reencode_etx} +% |\xscale_factor| and |\slant_factor| are dimens which the entry +% makers can inspect to check the amount of horizontal scaling and +% slanting should be applied to the current font. 1\,pt equals the +% factor~1. +% \begin{quote} +% |\expandafter\lose_measure\the\xscale_factor| +% \end{quote} +% will produce the corresponding factor. +% +% |\reencode_etx| is a macro which contains the name of the (last) +% ETX file used to reencode the font; it is empty if the font hasn't +% been reencoded. +% \multchanges{\cs{xscale_factor}\cs{slant_factor}\cs{reencode_etx}} +% {1.914}{2000/05/30}{Control sequences added. (LH)} +% \begin{macrocode} +\newdimen\xscale_factor \newdimen\slant_factor +\xscale_factor=\p@ \slant_factor=\z@ +\let\reencode_etx\empty_command +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \multchanges{\cs{concat_transformfont}\cs{concat_reencodefont}} +% {1.914}{2000/05/30}{Macros added. (LH)} +% \begin{macro}{\concat_transformfont} +% The |\concat_transformfont| macro is a definition of |\transformfont| +% which concatenates the transformation expressed by the arguments +% with the one in |\xscale_factor| and |\slant_factor|. +% Mathematically, it performs the multiplication +% $$ +% \left( \begin{array}{cc} f(\#1)& f(\#2)\\ 0& 1 \end{array} \right) +% \left( \begin{array}{cc} +% \mbox{\cs{xscale_factor}}& \mbox{\cs{slant_factor}} \\ +% 0& 1 +% \end{array} \right) +% $$ +% where $f$ stands for |\make_factor|. +% \begin{macrocode} +\def\concat_transformfont#1#2{ + \edef\a_macro{\make_factor{#1}} + \xscale_factor=\a_macro\xscale_factor + \slant_factor=\a_macro\slant_factor + \advance \slant_factor \make_factor{#2}\p@ +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\concat_reencodefont} +% The |\concat_reencodefont| macro is a definition of |\reencodefont| +% which concatenates the reencoding expressed by the argument with +% the one in |\reencode_etx|. Since reencoding ignores the previous +% encoding, concatenating is the same thing as remembering the last +% reencoding. +% \begin{macrocode} +\def\concat_reencodefont#1{\def\reencode_etx{#1}} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{User interface} +% +% The basic usage of the automatic map file fragment generator consists +% of specifying for which driver(s) entries should be generated, +% |\input|ing a file of recorded transformations generated by main +% \package{fontinst}, and signaling that there isn't anything more to +% write. This can be done with the commands +% \begin{quote} +% |\adddriver|\marg{driver name}\marg{fragment file name}\\ +% \meta{possible additional \cs{adddriver} commands}\\ +% |\input |\meta{recorded transforms file}\\ +% |\donedrivers|\\ +% |\bye| +% \end{quote} +% It should however be noted that this is the \emph{basic} usage. The +% map fragments that work for one \TeX\ system need not work for +% another (even if the driver is the same), and therefore it is +% necessary to make the whole process of writing map file fragments +% configurable. A few examples of things you may have to inform the map +% fragment writer about are (and these are for \package{dvips} alone; +% that's the driver I know best): +% \begin{itemize} +% \item +% Is the font resident on the printer or must it be downloaded? +% \item +% If the font must be downloaded, what is the name of the file it +% is in? Here one must take into account not only the possibility +% that the font file might have to be shared with some other +% software (such as a GUI) and thus cannot be named according to +% the Berry scheme---even if it is named according to the Berry +% scheme one still has the question of its extension: \texttt{.pfa}, +% \texttt{.pfb}, or something else? For instances of Multiple Master +% fonts, you (at least sometimes) have to download more than one file. +% \item +% Again if the font must be downloaded, can/should it be partially +% downloaded? +% \item +% In case the font has been reencoded, what is the name of the file +% which defines this encoding, and by what name does that file make +% the encoding known to the postscript interpreter? +% \end{itemize} +% The mechanisms available for such configuration are described in +% Subsection~\ref{Sssec:Config-interface}. +% Note that map files for DVI viewers are on average more likely to need +% various platform-specific information about the fonts than map files +% for DVI printer drivers are, and hence once can expect that +% generation of these will need more extensive configuration than that +% for the printer drivers. +% +% +% \subsubsection{Interface for basic usage} +% +% An \emph{entry maker} is a group of macros which write the entry for +% the font currently under consideration to a map fragments file each +% time they are called. The macro to call must have a name of the form +% \describecsfamily{make_\meta{driver}}|\make_|\meta{driver} for +% |\adddriver| to recognise it. Each entry maker has a separate output +% file (opened using |\open_pout|) and the identifier connected to that +% file is called \describecsfamily{output_\meta{driver}}\relax +% |\output_|\meta{driver}. +% +% A list of all entry makers currently active is maintined in the macro +% |\entry_makers_list|. Each item in this list has the form +% \begin{quote} +% |\maker_do|\,|\make_|\meta{driver} +% \end{quote} +% |\maker_do| is usually |\relax|, but it does occationally get set to +% other values. +% \par\bigskip +% +% +% \begin{macro}{\adddriver} +% The |\adddriver| command adds the named driver to the list of +% drivers to write entries for and opens an output file where the +% entries for that particular driver will go. Repeated calls to +% |\adddriver| for the same driver have no effect. +% \begin{macrocode} +\def\adddriver#1#2{ + \x_cs\ifx{make_#1}\x_relax + \fontinsterror\mapfrags_subsystem + {There~is~no~entry~maker~for~#1}\error_help_a + \else + \x_cs\ifx{output_#1}\x_relax \_a_true \else + \x_cs\ifx{output_#1}\closed_stream \_a_true \else + \_a_false + \fi\fi + \if_a_ + \x_cs\open_pout{output_#1}{#2} + \expandafter\add_to \expandafter\entry_makers_list + \expandafter{ \expandafter\maker_do + \csname make_#1\endcsname} + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\entry_makers_list} +% \begin{macro}{\maker_do} +% \begin{macrocode} +\let\entry_makers_list\empty_command +\let\maker_do\x_relax +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\donedrivers} +% The main function performed by the |\donedrivers| command is to +% close all the open output files. It might also print some warning +% messages. +% \begin{macrocode} +\def\donedrivers{ + \def\maker_do##1{ + \x_cs\close_pout{output\expandafter\gobble_five\string##1} + {Map~file~fragments} + } + \entry_makers_list + \let\maker_do\x_relax + \let\entry_makers_list\empty_command + \errorstopmode + \reportwarnings + \advance \process_generation \thr@@ + \edef\process_generation_succ{\the\process_generation} + \advance \process_generation \m@ne +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\gobble_five} +% \begin{macrocode} +\def\gobble_five#1#2#3#4#5{} +% \end{macrocode} +% \end{macro} +% +% +% It is appropriate that the map file writer writes a summary of the +% kinds of risky things which happened when it is done writing data to +% files. To simplify implementing such things, there is a command +% \DescribeMacro{\includewarning}|\includewarning| that takes care of +% the bookkeeping involved. After the call +% \begin{quote} +% |\includewarning|\meta{command} +% \end{quote} +% the \meta{command} will be executed exactly once the next time +% |\reportwarnings| is executed. The \meta{command} usually expands to +% something like +% \begin{quote} +% \small|\fontinstwarningnoline\mapfrags_subsystem{|\\ +% | Check~the~output~file(s)--some~data~was~considered~uncertain}| +% \end{quote} +% +% \begin{macro}{\warnings_list} +% The |\warnings_list| macro contains a list of all warnings that +% should be made. It expands to a sequence of +% \begin{quote} +% |\warning_do|\meta{command} +% \end{quote} +% |\warnings_list| is always assigned globally. +% \begin{macrocode} +\g_let\warnings_list=\empty_command +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\includewarning} +% \begin{macro}{\warning_do} +% The |\includewarning| command adds an entry for its argument to the +% |\warnings_list| list, provided there wasn't already such an entry. +% |\includewarning| is based on the macro |\warning_do|, which does +% most of the bookkeeping for making sure the list contains at most +% one entry of each kind. |\warning_do| normally expects to be +% expanded in the context +% \begin{quote} +% |\warning_do|\meta{new command}\meta{old command}\meta{next} +% \end{quote} +% The \meta{new command} is the command that is being added to the +% list, and the \meta{old command} is a command that is already in the +% list. \meta{next} is the first token in the next item in the +% list---in most cases another |\warning_do|. If \meta{new command} +% and \meta{old command} are not equal, this should expand to +% \begin{quote} +% |\noexpand\warning_do|\,|\noexpand|\meta{old command}\,^^A +% \meta{next}\,\meta{new command} +% \end{quote} +% If on the other hand they are equal, this should expand to +% \begin{quote} +% |\noexpand\warning_do|\,|\noexpand|\meta{old command}\,^^A +% \meta{next}\,|\x_relax| +% \end{quote} +% The reason for this is that the last \meta{next} will not be a +% |\warning_do|, but an |\ifx| which tests whether a new item should +% be added to the list. +% \begin{macrocode} +\def\warning_do#1#2#3{ + \noexpand\warning_do \noexpand#2 + \ifx #1#2 + \expandafter#3 \expandafter\x_relax + \else + \expandafter#3 \expandafter#1 + \fi +} +\def\includewarning#1{ + \xdef\warnings_list{ + \expandafter\swap_two \expandafter#1 \warnings_list + \if_equal\x_relax\then \else + \noexpand\warning_do \noexpand#1 + \fi + } +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\reportwarnings} +% The |\reportwarnings| command reports all the warnings and empties +% the |\warnings_list|. +% \begin{macrocode} +\def\reportwarnings{ + \begingroup + \let\warning_do=\x_relax + \warnings_list + \endgroup + \g_let\warnings_list=\empty_command +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\warn_unknown_source} +% \begin{macro}{\warn_undecided_data} +% \begin{macro}{\warn_uncertain_data} +% These macros are used to output warnings at the |\reportwarnings| at +% the end of |\donedrivers|. +% \begin{macrocode} +\def\warn_unknown_source{ + \fontinstwarningnoline\mapfrags_subsystem{ + Some~font~is~missing~from~the~output~file(s),\messagebreak + since~its~source~is~unknown} +} +\def\warn_undecided_data{ + \fontinstwarningnoline\mapfrags_subsystem{ + Check~the~output~file(s)--some~data~could~not~be~determined} +} +\def\warn_uncertain_data{ + \fontinstwarningnoline\mapfrags_subsystem{ + Check~the~output~file(s)--some~data~was~considered~uncertain} +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% +% \subsubsection{Configuration interface} +% \label{Sssec:Config-interface} +% +% To correctly format reencodings, the map file writer must know what +% the ETX encodings correspond to. In the case of drivers which +% generate postscript output, this information is stored in the +% \describecsfamily{pse-\meta{etx}}|\pse-|\meta{etx} family of macros. +% \meta{etx} is the name (suffix excluded) of the ETX file that the +% information pertains to. The expansion of these macros are of the form +% \begin{quote} +% \marg{postscript name}\marg{action} +% \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. +% +% \begin{macro}{\declarepsencoding} +% Data is entered in a |\pse-|\meta{etx} macro using the +% |\declare|\-|ps|\-|encoding| command. Its syntax is +% \begin{quote} +% |\declarepsencoding|\marg{etx}\marg{postscript name}\marg{action} +% \end{quote} +% \begin{macrocode} +\def\declarepsencoding#1#2#3{\x_cs\gdef{pse-#1}{{#2}{#3}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\download} +% By default |\download| gobbles its argument. It should be redefined +% when that is not the desired effect. +% \begin{macrocode} +\let\download=\gobble_one +% \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{8a}{StandardEncoding}{} +% \end{macrocode} +% \package{fontinst} must be told about other postscript encodings (if you +% have them installed). The \texttt{finstmsc.rc} file is the right place +% for these declarations.\relax +% \SortIndex{finstmsc.rc file}{\texttt{finstmsc.rc} file} +% +% Next we have the cofiguration for fonts, which works in a similar +% fashion. The main problem here seems to be to determine which files (if +% any) should be downloaded to the printer, and this can be specified +% using |\download| commands as for the encodings. The family +% \describecsfamily{psf-\meta{PS font name}}|\psf-|\meta{PS font name} +% of macros expand to a sequence of \meta{actions} as for the encodings. +% If there is such a macro for a font then the instructions found there +% should be followed. +% +% It is recommended that the contents of a |\psf-|\meta{PS font name} +% macro is executed before the map file entry is written, and that +% commands like |\download| are temporarily redefined to build the text +% for the entry, rather than having the |\write| in |\pout_line| expand +% the contents of |\psf-|\meta{PS font name}. +% +% \begin{macro}{\specifypsfont} +% The |\specifypsfont| command is used as +% \begin{quote} +% |\specifypsfont|\marg{PS font name}\marg{actions} +% \end{quote} +% It can be used to specify the actions that should be done to make a +% Postscript font known to the printer, when the automatic guessing +% would not be right. +% \begin{macrocode} +\def\specifypsfont#1#2{\x_cs\def{psf-#1}{#2}} +% \end{macrocode} +% \end{macro} +% +% Examples of cases where |\specifypsfont| would be needed are: +% \begin{itemize} +% \item Fonts which are resident on the printer. In this case the +% \meta{actions} argument should be empty, e.g. +% \begin{quote} +% |\specifypsfont{Times-Roman}{}| +% \end{quote} +% \item Instances of multiple master fonts. In this case one must +% download both the multiple master font and the stub file that +% defines the instance. +% +% Subsection~10.6.1 in The \LaTeX\ graphics companion~\cite +% {LaTeX-graph-comp} contains an example with an instance of the +% \texttt{MinionMM} multiple master font. Both the \TeX\ and +% (what is of interest here) the PS name for this instance is +% \texttt{zmnl8ac6}, the base multiple master font is stored in the +% file \texttt{MinionMM.pfb}, and the stub file is called +% \texttt{zmnl8ac6.pro}. The |\specifypsfont| command for this is +% \begin{quote} +% |\specifypsfont{zmnl8ac6}{%|\\ +% | \download{MinionMM.pfb}\download{zmnl8ac6.pro}%|\\ +% |}| +% \end{quote} +% \item Fonts which do not fit any of the general naming schemes. +% \end{itemize} +% +% +% \begin{macro}{\AssumeLWFN} +% This command makes \mbox{MacOS} \texttt{LWFN} style abbreviated +% Postscript font names the default for fonts that have no +% |\psf-| entry. +% \begin{macrocode} +\def\AssumeLWFN{\let\get_PS_font_file\LWFN_get_PS_font_file} +% \end{macrocode} +% \end{macro} +% +% +% +% \subsection{Deducing values for the map file entries} +% +% +% \subsubsection{Basic principles} +% +% The automatic generation of map file fragments mainly consists of +% determining various text strings and writing these to a file as the +% format of the map file being written requires. The complicated part is +% usually to determine what these text strings should be, since the only +% restriction imposed by the output format often is that the strings +% should be written in the right order and with separating whitespace. +% +% It is furthermore the case that some of these text strings seem to be +% hard to deduce from the information primarily given in the command to +% write the entry, but somewhat easier to deduce from some other deduced +% text string. +% +% Therefore the following model seems appropriate. For each text string +% that may need to be deduced, there is one macro which is used to store +% the string (if it has been deduced) and one macro which can be called +% to set the former macro to an appropriate value. Thus there is one +% macro |\PS_font_name| which stores the postscript name for the font +% currently in question and one macro +% \describecsfamily{get_\meta{string name}}|\get_PS_font_name| which +% determines the proper value for |\PS_font_name|. There is also a macro +% \DescribeMacro{\unknown_str}|\unknown_str| to which all the +% string storing macros should initially be |\let|, so that it can be +% easily tested whether a string storing macro has been given its proper +% value or not. +% +% Typically, if |\PS_font_name| is used somewhere, one would first have +% a piece of code that says +% \begin{quote} +% \small +% |\ifx\PS_font_name\unknown_str|\\ +% | \get_PS_font_name|\\ +% |\fi| +% \end{quote} +% to ensure that it is known when it is used. +% +% \begin{macro}{\unknown_str} +% A suitable value for this macro seems to be |?????|. +% \begin{macrocode} +\def\unknown_str{?????} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\clueless_str} +% To further support this model, there is also a macro |\clueless_str| +% which a string storing macro should be |\let| equal to if its proper +% value could not be determined. This distinction is useful for the +% |\get_|\textellipsis\ macros, since if |\get_|$A$ can determine the +% correct value of $A$ from $B$, but also from $C$, then it helps if +% |\get_|$A$ can easily check whether it has previously turned out to +% be impossible to determine the value of $B$, because then it can +% simply deduce $A$ from $C$ instead. +% +% \begin{macrocode} +\edef\clueless_str{\unknown_str ?} +% \end{macrocode} +% \end{macro} +% +% An example of how |\clueless_str| should be used is the following +% skeleton of a |\get_|$A$ macro: +% \begin{quote}\small +% |\def\get_|$A$|{|\\ +% | \ifx\unknown_str\|$B$| \get_|$B$| \fi|\\ +% | \ifx\clueless_str\|$B$\\ +% | \ifx\unknown_str\|$C$| \get_|$C$| \fi|\\ +% | \ifx\clueless_str\|$C$\\ +% | \let\|$A$|\clueless_str|\\ +% | \else|\\ +% | |\meta{Deduce $A$ from $C$}\\ +% | \fi|\\ +% | \else|\\ +% | |\meta{Deduce $A$ from $B$}\\ +% | \fi|\\ +% |}| +% \end{quote} +% +% +% \subsubsection{Implementation} +% +% \begin{macro}{\TeX_font_name} +% This is the name (as appearing in a DVI or VF file) of the font for +% which an entry should be made. It is set by |\makemapentry|, so no +% |\get_|\textellipsis\ macro is needed. +% \begin{macrocode} +\let\TeX_font_name\unknown_str +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\source_font_TeX_name} +% This is the name (as AFM or PL) of the font whose metrics were +% used by \package{fontinst}. It is set by |\fromafm| or |\frompl|, +% so no |\get_|\textellipsis\ macro is needed. +% \begin{macrocode} +\let\source_font_TeX_name\unknown_str +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\PS_font_name} +% This is the name (as FontName entry in an AFM or correspondingly) of +% the font in question. +% \begin{macrocode} +\let\PS_font_name\unknown_str +% \end{macrocode} +% \begin{macro}{\get_PS_font_name} +% I expect this to become one of the central macros in the map file +% generation (at least when entries are generated for postscript +% fonts), but for the moment it does the closest thing to nothing a +% |\get_|\textellipsis\ macro is allowed to do; it admits it hasn't +% got a clue about what the proper value is. +% \begin{macrocode} +\def\get_PS_font_name{\let\PS_font_name\clueless_str} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\AssumeAMSBSYY} +% \begin{macro}{\AssumeBaKoMa} +% These commands redefine |\get_PS_font_name| so that it returns the +% PS name this font would have if it was part of the AMS\slash +% Blue~Sky\slash Y\&Y and BaKoMa respectively distribution of the +% Computer Modern fonts---the \TeX\ font name in all upper case and +% all lower case respectively. +% \begin{macrocode} +\def\AssumeAMSBSYY{\def\get_PS_font_name{ + \uppercase \expandafter{ \expandafter\def + \expandafter\PS_font_name \expandafter{ \source_font_TeX_name} + } +}} +% \end{macrocode} +% \begin{macrocode} +\def\AssumeBaKoMa{\def\get_PS_font_name{ + \lowercase \expandafter{ \expandafter\def + \expandafter\PS_font_name \expandafter{ \source_font_TeX_name} + } +}} +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \begin{macro}{\PS_font_file} +% This is the name of the file (suffix included) in which the PS font +% is expected to be found. +% \begin{macrocode} +\let\PS_font_file\unknown_str +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\get_PS_font_file} +% \begin{macro}{\normal_get_PS_font_file} +% \begin{fistring}{PSfontsuffix} +% The macro |\normal_get_PS_font_file| is (hardly surprisingly) the +% normal |\get_PS_font_file|. It simply uses |\source_font_TeX_name| +% plus the suffix specified by the |PSfontsuffix| string. +% \begin{macrocode} +\resetstr{PSfontsuffix}{.pfa} +\def\normal_get_PS_font_file{ + \edef\PS_font_file{\source_font_TeX_name\str{PSfontsuffix}} +} +\let\get_PS_font_file=\normal_get_PS_font_file +% \end{macrocode} +% \end{fistring}\end{macro}\end{macro} +% +% \begin{macro}{\LWFN_get_PS_font_file} +% \begin{macro}{\abbreviate_PS_font_name} +% In MacOS, Postscript fonts file names are usually abbreviated forms of +% the Postscript font names, formed using the so called +% \(5+3+3+\cdots\) rule---keep the first five letters of the first +% subword, keep the first three letters of all following subwords. The +% |\LWFN_get_PS_font_file| macro uses this scheme if the Postscript +% name for the font is known, otherwise it calls the +% |\normal_get_PS_font_file|. The LWFN in the macro name is the type +% code for such files. +% +% The algorithm is based on using |\aftergroup| to construct the +% wanted |\def| statement, only |\aftergroup|ing the letters that are +% not to be removed in the abbreviation. |\a_count| is used as a +% counter of how many more letters in the current subword should be +% kept. +% \begin{macrocode} +\def\LWFN_get_PS_font_file{ + \ifx \PS_font_name\unknown_str \get_PS_font_name \fi + \ifx \PS_font_name\clueless_str + \normal_get_PS_font_file + \includewarning\warn_uncertain_data + \else + \begingroup + \aftergroup\def \aftergroup\PS_font_file + \aftergroup{ + \a_count=4~ + \expandafter\expandafter \expandafter\aftergroup + \expandafter\swap_two \expandafter\abbreviate_PS_font_name + \PS_font_name \x_relax + \aftergroup} + \endgroup + \fi +} +% \end{macrocode} +% \begin{macrocode} +\def\abbreviate_PS_font_name#1{ + \ifx \x_relax#1 \else + \ifnum \uccode`#1=`#1 + \a_count=2 + \aftergroup#1 + \else\ifx -#1 + \a_count=\z@ + \else\ifnum \a_count>\z@ + \advance \a_count \m@ne + \aftergroup#1 + \fi\fi\fi + \expandafter\abbreviate_PS_font_name + \fi +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% +% \subsection{Driver makers} +% +% This subsection contains the definitions of macros that makes up the +% driver makers. +% +% +% \subsubsection{The \texttt{debug} driver} +% +% The \texttt{debug} driver maker doesn't really generate entries for +% any DVI driver map file, it just prints the data that was available. +% It is mainly intended for debugging purposes, but it might also serve +% as a basic model for other driver makers. +% +% \begin{macro}{\make_debug} +% \begin{macrocode} +\def\make_debug{ + \pout_line\output_debug{Driver~data~for~font~\TeX_font_name:} + \pout_lline\output_debug{Source~font~TeX~name:~\source_font_TeX_name} + \ifx \reencode_etx\empty_command \else + \pout_lline\output_debug{Font~reencoded~using~\reencode_etx.etx.} + \fi + \ifdim \xscale_factor=\p@ \else + \pout_lline\output_debug{Font~x-scaled~by~ + \expandafter\lose_measure\the\xscale_factor. + } + \fi + \ifdim \slant_factor=\z@ \else + \pout_lline\output_debug{Font~slanted~by~ + \expandafter\lose_measure\the\slant_factor. + } + \fi + \debug_values_hook +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\debug_value} +% The |\debug_value| macro can be used to print the name and contents +% of an arbitrary value macro in the |debug| driver. It is called with +% the value macro as argument, e.g. +% \begin{quote} +% |\debug_value\PS_font_name| +% \end{quote} +% +% \begin{macrocode} +\def\debug_value#1{ + \ifx #1\unknown_str + \csname get_ \expandafter\gobble_one \string#1 \endcsname + \fi + \pout_lline\output_debug{\string#1:~#1} + \ifx #1\clueless_str \includewarning\warn_undecided_data \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\debugvalue} +% \begin{macro}{\debug_values_hook} +% The |\debugvalue| command is a user level interface for adding +% value macros to the list of those that are displayed by the +% \texttt{debug} driver. The argument is the name of the value in +% question, e.g. +% \begin{quote} +% |\debugvalue{PS_font_name}| +% \end{quote} +% Note that the name given to |\debugvalue| is not the control +% sequence in which the name is stored. +% \begin{macrocode} +\def\debugvalue#1{ + \expandafter\add_to \expandafter\debug_values_hook + \expandafter{ \expandafter\debug_value \csname#1\endcsname} +} +% \end{macrocode} +% \begin{macrocode} +\let\debug_values_hook\empty_command +\debugvalue{PS_font_name} +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \subsubsection{The \texttt{dvips} driver} +% +% \changes{1.912}{2000/02/19}{\texttt{dvips} mapfile fragments writer +% added. (LH)} +% Before constructing an entry for a \package{dvips} mapfile, it should +% be sorted out how such an entry should look. The \package{dvips} +% manual says +% \begin{quotation} +% The parsing of the \texttt{psfonts.map} file should be explained to +% eliminate all confusion. If a line is empty or begins with a space, +% asterisk, semicolon, or hash mark, it is ignored. Each remaining +% line is separated into words, where words are separated by spaces or +% tabs. If a word begins with a double quote, it extends until the +% next double quote or the end of the line. If a word starts with a +% less than character, it is treated as a font header file (or a +% downloaded PostScript font). There can be more than one such header +% for a given font. If a word starts with a double quote, it is a +% special instruction for generating that font. Otherwise it is a +% name. The first such name is always the name \TeX\ uses for the +% font and is also the name of the raw \texttt{tfm} file. If there is +% another name word, that name is used as the PostScript name; if +% there is only one name word, it is used for both the \TeX\ name and +% the PostScript name. +% \end{quotation} +% +% A \package{fontinst}-generated map file entry for the \texttt{dvips} +% driver has the following structure: +% \begin{isyntax} +% \meta{\TeX{} font name} \meta{PS font name} \meta{downloads} +% \meta{font transformations} +% \end{isyntax} +% \meta{\TeX{} font name} is simply the value of |\TeX_font_name| and +% \meta{PS font name} is simply the value of |\PS_font_name|. +% \meta{downloads} is a possibly empty sequence in which each item +% has the form +% \begin{quote} +% \meta{prefix}\meta{filename} +% \end{quote} +% The \meta{prefix} values I've came across are empty,\footnote{I think +% this is only used for files that \package{dvips} should ignore, but +% which certain other programs that read the same \texttt{psfonts.map} +% need.} |<|, |<<|, and |<[|. Currently |<| is always used. +% \meta{filename} is a filename with suffix. \meta{font transformations} +% is either empty or has the form +% \begin{quote} +% |"| \meta{Postscript code} |"| +% \end{quote} +% +% Should support for the |<<| or |<[| prefixes be needed, then this +% should be done by adding some new variant of the |\download| +% command---|\fullldownload|, maybe---rather than adding the extra +% character to the \meta{filename}. To simplify matters for other drivers, +% such new variants should by default expand to |\download|, rather than +% |\gobble_one|. +% +% +% \begin{macro}{\downloads_list} +% \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. +% \begin{quote} +% |\append_download|\marg{arg} +% \end{quote} +% appends +% \begin{quote} +% |\download|\marg{arg} +% \end{quote} +% to |\downloads_list|. +% \begin{macrocode} +\newtoks\downloads_list +\def\append_download#1{ + \downloads_list=\expandafter{ \the\downloads_list \download{#1} } +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \begin{macro}{\make_dvips} +% This macro gathers the information for a \texttt{dvips} driver entry +% and writes it to the corresponding output file. As a \texttt{dvips} +% 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. +% \begin{macrocode} +\def\make_dvips{ + \downloads_list={} + \let\postscript_code\empty_command + \let\download\append_download + \ifx \reencode_etx\empty_command \else + \if_undefined{pse-\reencode_etx}\then + \etxtoenc{\reencode_etx}{\reencode_etx} + \fi + \expandafter\expandafter \expandafter\second_of_two + \csname pse-\reencode_etx\endcsname + \edef\postscript_code{\postscript_code\space + \expandafter\expandafter \expandafter\first_of_two + \csname pse-\reencode_etx\endcsname + \space ReEncodeFont + } + \fi + \ifdim \xscale_factor=\p@ \else + \edef\postscript_code{\postscript_code + \space\expandafter\lose_measure\the\xscale_factor + \space ExtendFont + } + \fi + \ifdim \slant_factor=\z@ \else + \edef\postscript_code{\postscript_code + \space\expandafter\lose_measure\the\slant_factor + \space SlantFont + } + \fi +% \end{macrocode} +% After constructing the \meta{Postscript code} and having appended +% the necessary download (if any) for that code, the next problem is +% to determine the actual \meta{PS font name} and append the downloads +% needed to actually define the font to the Postscript interpreter. If +% there is no special entry for this font in the |\psf-|\meta{PS font +% name} table, or if its \meta{PS font name} is unknown, then it is +% assumed that exactly one file should be downloaded. As the name of +% that file is taken the value of |\PS_font_file|. +% \begin{macrocode} + \ifx \PS_font_name\unknown_str \get_PS_font_name \fi + \ifx \PS_font_name\clueless_str + \includewarning\warn_undecided_data + \_a_true + \else + \if_undefined{psf-\PS_font_name}\then + \_a_true + \else + \csname psf-\PS_font_name \endcsname + \_a_false + \fi\fi + \if_a_ + \ifx \PS_font_file\unknown_str \get_PS_font_file \fi + \append_download{\PS_font_file} + \ifx \PS_font_file\clueless_str + \includewarning\warn_undecided_data + \fi + \fi +% \end{macrocode} +% Finally, the entire entry is written to the file. The point with +% expanding past an empty command is that \TeX\ in a |\write| normally +% jumps past the expansion of a |\the|\meta{token list register} +% without expanding it further, but this effect can be prevented by +% expanding the |\the| with an |\expandafter|. +% \begin{macrocode} + \def\download##1{~<##1} + \pout_line\output_dvips{ + \TeX_font_name\space\PS_font_name + \expandafter\empty_command \the\downloads_list + \ifx \postscript_code\empty_command \else + \space"\postscript_code\space" + \fi + } +} +% \end{macrocode} +% \end{macro} +% +% +% +% \subsubsection{The \texttt{dvipdfm} driver} +% +% \changes{1.912}{2000/02/22}{\texttt{dvipdfm} mapfile fragments writer +% added. (LH)} +% +% A mapfile entry for the \texttt{dvipdfm} driver has the following +% structure: +% \begin{isyntax} +% \meta{\TeX{} font name} \meta{encoding} \meta{PS font} +% \meta{options} +% \end{isyntax} +% \meta{\TeX{} font name} is simply the value of |\TeX_font_name|. +% \meta{encoding} is the name of the encoding file which should be used +% to reencode the font, or \texttt{default} if there is none. \meta{PS +% font} is the value of |\PS_font_name| for the standard 35 fonts +% (i.e., fonts which will not be included in the PDF generated), but for +% other fonts it is the name of the file which contains the +% font.\footnote{The documentation seems to say that \texttt{dvipdfm} +% can only understand fonts in PFB format; I have chosen to ignore this +% potential problem.} \meta{options}, finally, is a possibly empty +% sequence of space-separated options. Each option is one of the +% following +% \begin{quote} +% |-e |\meta{number}\\ +% |-s |\meta{number}\\ +% |-r| +% \end{quote} +% The |-e| and |-s| options extend and slant by the given amounts. The +% |-r| option is a workaround for some Acrobat bugs; it is currently not +% generated by \package{fontinst}. +% +% \begin{macro}{\make_dvipdfm} +% This macro gathers the information for a \texttt{dvipdfm} driver entry +% and writes it to the corresponding output file. As a \texttt{dvipdfm} +% mapfile entry is on one line, the entire entry is written at once. +% The \meta{options} text is collected as explicit text in the +% macro |\options_text|. The \meta{downloads} is collected as a +% sequence of |\download| commands in the |\downloads_list| token +% register. +% \begin{macrocode} +\def\make_dvipdfm{ + \def\font_encoding{default} + \ifx \reencode_etx\empty_command \else + \if_undefined{pse-\reencode_etx}\then + \etxtoenc{\reencode_etx}{\reencode_etx} + \fi + \def\download##1{\def\font_encoding{##1}} + \expandafter\expandafter \expandafter\second_of_two + \csname pse-\reencode_etx\endcsname + \fi + \let\options_text\empty_command + \ifdim \xscale_factor=\p@ \else + \edef\options_text{\options_text\space + -e~\expandafter\lose_measure\the\xscale_factor + } + \fi + \ifdim \slant_factor=\z@ \else + \edef\options_text{\options_text\space + -s~\expandafter\lose_measure\the\slant_factor + } + \fi +% \end{macrocode} +% After constructing the \meta{options} and having determined +% \meta{encoding}, the next problem is to determine the actual +% \meta{PS font}, which will be put in |\a_macro|. If there is no +% special entry for this font in the |\psf-|\meta{PS font name} table, +% or if its \meta{PS font name} is unknown, then it is assumed that +% exactly one file should be downloaded. As the name of that file is +% taken the value of |\PS_font_file|. +% \begin{macrocode} + \ifx \PS_font_name\unknown_str \get_PS_font_name \fi + \if_or \if_equal\PS_font_name\clueless_str \or_else + \if_undefined{psf-\PS_font_name} + \then + \ifx \PS_font_file\unknown_str \get_PS_font_file \fi + \ifx \PS_font_file\clueless_str + \includewarning\warn_undecided_data + \fi + \let\a_macro=\PS_font_file + \else + \let\a_macro=\PS_font_name + \def\download##1{\def\a_macro{##1}} + \csname psf-\PS_font_name \endcsname + \fi +% \end{macrocode} +% Finally, the entire entry is written to the file. +% \begin{macrocode} + \pout_line\output_dvipdfm{ + \TeX_font_name\space\font_encoding\space\a_macro + \options_text + } +} +% \end{macrocode} +% \end{macro} +% +% +% \subsubsection{The \texttt{pltotf} ``driver''} +% \changes{1.915}{2000/06/27}{\texttt{pltotf} ``driver'' support +% added. (LH)} +% +% It can sometimes be hard to determine which of all the PL files that +% \package{fontinst} creates need to be converted to TFM files. In most +% cases no \texttt{8a}-encoded PLs need to be converted as they aren't +% used as base fonts or installed in an FD file, but to automatically +% exclude them isn't a trivial task (even though it probably could be +% done by a regular expression filter for fonts named according to the +% \texttt{fontname} scheme). There furthermore seems to be some systems +% on which it for various reasons isn't easy to convert all PLs in a +% directory. The \texttt{pltotf} ``driver'' support is meant to help with +% both these problems, as the ``map file'' it creates really is a shell +% script (batch file) for converting precisely those PL files that need +% a map file entry to TFM format. I believe the shell script will work +% both for UNIX and DOS systems. +% +% \begin{macro}{\make_pltotf} +% \begin{fistring}{TFMfileprefix} +% |\make_pltotf| writes a \package{PLtoTF} command for converting the +% current font's PL file to a TFM file. If set, the string +% \texttt{TFMfileprefix} will be prepended to the TFM file name---this +% could be used for putting the TFMs in some directory other than the +% current. +% \begin{macrocode} +\def\make_pltotf{ + \pout_line\output_pltotf{pltotf~\TeX_font_name.pl~ + \ifisstr{TFMfileprefix}\then \str{TFMfileprefix}\fi + \TeX_font_name.tfm + } +} +% \end{macrocode} +% \end{fistring}\end{macro} +% +% +% \begin{macrocode} +%</map> +% \end{macrocode} +% \Finale +\endinput + diff --git a/Master/texmf-dist/source/fontinst/base/fisource.sty b/Master/texmf-dist/source/fontinst/base/fisource.sty new file mode 100644 index 00000000000..c530b6bf26b --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/fisource.sty @@ -0,0 +1,685 @@ +% \iffalse +% +% Copyright 1999, 2000 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. +% ----------------------------------------------------- +% +% 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. +% +% \fi +% +% \title{The \package{fisource} package} +% \author{Lars Hellstr\"om} +% \maketitle +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{fisource}% + [2003/03/29 v2.16 Fontinst source documentation commands] +% \end{macrocode} +% +% \section{Option processing} +% +% \begin{option}{warnfinale} +% \changes{2.01}{2000/07/06}{Option added. (LH)} +% Under development I find it quite a nuisance that |\Finale| raises +% an error if the checksum isn't correct; a warning feels more +% appropriate. Therefore the \texttt{warnfinale} option redefines +% |\check@checksum| to emit a warning instead. +% \begin{macrocode} +\DeclareOption{warnfinale}{% + \@ifpackageloaded{doc}\@firstofone\AtEndOfPackage {% + \def\check@checksum{\relax + \ifnum\check@sum=\z@ + \typeout{**********************************}% + \typeout{* This macro file has no checksum!}% + \typeout{* The checksum should be \the\bslash@cnt!}% + \typeout{**********************************}% + \else\ifnum \check@sum=\bslash@cnt + \typeout{*******************}% + \typeout{* Checksum passed *}% + \typeout{*******************}% + \else + \PackageWarning{doc}{Checksum not passed + (\the\check@sum<>\the\bslash@cnt)}% + \fi\fi + \global\check@sum\z@ + }% + }% +} +% \end{macrocode} +% \end{option} +% +% All other options are passed on to \package{xdoc}. +% \begin{macrocode} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{xdoc2}} +\ProcessOptions\relax +% \end{macrocode} +% +% \changes{2.00}{2000/07/06}{Use \package{xdoc1}. (LH)} +% \changes{2.02}{2000/07/15}{Use \package{xdoc2}. (LH)} +% \changes{2.10}{2001/02/27}{Use \package{docidx2e}. (LH)} +% \begin{macrocode} +\RequirePackage{xdoc2,docidx2e} +% \end{macrocode} +% +% \section{Miscellanea} +% +% \begin{macrocode} +\CodelineIndex +\setcounter{IndexColumns}{2} +\setcounter{tocdepth}{2} +\DeclareRobustCommand\package[1]{\textsf{#1}} +\DeclareRobustCommand\eTeX{\(\varepsilon\)-\kern-.125em\TeX} +% \end{macrocode} +% +% \begin{macro}{\AllTeX} +% \changes{2.13}{2001/08/26}{Command added. (LH)} +% \begin{macro}{\La} +% The |\AllTeX| command is for writing `(La)TeX' (but nicer). The +% definition is taken from \texttt{tugboat.dtx}. +% \begin{macrocode} +\newcommand{\La}{% + L\kern-.36em + {% + \setbox0\hbox{T}% + \vbox to\ht0{\hbox{% + $\m@th$\csname S@\f@size\endcsname + \fontsize\sf@size\z@\math@fontsfalse\selectfont + A% + }\vss}% + }% +} +\DeclareRobustCommand\AllTeX{(\La\kern-.075em)\kern-.075em\TeX} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\missing} +% \changes{2.10}{2001/02/27}{Redefined using +% \cs{NewDescribeCommand}. (LH)} +% \begin{macrocode} +\NewDescribeCommand\missing{% + \XD@grab@marg\XD@grab@harmless@cs +}{2}{% + \GenericDescribePrint{\small Not in \texttt{#1}: + \texttt{\Bslash#2}}% + \MakeSortKey\@tempa{#2}{}% + \IndexEntry{% + \LevelSorted{Not in #1:}{Not in \texttt{#1}:}% + \LevelSorted{\@tempa}{\texttt{\Bslash#2}}% + }{usage}{\thepage}% +} +% \newcommand\missing[2]{% +% \marginpar{% +% \raggedleft\leavevmode\strut +% Not in \texttt{#1}: \texttt{\string#2}\strut +% \index{Not in #1\actualchar Not in \string\texttt{#1}\levelchar +% \string#2\actualchar\string\verb\verbatimchar +% \string#2\verbatimchar\encapchar usage}% +% }% +% } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\newcommand\ambiguity[1]{\leavevmode + \textbf{#1\index{Ambiguity\encapchar usage}}% + \marginpar{\raggedleft\textbf{\huge A}}% +} +\newcommand\question[1]{\leavevmode + \textbf{#1\index{Question\encapchar usage}}% + \marginpar{\raggedleft\textbf{\huge ?}}% +} +\AtBeginDocument{\catcode`\_=11} +\def\MakePrivateLetters{\catcode`\_=11\makeatletter} + +% \end{macrocode} +% +% \multchanges{\cs{meta}}{1.30}{2000/01/02}{\cs{Meta} command (robust +% wrapper around \package{doc}'s \cs{meta}) added. (LH)} +% \multchanges{\cs{meta}}{1.31}{2000/02/10}{Command redefined so that +% it is robust itself. \cs{Meta} removed. (LH)} +% \multchanges{\cs{meta@font@select}}{1.33}{2000/02/26}{Macro added. +% (LH)} +% \multchanges{\cs{meta}}{1.35}{2000/03/25}{Don't make \cs{setlanguage} +% whatsits in restricted horizontal mode. (LH)} +% \multchanges{\cs{meta}}{2.00}{2000/07/06}{Command definition removed, +% since the command is already defined by \package{doc} or +% \package{xdoc}. (LH)} +% +% \begin{macro}{\cs} +% This is \package{ltxdoc}'s normal |\cs|, but with a twist to make +% |\meta| produce better results when used in the argument. +% \changes{1.33}{2000/02/26}{Redefinition added. (LH)} +% \changes{2.00}{2000/07/06}{Use \cs{MetaNormalfont} and +% \cs{PrintVisibleChar}. (LH)} +% \begin{macrocode} +\DeclareRobustCommand\cs[1]{% + \texttt{\MetaNormalfont\PrintVisibleChar{`\\}#1}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{isyntax} +% |isyntax| is for ``informal'' syntax specifications, such as +% \begin{quote} +% A \meta{varchar command} can be one of\\ +% \begin{quote} +% |\vartop|\marg{glyph}\\ +% |\varmid|\marg{glyph}\\ +% |\varbot|\marg{glyph}\\ +% |\varrep|\marg{glyph} +% \end{quote} +% \end{quote} +% The implementation is based on that of the \texttt{verse} +% environment.It usually works just as fine with \texttt{quote}, but +% \texttt{isyntax} handles breaking long lines better (and more +% elegantly). +% \changes{1.37}{2000/05/14}{Increased \cs{rightskip} stretchability +% and added setting of \cs{linepenalty}. (LH)} +% \begin{macrocode} +\newenvironment{isyntax}{% + \let\\\@centercr + \list{}{% + \itemsep \z@ + \itemindent -1.5em% + \listparindent \itemindent + \advance \leftmargin 1.5em% + }% + \advance \rightskip \z@\@plus0.7\linewidth \relax + \linepenalty=100\relax + \item\relax +}{\endlist} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{obsoletemacro} +% \changes{2.00}{2000/07/06}{Environment removed since obsolete. (LH)} +% The \texttt{obsoletemacro} environment is for getting the right +% heading on |\changes| comments that refer to macros which have been +% removed. It only updates the |\saved@macroname|. +% \begin{macrocode} +% \newenvironment{obsoletemacro}{\begingroup +% \catcode`\\12 +% \MakePrivateLetters +% \obsolete@macro +% }{} +% \def\obsolete@macro#1{\endgroup +% \edef\saved@macroname{\string#1}% +% } +% \end{macrocode} +% \end{environment} +% +% +% \section{\texttt{macro}-like environments} +% +% This subsection contains the definitions of a couple of environments +% that, like \package{doc}'s \texttt{environment}, are for marking up the +% document (what is defined and where). The definitions of these +% environments are identical to that of \texttt{environment}, except +% that the index entry texts are a little different. +% +% This section got a lot shorter in v\,2.00 thanks to \package{xdoc}. +% +% \begin{environment}{fiinteger} +% \begin{environment}{fistring} +% \multchanges{\notcs{\texttt{fiinteger} environment}^^A +% \notcs{\texttt{fistring} environment}}{2.03}{2000/07/24}^^A +% {Swapped last two arguments of \cs{NewMacroEnvironment} call +% since \package{xdoc} changed.} +% \begin{macrocode} +\NewMacroEnvironment{fiinteger}{\XD@grab@harmless\relax}{1}% + {\MacroFont#1 \normalfont integer}% + {\XDMainIndex{\levelsorted{#1 I}{\texttt{#1} (integer)}}% + \XDMainIndex{\levelsame{integers:}\levelsorted{#1}{\texttt{#1}}}}% + {{#1}{\texttt{#1} integer}}{} +% \end{macrocode} +% \begin{macrocode} +\NewMacroEnvironment{fistring}{\XD@grab@harmless\relax}{1}% + {\MacroFont#1 \normalfont string}% + {\XDMainIndex{\levelsorted{#1 S}{\texttt{#1} (string)}}% + \XDMainIndex{\levelsame{strings:}\levelsorted{#1}{\texttt{#1}}}}% + {{#1}{\texttt{#1} string}}{} +% \end{macrocode} +% \end{environment}\end{environment} +% +% \begin{environment}{PLproperty} +% \changes{2.04}{2000/11/03}{Environment added. (LH)} +% \changes{2.11}{2001/03/16}{Added \cs{DoNotIndexHarmless}. (LH)} +% The \texttt{PLproperty} environment is for marking up definitions +% of macros for interpreting properties in (V)PL files. +% \begin{macrocode} +\NewMacroEnvironment{PLproperty}{\XD@grab@harmless\relax}{1}% + {\MacroFont#1 \normalfont property}% + {\XDMainIndex{\levelsorted{#1}{\texttt{\Bslash#1}}}% + \XDMainIndex{% + \levelsame{PL properties:}\levelsorted{#1}{\texttt{#1}}% + }}% + {{#1}{\texttt{\Bslash#1}}}% + {\DoNotIndexHarmless{#1}} +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{numPLproperty} +% \changes{2.11}{2001/03/17}{Environment added. (LH)} +% The \texttt{numPLproperty} environment is for marking up definitions +% of macros that interpret a numbered family of (V)PL file properties, +% such as \texttt{NUM} for \texttt{NUM1}, \texttt{NUM2}, and +% \texttt{NUM3}. The syntax is +% \begin{quote} +% |\begin{numPLproperty}|\marg{base}\marg{num-list} +% \end{quote} +% In the above case the \meta{base} would be \texttt{NUM}. The +% \meta{num-list} is a comma-separated list of digits (no existing +% family of numbered properties have more than 5 members) that +% specify what members of the family are handled by the macro being +% defined. +% \begin{macrocode} +\NewMacroEnvironment{numPLproperty}{% + \XD@grab@harmless\relax\XD@grab@marg +}{2}% + {\MacroFont#1$*$ \normalfont properties}% + {\XDMainIndex{\levelsorted{#1}{\texttt{\Bslash#1}}}% + \@for\@tempa:=#2\do{% + \XDMainIndex{% + \levelsame{PL properties:}% + \levelsorted{#1\@tempa}{\texttt{#1\@tempa}}% + }% + }}% + {{#1}{\texttt{\Bslash#1}}}% + {\DoNotIndexHarmless{#1}} +% \end{macrocode} +% \end{environment} +% +% +% \multchanges{\notcs{\texttt{switch} environment}}{2.00}{2000/07/06} +% {Removed since defined in \package{xdoc}. (LH)} +% +% +% \section{Changes of change history formating} +% +% \multchanges{\cs{@changes}}{2.00}{2000/07/06}{Redefinition removed +% since already done in \package{xdoc}. (LH)} +% +% \begin{macro}{\multchanges} +% \changes{1.32}{2000/02/22}{\cs{flushleftspace} between \cs{cs} +% items when typeset, instead of space. (LH)} +% \changes{1.34}{2000/03/11}{\cs{notcs} marker allowed in +% \meta{commands}. (LH)} +% \changes{2.16}{2003/03/29}{Modified macro so that it is based on +% \cs{changes@}. This means it is now compatible with \cs{uintver}. +% (LH)} +% The |\multchanges| commands is used to record a change to several +% macros. Its syntax is +% \begin{quote} +% |\multchanges|\marg{commands}\marg{version}\marg{date}^^A +% \marg{description} +% \end{quote} +% The three last arguments are as the arguments of |\changes|. The +% \meta{commands} should be a nonempty sequence of commands, each +% command either a |\cs| or a |\notcs|, and each command with one +% argument. The change history entry generated by a +% |\multchanges| will be for all the macros (or whatever) listed in +% the first argument. |\cs| items will be typeset in typewriter font +% with a leading backslash, whereas |\notcs| items will receive no +% such special formatting. +% +% This method may have problems with active characters (since I've +% ignored some things the standard |\changes| do to accomodate these), +% but luckily \package{fontinst} hardly uses active characters +% anyway. Furthermore I don't think the \package{doc} way of dealing +% with them would be the right way here. Perhaps an active character +% should rather be entered in the \meta{commands} argument as +% |\active|\marg{code} or something? +% \begin{macrocode} +\newcommand*\multchanges[4]{% + \@bsphack + \begingroup + \begingroup + \def\cs##1{,\space##1}% + \let\notcs=\cs + \protected@xdef\@gtempa{% + \expandafter\@gobbletwo#1\@empty\@empty\@empty + }% + \edef\cs{,\noexpand\flushleftspace + \noexpand\protect + \expandafter\noexpand\csname cs \endcsname + }% + \def\notcs##1{,\noexpand\flushleftspace ##1}% + \protected@xdef\@gtempa{% + {\@gtempa}% + {\expandafter\@gobbletwo#1\@empty\@empty\@empty}% + }% + \endgroup + \let\saved@macroname=\@gtempa + \changes@{#2}{#3}{#4}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\flushleftspace} +% The |\flushleftspace| command should typeset something which looks +% like a space when not broken at, and as an \texttt{3em plus 1fil} +% space when broken at. It also have to survive its use in +% |\multchanges|. +% \changes{1.32}{2000/02/22}{Command added. (LH)} +% \changes{1.38}{2000/06/05}{Modified finite penalty. (LH)} +% \begin{macrocode} +\DeclareRobustCommand\flushleftspace{% + \nobreak \hskip 3em\@plus 1fil% + \penalty\@m \hskip -3em\@plus -1fil\ % +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\labelednumber} +% This \package{xdoc} macro is redefined to put a ``filbreak'' +% space before every page number labelled with a macro name. +% \changes{2.16}{2003/03/29}{Redefinition added. (LH)} +% \begin{macrocode} +\renewcommand*\labelednumber[2]{% + \hskip -1em\@plus -8em% + \vadjust{}\hskip 1em\@plus 8em% + #2\nolinebreak[2] (#1)% +} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{theglossary} +% \begin{macrocode} +% \ifhave@multicol +% \renewenvironment{theglossary}{% +% \begin{multicols}\c@GlossaryColumns +% [\glossary@prologue][\GlossaryMin]% +% \GlossaryParms \def\item{\@idxitem v\,}\ignorespaces}% +% {\end{multicols}} +% \else +% \renewenvironment{theglossary}{% +% \@restonecoltrue\if@twocolumn\@restonecolfalse\fi +% \columnseprule \z@ \columnsep 35\p@ +% \twocolumn[\glossary@prologue]% +% \GlossaryParms \def\item{\@idxitem v\,}\ignorespaces} +% {\if@restonecol\onecolumn\else\clearpage\fi} +% \fi +% \end{macrocode} +% +% If we want to use the glossary for some other information as well +% (here I am thinking primarily on collecting |\missing| notices) then +% perhaps we should insert the |v\,| in |\changes| instead. I would +% guess the 64 character limit isn't at all as usual as it was when +% the doc package documentation was written. +% +% \begin{macrocode} +% \renewenvironment{theglossary}{% +% % \penalty\z@\vskip\GlossaryMin\@plus\z@\@minus\GlossaryMin +% % \penalty\z@\vskip-\GlossaryMin\@plus\z@\@minus-\GlossaryMin +% \glossary@prologue +% \GlossaryParms \let\item\@idxitem \ignorespaces +% }{\par\bigskip} +% \end{macrocode} +% On second thoughts, the changes should be printed in one column. +% They're usually very hard to linebreak in narrow columns. +% \end{environment} +% +% \begin{macro}{\firstsubsubitem} +% The idea with |\firstsubsubitem| is that it should be like |\efill| +% |\subsubitem| if the paragraph is ended by a |\subsubitem| and like +% \verb*"\ " if it isn't. This is achieved by grabbing the paragraph +% into a macro and then prepend some suitable material to it when +% typesetting. +% \changes{1.36}{2000/04/10}{Grabbing paragraph as list of tokens, +% rather than typeset text. (LH)} +% \begin{macrocode} +% \newcommand\firstsubsubitem{% +% \begingroup +% \let\par\@fssi@par +% \let\subsubitem\@fssi@subsubitem +% \protected@edef\@tempa{\iffalse}\fi +% } +% \end{macrocode} +% \begin{macrocode} +% \def\@fssi@subsubitem{% +% \iffalse{\fi}% +% \nobreak\hfill\vadjust{\nobreak}% +% \penalty-\@M\vadjust{\penalty\@m}\nobreak\hskip -5pt\relax +% \@tempa +% \endgroup +% \subsubitem +% } +% \end{macrocode} +% \multchanges{\cs{@fssi@par}}{2000/06/05}{1.38}{Replaced simple space +% by a more complicated sequence of penalties, vadjusts, and glue, +% to make it more like \cs{flushleftspace}. (LH)} +% \begin{macrocode} +% \def\@fssi@par{% +% \iffalse{\fi}% +% \nobreak \hskip \z@ \@plus 0.4\linewidth +% \vadjust{\nobreak}% +% \penalty500\hskip \z@ \@plus -0.4\linewidth\hskip 5pt\relax +% \penalty\z@\ \vadjust{\penalty\@m}% +% \nobreak\hskip -5pt\relax +% \@tempa +% \endgroup +% \par +% } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\GlossaryParms} +% \begin{macrocode} +% \def\GlossaryParms{% +% \parindent \z@ +% \columnsep 15pt +% \parskip 0pt plus 1pt +% \rightskip 15pt plus 15pt +% \mathsurround \z@ +% \parfillskip=-\rightskip +% \pretolerance=\tolerance +% \small +% \def\@idxitem{\par\hangindent 30pt v\,}% +% \def\subitem{\par\hangindent 30pt\hspace*{15pt}}% +% \def\subsubitem{\par\hangindent 30pt\hspace*{25pt}}% +% \def\indexspace{\par\vspace{10pt plus 2pt minus 3pt}}% +% } +% \end{macrocode} +% \end{macro} +% +% \begin{instance}{docindex}{changes} +% \changes{2.10}{2001/02/27}{Redefining it. (LH)} +% \changes{2.12}{2001/03/25}{Modified in the same way as the +% \package{docindex} default was with v\,1.00. (LH)} +% \changes{2.15}{2003/02/19}{Rewrote this redefinition. Something +% was wrong with the old one, but it seems to have worked to +% start again from the definition in \package{docindex}. (LH)} +% \changes{2.16}{2003/03/29}{Added an insertion of `\texttt{v}\cs{,}' +% to the version number headings. The way it is done is however a +% hack; I should define a separate instance explicitly instead. +% (LH)} +% \begin{macrocode} +\setcounter{GlossaryColumns}{1} +\@namedef{TP@I{}{docindex}{changes}}#1#2{% + \begingroup + \def\DI@indexitem@i##1##2##3##4{% + \UseInstance{indexitem}{fixed1}{##1}{##2}{v\,##3}{##4}% + }% + \@letinstance\DI@indexitem@ii{indexitem}{fixed-r2a-nocomma}% + \@letinstance\DI@indexitem@iii{indexitem}{aloneaccept3}% + \columnsep=10pt% + \parskip=0pt plus 1pt% + \def\DI@letter@skip{\z@skip}% + \let\DI@letter@format\@gobble + \def\+{-}% + \IfFileExists{\jobname.gls}{% + \ifnum \c@GlossaryColumns>\@ne + \begin{multicols}{\c@GlossaryColumns}[#1][\GlossaryMin]% + \else + \enough@room{\GlossaryMin}% + #1\par + \addvspace\multicolsep + \fi + \small + \makeatletter + \hbadness=\@M + \hfuzz=\maxdimen + \pretolerance=\m@ne + \tolerance=9999% + \emergencystretch=5em + \@nobreakfalse + \DI@ind@setup + \input{\jobname.gls}% + \DI@item@nojoin + \ifnum \c@GlossaryColumns>\@ne + \end{multicols}% + \else + \enough@room\postmulticols + \addvspace\multicolsep + \fi + \normalsize #2\par + }{\typeout{No file \jobname.gls.}} + \endgroup +} +% \@namedef{TP@I{}{docindex}{changes}}#1#2{% +% \begingroup +% \@letinstance\DI@indexitem@i{indexitem}{fixed1}% +% \@letinstance\DI@indexitem@ii{indexitem}{fixed-r2a-nocomma}% +% \@letinstance\DI@indexitem@iii{indexitem}{aloneaccept3}% +% \columnsep=10pt% +% \parskip=0pt plus 1pt% +% \def\DI@letter@skip{\z@skip}% +% \let\DI@letter@format\@gobble +% % \ifnum \c@GlossaryColumns>\@ne +% % \begin{multicols}{\c@GlossaryColumns}[#1][\GlossaryMin]% +% % \else +% \enough@room{\GlossaryMin}% +% #1\par +% \addvspace\multicolsep +% % \fi +% \small +% \emergencystretch=5em +% \@nobreakfalse +% \DI@ind@setup +% \@input@{\jobname.gls}% +% \DI@item@nojoin +% % \ifnum \c@GlossaryColumns>\@ne +% % \end{multicols}% +% % \else +% \enough@room\postmulticols +% \addvspace\multicolsep +% % \fi +% \normalsize #2\par +% \endgroup +% } +% \end{macrocode} +% \end{instance} +% +% +% +% \section{Hack for removing ``Marginpar moved'' warning messages} +% +% Check if the definition matches the known. To be on the safe +% side, only the known definition will be changed. +% +% \begin{macrocode} +\def\@tempa{\@next\@marbox\@currlist{\@cons\@freelist\@marbox + \@cons\@freelist\@currbox}\@latexbug\@tempcnta\@ne + \if@twocolumn + \if@firstcolumn \@tempcnta\m@ne \fi + \else + \if@mparswitch + \ifodd\c@page \else\@tempcnta\m@ne \fi + \fi + \if@reversemargin \@tempcnta -\@tempcnta \fi + \fi + \ifnum\@tempcnta <\z@ \global\setbox\@marbox\box\@currbox \fi + \@tempdima\@mparbottom + \advance\@tempdima -\@pageht + \advance\@tempdima\ht\@marbox + \ifdim\@tempdima >\z@ + \@latex@warning@no@line {Marginpar on page \thepage\space moved}% + \else + \@tempdima\z@ + \fi + \global\@mparbottom\@pageht + \global\advance\@mparbottom\@tempdima + \global\advance\@mparbottom\dp\@marbox + \global\advance\@mparbottom\marginparpush + \advance\@tempdima -\ht\@marbox + \global\setbox \@marbox + \vbox {\vskip \@tempdima + \box \@marbox}% + \global \ht\@marbox \z@ + \global \dp\@marbox \z@ + \kern -\@pagedp + \nointerlineskip + \hb@xt@\columnwidth + {\ifnum \@tempcnta >\z@ + \hskip\columnwidth \hskip\marginparsep + \else + \hskip -\marginparsep \hskip -\marginparwidth + \fi + \box\@marbox \hss}% + \nointerlineskip + \hbox{\vrule \@height\z@ \@width\z@ \@depth\@pagedp}} +\ifx \@addmarginpar\@tempa +% \end{macrocode} +% It matched. +% \begin{macrocode} + \def\@addmarginpar{\@next\@marbox\@currlist{\@cons\@freelist\@marbox + \@cons\@freelist\@currbox}\@latexbug\@tempcnta\@ne + \if@twocolumn + \if@firstcolumn \@tempcnta\m@ne \fi + \else + \if@mparswitch + \ifodd\c@page \else\@tempcnta\m@ne \fi + \fi + \if@reversemargin \@tempcnta -\@tempcnta \fi + \fi + \ifnum\@tempcnta <\z@ \global\setbox\@marbox\box\@currbox \fi + \@tempdima\@mparbottom + \advance\@tempdima -\@pageht + \advance\@tempdima\ht\@marbox + \ifdim \@tempdima<\z@ \@tempdima\z@ \fi % Modification + \global\@mparbottom\@pageht + \global\advance\@mparbottom\@tempdima + \global\advance\@mparbottom\dp\@marbox + \global\advance\@mparbottom\marginparpush + \advance\@tempdima -\ht\@marbox + \global\setbox \@marbox + \vbox {\vskip \@tempdima + \box \@marbox}% + \global \ht\@marbox \z@ + \global \dp\@marbox \z@ + \kern -\@pagedp + \nointerlineskip + \hb@xt@\columnwidth + {\ifnum \@tempcnta >\z@ + \hskip\columnwidth \hskip\marginparsep + \else + \hskip -\marginparsep \hskip -\marginparwidth + \fi + \box\@marbox \hss}% + \nointerlineskip + \hbox{\vrule \@height\z@ \@width\z@ \@depth\@pagedp}} +\else +% \end{macrocode} +% It didn't match. Inform the user of what is to come. +% \begin{macrocode} + \typeout{Expect a lot of ``Marginpar moved'' warnings.} +\fi +\let\@tempa=\relax +% \end{macrocode} +% +% +% \section{Things not to index} +% +% \begin{macrocode} +\DoNotIndex{\def,\let,\else,\fi,\then,\x_cs,\x_relax} +\DoNotIndex{\csname,\endcsname,\string,\the,\expandafter,\noexpand} +\DoNotIndexBy{@@}\DoNotIndexBy{@}\DoNotIndexBy{_}\DoNotIndexBy{FD@} +% \end{macrocode} +% +\endinput + diff --git a/Master/texmf-dist/source/fontinst/base/fisource.tex b/Master/texmf-dist/source/fontinst/base/fisource.tex new file mode 100644 index 00000000000..b5a5cab7e76 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/fisource.tex @@ -0,0 +1,2985 @@ +% +% Copyright 1998, 1999, 2000 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. +% ----------------------------------------------------- +% +% 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.0 or, at your option, any later version. +% +\documentclass{ltxdoc} +\usepackage[dolayout,fileispart]{fisource} + +\usepackage{longtable} + +\RecordChanges +\EnableCrossrefs + +\IndexPrologue{% + \section*{Index}% + \addcontentsline{toc}{section}{Index}% + \markboth{Index}{Index}% + Compound numbers (numbers with a hyphen) refer to a code line, and + the letter that is the first part of such a number specifies the + source file the code line is in, as explained by the file key below. + Simple numbers refer to pages. Numbers written in italics refer to + places where the corresponding entry is described, the ones + underlined to where it is defined, and the rest to where it is used. +} +\GlossaryPrologue{% + \section*{Change History}% + \addcontentsline{toc}{section}{Change History}% + \markboth{Change History}{Change History}% +} + + +\makeatletter +\newcommand{\offindex}{\let\index\@gobble} + +\newcommand{\consumption}{% + \begingroup + \endlinechar=`\&\relax + \expandafter\endgroup\consumption@i +} +\def\consumption@i#1#2{% + \ifhmode{\parskip=\z@\@plus\p@\relax\par}\fi + Time elapsed: #1\,s\par + \tabskip=\leftmargin \advance \tabskip 1em\relax + \halign{&\hfil##\ \tabskip=\z@skip&##\hfil\tabskip=1em\cr + \omit\span \textbf{Stacks}&\omit\span \textbf{Others}\cr + \consumption@ii#2\@nil + }% +} +% #1 = number of strings used +% #3 = string characters used +% #5 = words of memory used +% #7 = number of multiletter control sequences used +% Other parameters are garbage. +\def\consumption@ii#1 #2 #4 #6 #8	&{% + \consumption@iii{{#1}{#3}}{{#5}{#7}}% +} +\def\consumption@iii#1#2#3i,#5n,#6p,#7b,#8s#9\@nil{% + #4& input sources& \@secondoftwo#2& multiletter control + sequences\cr + #6& parameters& \@firstoftwo#1& strings\cr + #7& buffer characters& \@secondoftwo#1& string characters\cr + #8& saved values& \@firstoftwo#2& main memory words\cr +} +\makeatother + +\newenvironment{smalldes}{% + \list{}{% + \setlength\labelwidth{0pt}% + \setlength\itemindent{-\leftmargin}% + \setlength\listparindent{1em}% + \setlength\parsep{0pt}% + \setlength\itemsep{0pt plus 1pt}% + \setlength\topsep{\itemsep}% + \let\makelabel\descriptionlabel + }% +}{\endlist} + +% \includeonly{} +\iffalse +\MakeShortVerb{\|} +\fi + +\title{The \package{fontinst} utility} +\author{Alan Jeffrey, Sebastian Rahtz, Ulrik Vieth, Lars Hellstr\"om} + +\begin{document} +\maketitle +\tableofcontents +\clearpage + +\part*{About the \package{fontinst} package} +\addcontentsline{toc}{part}{The \package{fontinst} documentation} + +This document implements and describes version~1.9 of +\package{fontinst}. + + + +\section{Files} + +\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}. + + +\subsection{Generated files} + +By running the \package{docstrip} installation script +\texttt{fontinst.ins}, the following files are generated: +\begin{description} + \item[\texttt{fontinst.sty}] This is the executable file that + contains all the commands that set up the \package{fontinst} + utility for use. + \item[\texttt{xfntinst.sty}] This is a variant of + \texttt{fontinst.sty} in which the |\latin|\-|family| command + behaves differently with respect to from which fonts the digits + are picked (see below). + \item[\texttt{cfntinst.sty}] This is a variant of + \texttt{fontinst.sty} which supports the old way of selecting + boundarychar for fonts (i.e., by setting the integer + |boundarychar|). It requires a bit more memory than + \texttt{fontinst.sty} does. + \item[\texttt{fontinst.ini}] This file contains some very basic + initialization code. It is used in case \package{fontinst} is used + under ini\TeX\ without a preloaded format. + \item[\texttt{finstmsc.sty}] This file contains the routines for + automatic map file generation, which can now generate map files + for the \package{dvips} and \package{dvipdfm} drivers. The system + is extendable, so users interested in generating map files for + other drivers can extend the mapfile writer's capabilities by + adding code to their \texttt{finstmsc.rc} files. \emph{Contributions + of such code is welcome}. This file also contains some seldom-used + code (the ENC to ETX conversion) that has been broken off from + the main \package{fontinst} utility, as it almost always just sat + there and used up space for no good reason. + \item[\texttt{fontdoc.sty}] This file contains the \package{fontdoc} + package, which can be used to typeset encoding and metric files. + \item[\texttt{csc2x.tex}] This file contains the reglyphing commands + that set up the common caps-and-small-caps to expert names + conversion. See Subsections~\ref{Ssec:Des:Reglyph} + and~\ref{Ssec:Reglyph} for details. + \item[\texttt{csckrn2x.tex}] This file is a variant of + \texttt{csc2x.tex}, which doesn't copy the commands that actually + set glyphs. + \item[\texttt{osf2x.tex}] This file is a variant of + \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)} + + +\subsection{Modules} + +The source is split up on the following \package{docstrip} modules: +\begin{description} + \item[\Module{boundaryCompability}, \texttt{fimain}] + Guards code that is needed for \package{fontinst} to be compatible + with the old interface for boundary ligatures and kerns. + \item[\Module{!boundaryCompability}, \texttt{fimain}] + Guards code that is used when \package{fontinst} is not to be + compatible with the old interface for boundary ligatures and kerns. + \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}] + 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 + beginning of each file that makes it possible to typeset as a + \LaTeX\ document. \texttt{docstrip.ins} doesn't extract this + code, but it is possible to write a script that makes + \package{docstrip} extract this code if one wants to write a + modified driver. It's not usual, though. + \item[\Module{everyjob}, \texttt{fibasics}] + Guards the code setting |\everyjob| for fontinst formats (by + default not used). + \item[\Module{!glyphs}, \texttt{ficonv}] + Guards reglyphing setup code that is relevant when commands that + set glyphs are not to be copied. + \item[\Module{glyphs}, \texttt{ficonv}] + Guards reglyphing setup code that is relevant when commands that + set glyphs are to be copied. + \item[\Module{ini}, \texttt{fibasics}] + Guards the code for \texttt{fontinst.ini}. + \item[\Module{map}, \texttt{fimapgen}] + Guards the code for the automatic map file generation. + \item[\Module{misc}, \texttt{fibasics}, \texttt{fimain}, and + \texttt{ficonv}] + Guards code that is only to go into \texttt{finstmsc.sty}. + \item[\Module{!misc}, \texttt{fibasics}] + Guards code that is not to go into \texttt{finstmsc.sty}. + \item[\Module{obsolete}, \texttt{ficommon} and \texttt{fimain}] + Guards miscellaneous pieces of code that are considered obsolete. + \item[\Module{oldstyle}, \texttt{filtfam}] + Guards code in the |\latinfamily| section. The purpose of that + code is described in more detail in Section~\ref{Sec:NotesOnUsing}. + \item[\Module{oldTeX}, \texttt{fibasics}] + Guards code that copes with a bug in \TeX\ versions before 3.141. + \item[\Module{!oldTeX}, \texttt{fibasics}] + Guards normal code that wouldn't work satisfactory for + \TeX\ versions before 3.141 due to a bug in those \TeX s. + \item[\Module{pkg}, all files] + Guards code that is to go into \texttt{fontinst.sty} (and its + variants). + \item[\Module{pkg2}, \texttt{fibasics}] + A special variant of \Module{pkg} that is used for code that is + to end up at the very end of \texttt{fontinst.sty}. + \item[\Module{reglyphletters}, \texttt{ficonv}] + Guards code that sets up for changing lower case letter names to + corresponding smallcaps names. Used for \texttt{csc2x.tex} and + \texttt{csckrn2x.tex}. + \item[\Module{reglyphfigures}, \texttt{ficonv}] + Guards code that sets up for changing ordinary figure names to + corresponding \texttt{oldstyle} names. Used for + \texttt{osf2x.tex}, \texttt{csc2x.tex}, and + \texttt{csckrn2x.tex}. + \item[\Module{reglyph}, \texttt{ficonv}] + Guards code that is to go to the reglyphing setup files + \texttt{csc2x.tex} and \texttt{csckrn2x.tex}. + \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}] + Guards some code that is ``under construction''. +\end{description} + + + +\section{About previous \package{fontinst} releases} + +\subsection{Pre-\package{doc} fontinst releases} + +The following is a choice of some \package{fontinst} versions and some +comments about them. The complete list of versions in the range +v\,0.01--1.7 can be found in the file \texttt{CHANGES}. +\begin{description} +\item[v\,0.01] + was begun by Alan Jeffrey in February 1993. This was the + very first version recorded in the \texttt{CHANGES} file. +% +\item[v\,0.19] + was completed in April 1993 and presented at the TUG~'93 + conference in July 1993. It is described in the proceedings + in \emph{TUGboat}~14\#3 and represents one of the earliest + release versions, in which the user interface was still + subject to change. +% +\item[v\,1.0] + was begun in August 1993 right after the conference and + represents the beginning of a complete re-write from scratch. +% +\item[v\,1.333] + was presented one year later at the TUG~'94 conference and + is described in the proceedings in \emph{TUGboat}~15\#3. + It uses a different user interface, which is largely the same + as in the present version, although the internals of the + implementation have subsequently changed quite a bit. +% +\item[v\,1.335] + was released in September 1994 and was the last ``official'' + release version by Alan Jeffrey. Until the summer of 1998 this was + still the version to be found in the \texttt{fonts}\slash + \texttt{utilities}\slash\texttt{fontinst} directory on CTAN. + It is considered obsolete and should not be used any longer. +% +\item[v\,1.400] + was prepared in November 1994 and was the first version which + used |8r|-encoded raw fonts as a basis for virtual fonts. +% +\item[v\,1.500] + appeared on CTAN in \texttt{fonts}\slash\texttt{psfonts}\slash + \texttt{tools} in September~1995 together with Sebastian Rahtz's + Unix shell scripts to automate the installation. This version + included a completely revised implementation of |\latinfamily| and + added the |\installrawfont| command to install ligful raw fonts. +% +\item[v\,1.504] + appeared on CTAN in \texttt{fonts}\slash\texttt{psfonts}\slash + \texttt{tools} in January~1996. It added code to install (real or + faked) small caps fonts and to fake narrow fonts, if they don't + exist. +% +\item[v\,1.511] + was one of the last beta versions by Alan Jeffrey which dates back + to June~1996, but for some reason was never released. It uses + the encodings |9o| and~|9d| instead of |9t| and~|9e| to install + expertized oldstyle fonts, but this change never found its way + into subsequent ``unofficial'' releases until v\,1.8. +% +\item[v\,1.6] + appeared on CTAN in \texttt{fonts}\slash\texttt{psfonts}\slash + \texttt{tools} in February~1997 and was the first ``unofficial'' + version of \package{fontinst} maintained by Sebastian Rahtz. It + contains only minor changes compared to v\,1.504, such as switching + to lowercase file names, searching for |.pl| files before |.afm| + files, and adding the \texttt{textcomp} installation to the + distribution. +% +\item[v\,1.6] + was re-issued on CTAN in September~1997, when the Unix shell + scripts were replaced by Perl scripts. The \package{fontinst} + package itself didn't change apart from minor changes of the + debugging messages. +% +\item[v\,1.7] + is the latest ``unofficial version'', which was released on CTAN + in May~1998. It includes some changes to the mapping between + \texttt{fontname} and \LaTeX{} weight codes proposed by Ulrik + Vieth, as well as some code to support the use of |8r|-encoded + |.afm| files generated by |ttf2afm|. +% +\end{description} +% + +\subsection{About fontinst v\,1.8} + +Version~1.8 of the \package{fontinst} utility was the first to have +been converted to \package{docstrip} format (this was made by Ulrik +Vieth) and it was first released in June~1998. It is based on +Sebastian Rahtz's ``unofficial'' \package{fontinst} releases v\,1.6 +and~1.7 as of February~1997 and May~1998, which, in turn, are based +on Alan Jeffrey's versions v\,1.500 and~1.504 of September~1995 +and January~1996. In addition, version v\,1.8 also incorporated +some code from Alan Jeffrey's last beta version, v\,1.511, +which dates back to June~1996, but was never released to the +general public for some reason. + +% It should be noted that all these versions differ significantly +% from the previous ``official'' version v\,1.335 as of September~1994, +% which was the only one to be found in the \texttt{fontinst} directory +% on CTAN until the summer of 1998. Version v\,1.335 is now obsolete. + +Version~1.8 was agreed upon by the \package{fontinst} hacker community, +as represented on the \package{fontinst} mailing list, as the new +officially endorsed version, on which all further additions and +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: +\begin{itemize} + \item The old multiple |\setkern| bug, which resulted in pointless + |KRN| instructions being written to (V)PL files have been fixed. + In addition, it is now possible to reset kerns (using + |\resetkern|) and unset kerns (using |\unsetkerns|, + |\noleftkerning|, |\norightkerning|, or |\noleftrightkerning|). + \item A bug which resulted in too few kerns being written to a font + if the same glyph is used in more than one slot (this occurs if + you make an all-caps font from an encoding definition file which + sets |\lc|, |\lctop|, and |\lclig| to the same to their + |\uc|\textellipsis\ counterparts) has been fixed. A consequence of + this fix is that you cannot access the number of the slot that + glyph \meta{glyph} has been assigned to as |\int|\marg{glyph} + (unless you are using \texttt{cfntinst.sty}), but there really is + no need for you to do so either. + \item There is now a proper interface for using left and right + boundaries which, in contrast to the old setting of the integer + \texttt{boundarychar}, can make use of the full generality of the + PL format. (The old interface is still available if you use + \texttt{cfntinst.sty}.) + \item \package{fontinst} can now interpret AFM files which contain + non-integer dimensions. There is also a user-level interface for + changing the formula according to which the italic corrections of + glyphs are computed. + \item The PL to MTX converter can now cope with the VPL-unique + property lists |VTITLE|, |MAP|, and |MAPFONT|, which means that it + can now convert VPL files as well. In addition to this, there are + a couple of minor bugfixes and improvements in the PL to MTX + conversion. + \item There is now a way of overriding the PL to MTX converter's + automatic choice of encoding definition file made based on the + |CODINGSCHEME| property of a PL file. The command |\generalpltomtx| + lets you select which encoding definition file you want to use, as + does the new |\fromplgivenetx| transformed font command. + \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. + % 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 + handles uniform scaling internally; the driver only needs to do + $x$-scaling and slanting. This can result in different font metrics, + but we think only in that it comes out more like one would expect. + The user interface is the same. + \item There is now a new transformed font command |\fromany| which + searches for a font metric file in any of the four formats MTX, + PL, AFM, and VPL; converting it to MTX format and possibly + generating a PL as well if necessary. This command is also used by + |\installfont|, |\installrawfont|, and |\reglyphfont| to search + for font metric files, so these can now take VPL files as a + source for font metric data. + \item There is now a mechanism for generating the necessary map files + automatically. So far it knows how to generate map files for the + \package{dvips} and \package{dvipdfm} drivers, but the system can + easily be extended by adding code in the \texttt{finstmsc.rc} file. + \item There are two new commands |\setscaled|\-|rawglyph| and + |\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 + 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 + \package{fontinst} can now be used directly as a base for other + fonts (it used to be necessary to convert them to binary format and + back to get the metrics right). + \item \texttt{finstmsc.sty} now contains a new command which + generates a Postscript encoding (\texttt{.enc}) file from an ETX + file. The syntax of this command is + \begin{quote} + |\etxtoenc|\marg{etxfile}\marg{encfile} + \end{quote} + Usually you don't need to use this command, since the routines + which generate map files will call it when the encoding used in a + |\reencodefont| isn't known. + \item The new command + \begin{isyntax} + |\installfontas|\marg{font}\marg{encoding}\marg{family}% + \penalty0\marg{series}\penalty0\marg{shape}\penalty0\marg{size} + \end{isyntax} + adds an entry for \meta{font} with the given NFSS parameters to + the corresponding FD file. + \item The |\set|\textellipsis, |\reset|\textellipsis, and + |\unset|\textellipsis\ commands now behaves as one would expect + even when they occur between |\install|\-|fonts| and |\end|\-% + |install|\-|fonts|---the assignments they make are no longer + subject to the grouping around the metrics of individual fonts. + Assignments made by these commands when they occur in MTX and ETX + files \emph{are} however still subject to this grouping, so that + behaves as usual. + \item There are two control flow commands |\for| and |\foreach| + which repeatedly execute a given sequence of commands---just like + a normal programming language \texttt{for} loop. With |\for| the + loop variable is an integer that is incremented or decremented by + an amount that is specified in the beginning of the loop. With + |\foreach| the loop variable is a string which assumes all the + values given in a comma-separated list. + \item The command |\offcommand| turns a command `off', i.e., makes + it gobble its arguments and do nothing. The command |\oncommand| + turns a command back on, i.e., restores the original definition of + a command that had been turned off. Turning a command off or on + when it is already off or on respectively has no effect. + \item If you begin an item in the file-list argument (\#2) of + |\install|\-|font| or |\install|\-|raw|\-|font| with the command + |\metrics|, then that item (everything up till the next comma + that is not inside a group) will be interpreted as explicit metric + commands that are executed after the previous font was loaded and + before the next is. Thus you can do e.g. + \begin{quote} + |\installfont{|\textellipsis|}{a,\metrics\unsetint{xheight},b,|% + \textellipsis + \end{quote} + if you want font \texttt{a} to be loaded before font \texttt{b}, + but want to use the \texttt{xheight} value of font \texttt{b}, + and you don't want to bother writing an MTX file that simply + contains the command |\unsetint{xheight}|. + \item There is now a command |\fontinstcc| which switches to the + catcodes that are in force for most of the time that + \texttt{fontinst.sty} is read (|@| and |_| are letters, |~| is a + space, and spaces and newlines are ignored). This makes it simpler + to redefine internal control sequences. To switch back to the + normal catcodes, there is the |\normalcc| command. Neither + command has any arguments. + \item The |\Unicode| command may be used to specify what + ISO\,10646\slash Unicode character a slot corresponds to. See + page~\pageref{Unicode} for details. + \item The third arguments of the |\installfont| and + |\install|\-|raw|\-|font| commands can now be a comma-separated + list of ETX files. + \item File names in the second and third arguments of + |\install|\-|font| and |\install|\-|raw|\-|font| may now be + suffixed by zero or more \emph{modifier clauses} that can change + the interpretation of a file by e.g.~assigning special values to + some variables while the file is read in. This is described in + Subsection~\ref{Ssec:FontInstCmds} below. + \item The |\setfontdimen| command allows an ETX file to declare + which integer variables correspond to font dimensions in a (V)PL + file. This correspondence is used both when generating a ligful + (V)PL file and when a (V)PL file is converted to an MTX file. +\end{itemize} + + +\subsection{Metric packages} + +\package{fontinst} has traditionally come with a collection of MTX +files that complement the MTX files generated from base font metrics, +in that they build glyphs that may be missing from the base fonts or +in some other way needs to be improved. The most well-known of these +is the \texttt{latin.mtx} file; other examples include +\texttt{textcomp.mtx}, \texttt{mathit.mtx}, and \texttt{latinsc.mtx}. +A problem with these is however that they cannot produce optimal +results for all fonts simply because there are irregular differences +in how fonts are set up by the foundries. Most glyphs come out alright, +but there are usually a few for which the parameters used are more or +less wrong. Therefore most high quality font installations are made +with modified versions of these files, where the parameters have been +tuned to the specific font design. + +Modifying in particular \texttt{latin.mtx} is however not an entirely +easy task, because this is a rather large file (with plenty of +archaic pieces of code in curious places). Doing it once is no big +problem, but if one has to do it several times (maybe because some +errors are discovered in the original \texttt{latin.mtx}) then it is +probably no fun anymore. Furthermore, if one has two or three +modified copies of this file because one has made high quality +installations of that many different fonts then even a trivial bugfix +might start to feel like entirely too much work. + +If one has to make modifications then it is usually easier to deal +with several small files (many of which can be used unchanged) than +one big file. Thus it would be better if these big files were split up +into several smaller ones. +The main problem with splitting up something like \texttt{latin.mtx} +is that there are some commands which are defined at the top and +which are then used in almost all sections of the file. One must make +certain that these commands are always loaded, which makes the metric +files somewhat harder to use (especially if the one who tries to use +them is not the one who wrote them). + +One strategy is to include all definitions needed for a metric file in +it. This has the slight disadvantage that the commands will have to be +defined several times. What is worse however, is that the command +definitions will appear in several files, so if one finds a bug in one +of them, one cannot simply correct this bug in one place. As the number +of files can soon become quite large, correcting such bugs can become +a boring procedure indeed. + +Another strategy is to put all the command definitions in one file +and then explicitly include it in the \meta{file-list} argument of +|\installfont|. This eliminates the repeated bug fixing problem, but +requires the user to do something that the computer can actually do +just as well. + +A third strategy is to put the command definitions in one or several +files and then in each metric file the user explicitly mentions load +the command definitions needed for that particular file. Metric +packages uses an improved version of this strategy, since they also +make it possible for fontinst to remember which packages (i.e., sets +of command definitions) that have already been loaded, so that they +are not unnecessarily loaded again. The \texttt{newlatin.mtx} file is +an alternative to \texttt{latin.mtx} that implements this strategy. +Most of the actual code is located in the following metric packages: +\begin{longtable}{l p{0.7\linewidth}} + \texttt{ltcmds.mtx}& Defines some common commands used by the other + files.\\ + \texttt{llbuild.mtx}& Builds the latin lower case alphabet + (unaccented letters are `unfakable', the rest are constructed if + not present in the base fonts).\\ + \texttt{lubuild.mtx}& Builds the latin upper case alphabet.\\ + \texttt{lsbuild.mtx}& Builds accented letters in the latin + smallcaps alphabet, but only if there are unaccented letters to + build them from in the base fonts.\\ + \texttt{lsfake.mtx}& Fakes a latin smallcaps alphabet by shrinking + the upper case alphabet, but only if the glyph had not already + been manufactured.\\ + \texttt{lsmisc.mtx}& Make some miscellaneous smallcaps glyphs + (mostly ``smallcaps f-ligatures'').\\ + \texttt{ltpunct.mtx}& Makes digits, punctuation marks, and other + symbols (mostly by marking as ``unfakable''). +\end{longtable} +\noindent All of these are easy to use as components of equivalents +of a modified \texttt{latin.mtx} files, and all dependencies of one +package upon another are handled via explicit |\usemtxpackage| +commands. + +For information on the syntax etcetera of commands related to metric +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 +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 +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 +a pseudoglyph even if an |\ifisglyph| test evaluates to false. The +interesting point about pseudoglyphs when considering word boundaries +however, is that a pseudoglyph can have ligatures and kerns. + +Kerns and ligatures at the left word boundary (beginning of word) are +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 +pseudoglyph will do just fine. + +|\ligature| commands between |\setleftboundary| and +|\endsetleftboundary| will generate beginning of word ligatures. Kerns +on the right of the glyph specified in |\setleftboundary| will become +beginning of word kerns. + +Kerns and ligatures at the right word boundary (end of word) are +trickier, due to the asymmetrical nature of the ligkern table in a PL +file. What a font can do is to specify that the right word boundary, +for purposes of kerning and ligatures, should be interpreted as +character $n$. By including a kern or ligature with character $n$ on +the right, that kern or ligature will be used at the end of a word, +but it will also be used each time the next character is character +$n$. Because of this, one usually wants the slot $n$, which the right +word boundary is interpreted as being, to be empty whenever the +encoding allows this. + +The command +\begin{quote} + |\setrightboundary|\marg{glyph} +\end{quote} +will mark the current slot as used to denote the right word boundary, +and leave the slot empty, increasing the current slot number by one +just like a |\setslot| \textellipsis\ |\endsetslot| block does. Kerns on +the left of \meta{glyph} will be end of word kerns and |\ligature| +commands with \meta{glyph} as the second argument will be for the end +of a word. + +The command +\begin{quote} + |\makerightboundary|\marg{glyph} +\end{quote} +is similar to |\setrightboundary|, but it is a slot command which may +only be used between a |\setslot| and the matching |\endsetslot|. Like +|\setrightboundary|, it marks the current slot as used to denote the +right word boundary, but the glyph specified in the enclosing |\setslot| +will be written to that slot. Ligatures for the glyph specified by the +|\setslot| and ligatures for the glyph specified by the +|\makerightboundary| will both be for this single slot. Kerns on the +right of the |\setslot| glyph and the |\makerightboundary| glyph will +similarly both be for this single slot. The idea is that the |\setslot| +glyph should be used when making a kern or ligature for that glyph, +while the |\makerightboundary| glyph should be used when making a kern +or ligature for the end of a word. \package{fontinst} will warn you if +these two uses of the slot directly contradict each other. + + +\subsection{Changing the names of glyphs} +\label{Ssec:Des:Reglyph} + +Sometimes, primarily when making a virtual font from more than one raw +font and two of the raw fonts contain different glyphs with the same +name, it becomes necessary to change the names of some glyphs to make +some sense out of it. The main source of this kind of trouble is the +``caps and small caps'' (SC) and ``oldstyle figures'' (OsF) fonts +within many commercial font families. The typical problem is that what +is typographically different glyphs---such as the lowercase `a' +(\texttt{a}, for \package{fontinst}) and the smallcaps `\textsc{a}' +(\texttt{Asmall}, for \package{fontinst})---are given the same name by +the foundry. + +One way to get round this is to say for example +\begin{quote} + |\setglyph{Asmall} \glyph{a}{1000} \endsetglyph|\\ + |\setleftrightkerning{Asmall}{a}{1000}|\\ + |\unsetglyph{a}|\\ + |\noleftrightkerning{a}| +\end{quote} +and continuing like that for all the duplicate glyph names. This is +however a rather prolix method and if the number of glyphs is large +then it is usually simpler to use the |\reglyphfont| command. + +To reglyph one or several fonts, one writes +\begin{quote} + |\reglyphfonts|\\ + \vadjust{}\quad \meta{reglyphing commands}\\ + |\endreglyphfonts| +\end{quote} +There are two types of reglyphing commands: the |\reglyphfont| +command, and the commands that modify what |\reglyphfont| will do to +the fonts it operates on. The syntax of |\reglyphfont| is +\begin{quote} + |\reglyphfont|\marg{destination font}\marg{source font} +\end{quote} +The \meta{source font} font here is the name (suffix not included, of +course) of the font metric file one wants to change the glyph names in. +This font metric file can be in any of the formats MTX, PL, AFM, and +VPL, and it will be converted to MTX format if it isn't already in +that format (this happens just as for files listed in the second +argument of |\installfont|). \meta{destination font} (which must be +different from \meta{source font}) will be taken as the name for a +new \texttt{.mtx} file that will be generated. The destination font +can differ from the source font only in two ways: the names of some +glyphs in the source font might be changed, and some of the commands +from the source font might not have been copied to the destination +font. To what extent the fonts are different is determined by what +modifying commands have been executed; when no modifying commands +have been executed, the source and destination font are equal. + +The modifying reglyphing commands are +\begin{quote} + |\renameglyph|\marg{to}\marg{from}\\ + |\renameglyphweighted|\marg{to}\marg{from}\marg{weight}\\ + |\killglyph|\marg{glyph}\\ + |\killglyphweighted|\marg{glyph}\marg{weight}\\ + |\offmtxcommand|\marg{command}\\ + |\onmtxcommand|\marg{command} +\end{quote} +|\renameglyph| simply declares that occurrences of the glyph name +\meta{from} should be replaced by the glyph name \meta{to}. To each +glyph name is also assigned a \emph{weight}, which is used by a +mechanism which conditions copying of commands from the source font to +the destination font by the set of glyphs that command mentions. The +details of this mechanism are however somewhat tricky, so those +interested in the full generality should go to Subsection~\ref +{Ssec:Reglyph}. Here it needs only be noted that if one applies +|\killglyph| to a glyph name, then (under most circumstances) commands +that refer to that glyph name will not be copied to the destination +font. + +|\offmtxcommand| and |\onmtxcommand| also control whether commands are +copied to the destination font, but they look at the actual command +rather than the glyphs it refers to. For example, after the command +\begin{quote} + |\offmtxcommand{\setkern}| +\end{quote} +no |\setkern| commands will be copied. By using |\offmtxcommand|, it +is possible to achieve effects similar to those of the files +\texttt{kernoff.mtx} and \texttt{glyphoff.mtx}---the difference is +that with |\offmtxcommand|, it happens at an earlier stage of the font +generation. As expected, |\onmtxcommand| undoes the effect of +|\offmtxcommand|. + +A special rule pertains to the |\set|\-|raw|\-|glyph|, +|\set|\-|not|\-|glyph|, |\set|\-|scaled|\-|raw|\-|glyph|, and +|\set|\-|scaled|\-|not|\-|glyph| commands, since |\transformfont| +doesn't care what something was in the source font when it generates +the transformed font. To turn these commands off while reglyphing, +you use |\offmtx|\-|command| on |\set|\-|scaled|\-|raw|\-|glyph|. + +The effects of modifying reglyphing commands are delimited by +|\reglyphfonts| and |\endreglyphfonts|, which starts and ends a group +respectively. + +As we expect the most common reglyphing operation will be to go from SC +glyph names to expert glyph names, there is a file \texttt{csc2x.tex} +in the \package{fontinst} distribution which contains the modifying +reglyphing commands needed for setting up that conversion. Thus you +can write for example +\begin{quote} + |\reglyphfonts|\\ + | \input csc2x|\\ + | \reglyphfont{padrcx8r}{padrc8r}|\\ + | \reglyphfont{padscx8r}{padsc8r}|\\ + |\endreglyphfonts| +\end{quote} +to alter the glyph names in the SC fonts in the Adobe Garamond +(\texttt{pad}) family. +Note that the names of the destination fonts here really are rather +arbitrary, since they will only exist as \texttt{.mtx} files, and +thus only need to work within your local file system. In particular, +all the |\setrawglyph| commands in the destination font files still +refer to the source font, so it is that font which the drivers need +to know about. + + +\subsection{Making map file fragments} + +A \emph{map file fragment} is the lines\footnote{Not in general an +entire map file, hence the word \emph{fragment}.} of a map file that +the corresponding driver would need for handling some set of fonts. +When told to, \package{fontinst} can (in a fairly automatic way) create +the map file fragment which is needed for the set of raw fonts +\package{fontinst} has (i) installed directly (using |\installrawfont|) +or (ii) used as a base font for some installed virtual font (generated +by |\installfont|). \package{fontinst} does not support the map file +syntaxes of every existing driver, but the system is designed to be +extendable and contributions that extend its capabilities are welcome. +Nor can \package{fontinst} examine your \TeX\ system and +determine every piece of information needed to make the correct map +file fragments, but you can tell it roughly how your installation +looks, it can make guesses which work most of the time, and you can +specify most things explicitly if the guesses turn out to be wrong. +Should the available options for configuring the process turn out to +be inadequate for your needs, then please write to the +\package{fontinst} mailing list about this---there is probably a way +to improve the system so that your needs can be met. + +Now what does one have to do to use this map file fragment writer, +then? First you need to tell \package{fontinst} to record the +information the map file fragment writer needs. You do this by giving +the command +\begin{quote} + |\recordtransforms{whatever.tex}| +\end{quote} +at the beginning of the run. Here \texttt{whatever.tex} is the name of +a file that will be created, so you can use some other name if you +like. After that you do all the calls to |\transform|\-|font|, +|\install|\-|font|, |\install|\-|raw|\-|font|, |\latin|\-|family|, +etc.\ you need to make the fonts you want. When you're done, you give +the command +\begin{quote} + |\endrecordtransforms| +\end{quote} +and end the run (say |\bye|). The file \texttt{whatever.tex} will now +contain the information about which fonts were used and what needs to +be done with them. + +The second step is to actually run the map file fragment writer. +Observe that it is located in the file \texttt{finstmsc.sty}, not +\texttt{fontinst.sty}! The commands you need to give it can be so few +that you can type them in at \TeX's \texttt{*} prompt, but if you are +writing a command file then it should typically have the following +structure (comments not necessary, of course): +\begin{quote} + \begin{tabular}{ll} + |\input finstmsc.sty|& |%| Input command definitions\\ + \meta{general settings} & |%| See below\\ + |\adddriver|\marg{driver name}\marg{output file}& + |%| Open output file\\ + |\input whatever.tex|& |%| Write to output file\\ + |\donedrivers|& |%| Close output file(s), tidy up\\ + |\bye|& |%| Quit + \end{tabular} +\end{quote} +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 +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 +driver as output, but for the moment only the \texttt{dvips} and +\texttt{dvipdfm}\footnote{Whose support I made very much to illustrate +that you \emph{don't} have to be a big and ancient driver like +\texttt{dvips} to have supporting code put into \package{fontinst}. +(The fact that I just happened to have printed out the documentation and +that is was easy to read also helped, of course.) Note, however, that +there won't be any support for a driver unless someone sits down and +writes the code for it! Don't assume I will. /LH} drivers are supported. +You may also use \texttt{debug} for \meta{driver name}; the entries in +the file for that ``DVI driver'' simply contain all the available +information about each font (hence it should come handy for debugging +code writing entries for real drivers) in a format that should be easy +to interpret for a human. It could be the right choice if you're going +to write the map file manually. + +The file \texttt{whatever.tex} in the above example contains the +commands (|\makemapentry| commands) that actually cause entries to be +written to the output file. It also contains a number of |\storemapdata| +commands---these describe how some given font was made. If some +metric file you have used contains |\setrawglyph| commands that were +not automatically generated by \package{fontinst}, then there might +not be a |\storemapdata| for the font they refer to in +\texttt{whatever.tex}, so you will have to include such a command +yourself somewhere. This can for example be done in the \meta{general +settings} part of the above example file. The syntax of the +|\storemapdata| command is described in Subsection~\ref{Ssec:interface}. + +Another class of things that will typically appear in the +\meta{general settings} part above is commands that will inform the +routines actually writing output about your \TeX\ system, about the set +of fonts you are using on this run, or about something else that might +be useful. Some such commands are of a general nature and affect what +assumptions \package{fontinst} will make in certain conditions when no +specific information is available. For the moment there commands are: +\begin{description} + \item[\cs{AssumeMetafont}] Assume all fonts with PL metrics are + bitmaps generated by Metafont, and therefore make no entries for + them. + \item[\cs{AssumeAMSBSYY}] Assume all fonts with PL metrics have their + \TeX\ names in all upper case as postscript names---just like the + Computer Modern fonts in the AMS\slash Blue~Sky\slash Y\&Y + distribution. + \item[\cs{AssumeBaKoMa}] Assume all fonts with PL metrics have their + \TeX\ names in all lower case as postscript names---just like the + Computer Modern fonts in the BaKoMa distribution. +\end{description} +Otherwise the default action of the routine for finding out the +postscript name of a font simply is to observe that it hasn't got a clue +about what the right value is when the metrics were taken from a PL +file, and therefore it writes `\texttt{??????}' for the postscript name. +\begin{description} + \item[\cs{AssumeLWFN}] Assume postscript fonts for which nothing + else has been specified are stored in files which are named + according to the \mbox{MacOS} scheme for + \texttt{LWFN}s.%\footnote{LaserWriter FoNt} +\end{description} +Otherwise the default action is to use the name of the AFM or PL from +which the metrics was originally taken, and add the file suffix stored +in the string \texttt{PSfontsuffix}. The default value of this string +is \texttt{.pfa}, but it can be changed using |\resetstr|. + +If neither the default nor the LWFN scheme produce correct results +then you may use the more specific \DescribeMacro\specifypsfont +|\specifypsfont| command, which describes exactly which file (or files, +if any) a given font is stored in. For syntax and examples of usage, +see Subsubsection~\ref{Sssec:Config-interface}. (I consider the +semantics of this command to still be under development, but in order +to know how to develop it further I need to know in which cases it is +insufficient.) + +Finally, there is the |\declarepsencoding| command which is used to +link ETX files to postscript encodings. If no postscript encoding has +been linked to a given ETX file then \package{fontinst} will +automatically create a postscript encoding (\texttt{.enc}) file for +that encoding, and use this file for all reencoding commands. Again, +see Subsubsection~\ref{Sssec:Config-interface} for syntax and examples +of usage. The \texttt{8r} encoding is predeclared, and it doesn't +matter if an encoding is undeclared if you never use it to reencode +fonts, but there is potentially a problem with not having declared +encodings you have installed and use for reencoding, as you may then +find yourself having two files with identical names that define +encodings that do not have the same name (as far as postscript is +concerned). + + +\subsection{On verbatim, typewriter, and monowidth fonts} + +The verbatim, typewriter, and monowidth concepts are common sources +of confusion for those who use \package{fontinst} to install fonts +with \AllTeX;\footnote{Myself \emph{not} excepted. /LH} in particular +there are many misconceptions about the relation between them. The +official view (of which not much has actually been brought forward) +is that these concepts are really about three quite different things. + +A font is a \emph{monowidth} (monospaced, fixed-pitch) font if all +glyphs in it have exactly the same width. Some font formats make +special provisions for such fonts; the most notable example is the +AFM format, where a single \texttt{CharWidth} keyword specifies the +width for all glyphs in the font. \package{fontinst} responds to this +by including the command +\begin{quote} + |\setint{monowidth}{1}| +\end{quote} +in the MTX file generated from an AFM, but that is everything that is +hard-wired into the program. That a font is monowidth is however +something that one should take note of when installing it for \TeX, +as it means many of the glyphs in it have such a strange appearance +that they are (pretty much) useless. The \texttt{endash} is for +example usually only half as long as the \texttt{hyphen} and the +letters in ligature glyphs are only half as wide as normal letters. +Many of the ETX and MTX files that come with \package{fontinst} +contain special commands to avoid making use of such degenerate +glyphs. + +That a font is a \emph{typewriter} font really only means that it has +a typewriterish look about it. The two most familiar typewriter fonts +are probably Computer Modern Typewriter (\texttt{cmtt}) and Courier. +Both of these fonts are monowidth, but there is no absolute rule about +this. One of the standard \TeX\ fonts is for example Computer Modern +Variable-width Typewriter (\texttt{cmvtt}), which is not a monowidth +font, as Figure~\ref{Fig:TTvsVTT} shows. +\begin{figure} + \begin{tabular}{ll} + \texttt{cmtt}:& \fontfamily{cmtt}\selectfont + The quick brown fox jumps over the lazy dog.\\ + \texttt{cmvtt}:& \fontfamily{cmvtt}\selectfont + The quick brown fox jumps over the lazy dog. + \end{tabular} + \caption{Two typewriter fonts} + \label{Fig:TTvsVTT} +\end{figure} + +The verbatim concept has very little to do with fonts at all; in +\LaTeX\ it is considered to be a property of the environment +(\texttt{verbatim}, \texttt{macrocode}, etc.) rather than a property +of the font. The connection there is with fonts is that the encoding +of the font must contain visible ASCII (as defined in Appendix~C +of \emph{The \TeX book}~\cite{TeXbook}) as a subset for the text to +be rendered correctly. The \texttt{cmtt} family is the only one amongst +the original Computer Modern fonts which meets this criterium and +that is the primary grounds for the idea that these three concepts +should be connected. Today that reason is at best a very weak one, as +all \texttt{T1}-encoded fonts also meet the criterium of containing +visible ASCII as a subset. + +A circumstance which has probably added to the confusion is that +\texttt{OT1} is usually claimed to be an encoding. In reality the +Computer Modern fonts that are declared in \LaTeX\ as being +\texttt{OT1} display as many as five different encodings, as shown in +Table~\ref{Tab:OT1-fonts}. +\begin{table} + \begin{tabular}{lccc} + & \texttt{TEX TEXT}& + \begin{tabular}[b]{c}\texttt{TEX TEXT WITHOUT}\\ + \texttt{F-LIGATURES}\end{tabular}& + \texttt{TEX TYPEWRITER TEXT}\\ + \noalign{\medskip} + non-italic& + \begin{tabular}{l} + \texttt{cmb10}\\ + \texttt{cmbx5}--\texttt{12}\\ + \texttt{cmbxsl10}\\ + \texttt{cmdunh10}\\ + \texttt{cmff10}\\ + \texttt{cmfib8}\\ + \texttt{cmr6}--\texttt{17}\\ + \texttt{cmsl8}--\texttt{12}\\ + \texttt{cmss8}--\texttt{17}\\ + \texttt{cmssbx10}\\ + \texttt{cmssdc10}\\ + \texttt{cmssi8}--\texttt{17}\\ + \texttt{cmssq8}\\ + \texttt{cmssqi8}\\ + \texttt{cmvtt10} + \end{tabular}& + \begin{tabular}{l} + \texttt{cmcsc8}--\texttt{10}\\ + \texttt{cmr5} + \end{tabular}& + \begin{tabular}{l} + \texttt{cmsltt10}\\ + \texttt{cmtcsc10}\\ + \texttt{cmtt8}--\texttt{12} + \end{tabular}\\ + \noalign{\medskip} + italic& + \begin{tabular}{l} + \texttt{cmbxti10}\\ + \texttt{cmfi10}\\ + \texttt{cmti7}--\texttt{12}\\ + \texttt{cmu10} + \end{tabular}&& + \begin{tabular}{l} + \texttt{cmitt10} + \end{tabular} + \end{tabular} + \caption{``\texttt{OT1}-encoded'' Computer Modern fonts, collected + according to the actual font encoding} + \label{Tab:OT1-fonts} +\end{table} +Since most monowidth fonts are only used for setting verbatim text, +there is some code in \texttt{ot1.etx} which automatically chooses a +\texttt{TEX TYPEWRITER TEXT} encoding for the font when the +\texttt{monowidth} integer is set. The only reason for this is the +guess that this is what the user wanted. + + +\subsection{Tuning accent positions---an application of loops} + +The accent placements made by \texttt{latin.mtx} certainly aren't +perfect for all fonts, and the only way to find out where they should +be put is through trying in text the accented letters you get for a +couple of values for the position parameter and deciding which one +works best. Since to try one parameter value you need to (i) edit it +into an MTX file, (ii) run \package{fontinst}, (iii) run +\package{VPtoVF}, (iv) run \TeX\ on some test text, and (v) print that +text, trying one parameter value can take annoyingly much time. +Repeating the same procedure ten times to test ten values is not +something one does without being bored (unless one scripts it, of +course), but it is possible to try ten parameter values in a single +virtual font, and without doing very much typing. + +Say you're not too happy with how \texttt{latin.mtx} positions the +accent in the \texttt{ohungarumlaut} glyph: +\begin{quote} + |\setglyph{ohungarumlaut}|\\ + | \topaccent{o}{hungarumlaut}{500}|\\ + |\endsetglyph| +\end{quote} +The |500| is the horizontal position (in thousandths of the width of +the \texttt{o}) that the center of \texttt{hungarumlaut} in the glyph +constructed will have, so that is the position parameter value that +you want to change. Create an MTX file containing the code +\begin{quote} + |\for(pos){250}{750}{50}|\\ + | \setglyph{ohungarumlaut\strint{pos}}|\\ + | \topaccent{o}{hungarumlaut}{\int{pos}}|\\ + | \endsetglyph|\\ + | \setleftrightkerning{ohungarumlaut\strint{pos}}|\\ + | {ohungarumlaut}{1000}|\\ + |\endfor(pos)| +\end{quote} +This will set eleven glyphs \texttt{ohungarumlaut250}, +\texttt{ohungarumlaut300}, \texttt{ohungarumlaut350}, \textellipsis\,, +\texttt{ohungarumlaut750}, each being an Hungarianly umlauted `o' +(i.e., an `\H{o}') but all having that umlaut in slightly different +positions. In order to put them in a font, you also need to make an +encoding that contains them. Therefore create an ETX file which +contains the code +\begin{quote} + |\relax\encoding|\\ + |\nextslot{"C0}|\\ + |\for(pos){250}{750}{50}|\\ + | \setslot{ohungarumlaut\strint{pos}}|\\ + | \endsetslot|\\ + |\endfor(pos)|\\ + |\endencoding| +\end{quote} +The command for installing this experiment font would be something like +\begin{isyntax} + |\installfont|\marg{some name}|{|\meta{the normal list of metrics}% + |,|\penalty0\meta{the new MTX}|}|\penalty0 + |{ot1,|\meta{the new ETX}|}|\penalty0|{OT1}|\textellipsis +\end{isyntax} +The reason for including \texttt{ot1} in the third argument above is +that you'll need letters other than `\H{o}' against which you can +compare the experimental glyphs. It would not have been possible to +use \texttt{t1} instead of \texttt{ot1} (even though that has more +Hungarian letters) since that would set all slots in the font and +leave none for these experimental \texttt{ohungarumlaut}s. + +It is even possible to use a loop for making the test text. The +\LaTeX\ macros +\begin{verbatim} +\newcount\slotcount +\newcommand\testtext[3]{% + \slotcount=#1\relax + \begin{description}% + \loop\item[\the\slotcount]#3% + \ifnum #2>\slotcount \advance \slotcount 1 \repeat + \end{description}% +} +\DeclareTextCompositeCommand{\H}{OT1}{o}{\char\slotcount} +\end{verbatim} +will let you write +\begin{quote} + |\testtext|\marg{first}\marg{last}\marg{text} +\end{quote} +to get the text \meta{text} typeset once for each slot from +\meta{first} to \meta{last} inclusive, with |\H{o}| ranging through the +glyphs in this interval. Thus in this case +|\testtext|\penalty\hyphenpenalty|{"C0}|\penalty\hyphenpenalty|{"CA}|% +\penalty\hyphenpenalty|{Erd\H{o}s}| would be a trivial test. + + +\subsection{Font installation commands} +\label{Ssec:FontInstCmds} + +The |\installfont|, |\installrawfont|, and |\installfontas| commands +have the respective syntaxes +\begin{isyntax} + |\installfont|\marg{font-name}\marg{metrics}\marg{etx-list}\penalty0 + \marg{encoding}\marg{family}\marg{series}\marg{shape}\marg{size}\\ + |\installrawfont|\marg{font-name}\marg{metrics}\marg{etx-list}^^A + \penalty0 + \marg{encoding}\marg{family}\marg{series}\marg{shape}\marg{size}\\ + |\installfontas|\marg{font-name}\penalty0\marg{encoding}^^A + \marg{family}\marg{series}\marg{shape}\marg{size} +\end{isyntax} +The \meta{font-name} argument and the last five arguments are common +to all these commands. The first argument is the name of a \TeX\ font +to install. The last five arguments are the NFSS attributes under which +that font will be declared to \LaTeX---encoding, family, series, shape, +and size. It is worth observing that encoding names are usually in +upper case, whereas the family, series, and shape are usually in lower +case. The size argument is either a shorthand (declared using +\DescribeMacro{\declaresize}|\declaresize|) for a particular font +size (or range of font sizes), or an explicit list of font sizes or +ranges of sizes, which is copied directly to the font declaration. +The most common case is to let the size argument be empty, as that is +declared as a shorthand for ``any size''. + +The |\installfontas| command does not itself create the font, it just +makes a note that the specified font declaration should be written to +the proper FD file at |\end|\-|install|\-|fonts|. The +|\install|\-|font| and |\install|\-|raw|\-|font| commands do however +produce the font, in the sense that they write a VPL and PL +respectively file for the font. It depends solely on the \meta{metrics} +and \meta{etx-list} arguments what this font will contain. Many +features of these arguments are new with \package{fontinst} v\,1.9; +therefore the complete syntaxes are described below. + +Both arguments are comma-separated lists of basically file names (not +including an extension). The files listed in the \meta{metrics} are +font metric files which together build up a \emph{glyph base} +(definitions of glyphs and metrics related to one or several glyphs), +whereas the files listed in the \meta{etx-list} are encoding definition +files that select a subset of the glyph base for turning into a +\TeX\ font. The font metrics can be in either of the four formats +MTX, PL, AFM, and VPL, which are considered in that order. If the +metrics are not originally in MTX format then they will be converted +to this format (a new file will be created) before they are used. +The encoding definitions must be in ETX format. The files actually +read will have a suffix \texttt{.mtx}, \texttt{.pl}, \texttt{.afm}, +\texttt{.vpl}, or \texttt{.etx} appended to the name given, depending +on which format is expected. + +Within each element of the comma-separated list, the actual file name +is followed by zero or more \emph{modifier clause}s. A \meta{modifier +clause} consists of a \emph{keyword} followed by some number (usually +one) of \emph{arguments}, separated by spaces. The whole thing looks +a lot like the \meta{rule specifications} of e.g.\ the |\vrule| +command, but here the spaces are mandatory. The currently defined +\meta{modifier clause}s are +\begin{description} + \item[\mdseries\textvisiblespace\texttt{option}\textvisiblespace + \meta{string}] + Available for metric and encoding files. This adds \meta{string} + to the list of options for this file, which may affect what code + the file executes. The file can then test, using the |\ifoption| + command, whether a specific string is one of the options it was + given. + \item[\mdseries\textvisiblespace\texttt{scaled}\textvisiblespace + \meta{factor}] + Available for metric files. Causes the \texttt{rawscale} integer + variable to be set to the \meta{factor} (an integer expression) + while the file is being read. This scales glyphs and kerns that + are added to the glyph base by the \meta{factor}. + \item[\mdseries\textvisiblespace\texttt{suffix}\textvisiblespace + \meta{suffix}] + Available for metric files. Causes \meta{suffix} to be appended + to every glyph name appearing in a glyph or kern that file adds + to the glyph base. Thus ``\texttt{suffix /2}'' effectively + changes a + \begin{quote} + |\setrawglyph{a}|\dots + \end{quote} + to a + \begin{quote} + |\setrawglyph{a/2}|\dots + \end{quote} + \item[\mdseries\textvisiblespace\texttt{encoding}\textvisiblespace + \meta{etx-name}] + Available for metric files, and forces \package{fontinst} to + only consider the PL and VPL formats for this font. + As these file formats do not contain glyph names, an ETX file + is used to assign glyph names to the slots in the font. + This ETX file is usually selected according to the + \texttt{CODINGSCHEME} property of the PL or VPL (using the + correspondances set up via the |\declare|\-|encoding| command), + but that information is not always as one would want it (there + are even fonts for which it is quite wrong). An \texttt{encoding} + clause bypasses this automatic mechanism, so that the file + \meta{etx-name}\texttt{.etx} is used instead. + +% % The following is no longer true as of v1.926: +% \textbf{Note:} The first time that a file in PL or VPL format is +% used in a \meta{metrics} argument, a corresponding MTX file is +% generated. This means that if the same file reference is used +% another time then the reference will be to the MTX file, not to +% the original PL or VPL, and thus \texttt{encoding} clauses on +% subsequent uses will have no effect. Each font only has one +% encoding, so it usually makes no sense to switch the ETX file +% used to interpret a font, but since MTX files are not +% automatically deleted between runs there is a risk that this +% takes away the intended effect of an \texttt{encoding} clause. + + \item[\mdseries\textvisiblespace\texttt{mtxasetx}] + This is available for files in the \meta{etx-list}. The actual + function of a + \begin{quote} + \meta{file-name} \texttt{mtxasetx} + \end{quote} + item in the \meta{etx-list} is that the file + \meta{file-name}\texttt{.mtx} is inputted (\emph{not} + \meta{file-name}\texttt{.etx}) and that the correspondance + between glyph names and slot numbers set up in + |\set|\-|raw|\-|glyph| or |\set|\-|scaled|\-|raw|\-|glyph| + commands in this file is treated as if it had been set up by + |\setslot| commands in an ETX file. Provided the MTX file is + transformable, the glyph base will be unaffected. + + The purpose of this feature is to simplify quick and dirty + installations of odd fonts for which no suitable ETX file is + available. This can be useful in early stages of the design of + a new font, but is inferior to installation using proper ETX + files since one for example cannot specify any ligatures in + MTX files. +\end{description} +Furthermore there is a special exception for the \meta{metrics}: if +the first token in one of the list items is the control sequence +|\metrics|, then the rest of that item is interpreted as explicit +metric commands to execute. + +If the \meta{metrics} of two subsequent |\install|\-|font| +or |\install|\-|raw|\-|font| commands are identical then the glyph +bases will be identical as well. This creates an opportunity for +optimization, which \package{fontinst} makes use of by caching glyph +bases from one installation command to the next so that the glyph +base does not have to be rebuilt in these cases. A side-effect of +this caching is that local assignments made between two font +installation commands are cleared out with the glyph base, but +|\setint| and similar \package{fontinst} commands make global +assignments when used in such positions. + +Some examples might be in order. The first is an adaptation of an +installation command from \texttt{mfnt-0.59}~\cite{mfnt} by +Matthias Clasen and Ulrik Vieth: the installation command for the +8-bit math font \texttt{xma1000} (which can be thought of as being +to \texttt{cmmi10} sort of as \texttt{ecrm1000} is to \texttt{cmr10}). +The first three \texttt{encoding} clauses are more fine-tuning---without +them, a few glyphs would get incorrect names---but the last two are +quite essential, as the \texttt{msam10} and \texttt{msbm10} fonts +incorrectly claim to have the coding scheme \texttt{TEX MATH +SYMBOLS}. +\begin{verbatim} + \installfont{xma1000}{% + yma1000 encoding mcin,% + cmr10 encoding ot1upright,% + cmmi10,% + cmsy10 encoding omscal,% + msam10 encoding msam,% + msbm10 encoding msbm,% + mccmhax,mccmkern,mcmissing,% + cmsy10-base,cmsy10-extra% + }{mc}{MC}{cm}{m}{n}{<10->} +\end{verbatim} +Also note the explicit \LaTeX\ size specification for the range +``10\,pt and up''. + +The second example makes use of a \texttt{suffix} clause to combine +the letters from one font with the digits from another. +\begin{verbatim} + \installfont{msbrj8t}{msbr8r,msbrc8r suffix /2,latin}{digit2,t1} + {T1}{msbj}{m}{n}{} +\end{verbatim} +In this case, the glyph base contains the glyphs of Monotype Sabon +(SabonMT)---under names such as \texttt{A} for `A', \texttt{a} for +`a', and \texttt{one} for a lining digit one---as well as the +glyphs of Monotype Sabon Small Caps and Oldstyle Figures +(SabonMT-SCOSF)---under names such as \texttt{A/2} for `A', +\texttt{a/2} for `\textsc{a}', and \texttt{one/2} for a hanging +digit one. The \texttt{digit2.etx} file simply makes the definition +\begin{verbatim} + \setcommand\digit#1{#1/2} +\end{verbatim} +which causes \texttt{t1.etx} to put \texttt{zero/2} in slot 48 (digit +zero), \texttt{one/2} in slot 49 etc., instead of as it normally +would \texttt{zero} in slot 48, \texttt{one} in slot 49 and so on. +The net effect is that the digits in the generated \texttt{msbrj8t} +is from \texttt{msbrc8r} (SabonMT-SCOSF) but everything else is from +\texttt{msbr8r} (SabonMT). + +The third example makes use of an \texttt{mtxasetx} clause to install +(with its default encoding) a font for which creating an appropriate +ETX file seems not worth the trouble. +\begin{verbatim} + \installrawfont{psyr}{psyr,\metrics + \setint{xheight}{\height{alpha}} + }{txtfdmns,psyr mtxasetx}{U}{psy}{m}{n}{} +\end{verbatim} +The effect of the second \texttt{psyr} is that \texttt{psyr.mtx} is +read (in case there was no \texttt{psyr.mtx} then it is created from +(hopefully) \texttt{psyr.afm}) and the information in it will form +the glyph base. Because of the |\metrics| control sequence, the rest +of that item will be interpreted as explicit metric commands +modifying the glyph base, and thus the |\setint| command can provide +a value for the \texttt{xheight} variable (there doesn't seem to be +such a value in the AFM). Once the glyph base is completed, the +|\install|\-|raw|\-|font| starts writing the file \texttt{psyr.pl} +(that's for the first \texttt{psyr}). The encoding of that font will, +because of the \texttt{psyr mtxasetx}, be the same as that used in +\texttt{psyr.mtx}. Finally, the \texttt{txtfdmns} is for +\texttt{txtfdmns.etx}, an ETX file which sets fontdimens 1--16 as for +a \texttt{T1} encoded font but does not set any slots. Since +\texttt{psyr.mtx} reinterpreted as an ETX file sets slots but no +fontdimens, these complement each other nicely. + + + +\begingroup +\renewcommand\thesubsection{\thesection.\ensuremath{\infty}} + +\subsection{Coming attractions} + +We\footnote{Well, perhaps it's just me. /LH} have some new features +which we have pretty much sorted out how they should work and how they +should be implemented, but didn't want to introduce in this version as +the large modifications in core systems would require another +pre-release version before the proper release. Instead these features +will probably appear in the first pre-release of \package{fontinst} +v\,2.0. + + +\subsubsection{Bounding boxes} + +Han The Thanh has created an implementation of bounding box support +for \package{fontinst}, and it is a modified form of that support +that will make it into \package{fontinst} v\,2.0. One important +characteristic of this implementation is that the dimensions of the +bounding box are not bundled into the same data structure (the +|\g-|\meta{glyph} macros) as the glyph's width, height, depth, and +italic correction are, but stored in a separate data structure (the +|\gb-|\meta{glyph} macros). A glyph doesn't need to have its bounding +box set, it is simply a piece of information that \package{fontinst} +will store if you tell it to and which you can later retrieve. + +The bounding box will be stored as coordinates of the sides in the +normal AFM coordinate system. The commands for retrieving these +coordinates will probably be +\begin{center} + \begin{tabular}{ll} + \textbf{Command}& \textbf{Side}\\ + |\bbtop|\marg{glyph}& top ($y$-coordinate)\\ + |\bbbottom|\marg{glyph}& bottom ($y$-coordinate)\\ + |\bbleft|\marg{glyph}& left ($x$-coordinate)\\ + |\bbright|\marg{glyph}& right ($x$-coordinate) + \end{tabular} +\end{center} +In Thanh's implementation the command names are |\ury|, |\lly|, +|\llx|, and |\urx| respectively instead, but I think the former are +easier to remember. If no bounding box has been set for a glyph then +the above commands will instead report the corresponding coordinate of +the glyph's \TeX\ box (i.e.\ |\height|\marg{glyph}, +|\neg{\depth|\marg{glyph}|}|, |0|, and |\width|\marg{glyph} +respectively). + +The command for setting the bounding box of a glyph will be +\begin{quote} + |\setglyphbb|\marg{glyph}\marg{left}\marg{bottom}\marg{right}^^A + \marg{top} +\end{quote} + + + +\endgroup + + +\section{Notes on using \package{fontinst}} +\label{Sec:NotesOnUsing} + +The primary purpose of \package{fontinst} is to simplify the +installation of PostScript or TrueType text fonts. + + +\subsection{General notes} + +Leaving aside unusual variants which require special attention such +as alternate or swash fonts, almost all standard font families can +be installed automatically using the |\latinfamily| command, +optionally making use of the corresponding expert fonts as well. + +Depending on what kind of fonts you have and want to install, +|\latinfamily| supports three different modes of operation: + +|\latinfamily|\marg{fam}|{}| installs a normal font family using +|8a|-encoded standard fonts (reencoded to |8r|) and nothing else. +It installs |.fd| files for the \LaTeX{} families \texttt{8r}\meta{fam}, +\texttt{OT1}/\meta{fam}, \texttt{T1}/\meta{fam} and +\texttt{TS1}/\meta{fam}, and generates virtual fonts for the |7t|, +|8t|, and |8c| encodings. This is the only option available for most +typefaces which do not have an expert set. + +|\latinfamily{|\meta{fam}|x}{}| installs an expertized font family using +|8a|-encoded standard fonts (reencoded to |8r|) and |8x|-encoded +expert fonts. It installs |.fd| files for the \LaTeX{} families, +\texttt{OT1}/\meta{fam}\texttt{x}, \texttt{T1}/\meta{fam}\texttt{x} and +\texttt{TS1}/\meta{fam}\texttt{x}, and generates virtual fonts for the +|9t|, |9e| and |9c| encodings. + +|\latinfamily{|\meta{fam}|j}{}| installs an expertized font family with +oldstyle digits using |8a|-encoded standard fonts (reencoded to +|8r|) and |8x|-encoded expert fonts. It installs |.fd| files for +the \LaTeX{} families, |OT1|/\meta{fam}|j|, |T1|/\meta{fam}|j| and +|TS1|/\meta{fam}|j|, and generates virtual fonts for the |9o|, |9d| and +|9c| encodings. Since \texttt{TS1} has oldstyle digits by default, the +|9c|-encoded fonts should be the same as in the previous case. Finally, +|\latinfamily{|\meta{fam}|9}{}| is also supported as an alternative to +|\latinfamily{|\meta{fam}|j}{}| for backwards compatibility. + +The whole installation process relies on certain assumptions about +the symbol complement of Adobe's expert fonts. In particular, it is +assumed that the expert fonts include the oldstyle digits and a +complete set of small caps glyphs, which is an assumption that's not +always satisfied for expert fonts by other suppliers. If these +glyphs are not included in the expert fonts, the only way to get +them is from real small caps fonts, but this requires some +reshuffling of glyph names. + +To support such unusual cases, this source file contains some +optional code embedded between \Module{*oldstyle} \dots\ +\Module{/oldstyle}, +which extends the behaviour of |\latinfamily| for expertized +encodings with oldstyle digits. Instead of relying only on the +glyphs of the |8r|-reencoded raw font and the |8x|-encoded expert +font, this version also looks for corresponding OsF or SC\&OsF fonts +and uses the default digits from those fonts as oldstyle digits. + + +\subsection{Notes on small caps and oldstyle fonts} + +The |\latinfamily| command is supposed to do a reasonably good job +of installing a complete font family based on all the |.afm| files +it can find. If it doesn't find a suitable font shape, it is +sometimes possible to fake it by default substitutions. However, in +the case of small caps fonts, there are several options which may +require some clarification. + +For the majority of typefaces, a font family typically consists only +of of roman and italic fonts in several weights. Since real small +caps fonts are not included, they have to be faked from the roman +fonts, which is implemented by setting |\encoding_shape| to `|c|', +so that different encoding files |OT1c.etx| or |T1c.etx| are used. +Since these files call for glyph names such as `|Asmall|' which are +not found in the roman font, the default substitutions in +|latin.mtx| are eventually used to approximate fake small caps +glyphs by scaling and letterspacing. The outcome is just an +approximation for a small caps font, but it is better than nothing. + +For a small number of typefaces, the standard fonts are complemented +by an expert collection, which usually includes two sets of fonts. +First, for each standard font there is a corresponding expert font +containing additional glyphs such as extra ligatures and symbols, +oldstyle digits and small capital letters. For Adobe expert fonts +this set is sufficient to build a complete small caps font from the +standard and expert glyphs. Furthermore, the expert collection +usually also contains a number of real small caps font corresponding +to the roman fonts and some OsF fonts corresponding to the italic +fonts. If these fonts are available, there are several options how +to install small caps fonts. + +By default, |\latinfamily| first tries to find a real small caps +font. If it is found, it is installed using the default encoding +files and metric files, just like any roman or slanted font. +However, once |\latinfamily| has taken this choice, it will fail to +find a corresponding expert font, since it is actually looking for +an expert font in small caps shape which doesn't exist. (In fact, +it would be an error to substitute an expert font in normal shape.) +The outcome will be a virtual font based only on glyphs from the +real small caps raw font, which implies ending up with oldstyle +digits as the default set of digits, but allows to inherit the +kerning information of the real small caps font. + +Another option for an expertized installation would be to make the +real small caps fonts unavailable, so that |\latinfamily| will +attempt to fake a small caps font using glyphs from the standard and +expert fonts in normal shape. This means that |\encoding_shape| is +again set to `|c|', so that |OT1c.etx| and |T1c.etx| are used, but +this time a glyph named `|Asmall|' does exist in the expert font and +will be used instead of faked one generated by scaling. The outcome +will be a font based on normal and small caps glyphs from the +standard and expert fonts. The oldstyle digits will only be used if +they are called for, otherwise the default digits from the roman +font are used. The only drawback of this approach is that the +kerning around small capital letters will be based on the scaled +kern amounts of the capital letters rather than on the kern pairs +from the real small caps font. + +Finally, the most promising approach of all these options would be +to combine the glyphs from standard and expert fonts with kern pairs +from the real small caps fonts. The current version of |\latinfamily| +does not implement this, but it would be a worthwhile approach, and +advanced \package{fontinst} users are encouraged to attempt it. The +file \texttt{csckrn2x.tex} (a variant of \texttt{csc2x.tex}, which is +mentioned in Subsection~\ref{Ssec:Des:Reglyph}) should come in handy +for this. + + +\subsection{\package{fontinst} variables} + +The following is a list of the \package{fontinst} variables that are +accessible for the user through the |\set|\textellipsis, +|\reset|\textellipsis, |\unset|\textellipsis, etc.\ commands. You may +of course set or use other variables in the MTX and ETX files you +write yourself, as does for example the standard MTX file +\texttt{latin.mtx}, but all variables that \package{fontinst} commands +implicitly use or set are listed below. + +\begin{list}{}{% + \setlength\labelwidth{0pt}% + \setlength\itemindent{-\leftmargin}% + \setlength\parsep{0pt} + \def\makelabel#1{\hspace\labelsep \normalfont\ttfamily #1}% +} + \item[acccapheight] (integer denoting length) + \begin{smalldes} + \item[Description] The height of accented full capitals. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[address] (string) + \begin{smalldes} + \item[Description] Snailmail address put in \BibTeX-style file + header of automatically generated ENC files. No + \texttt{address} field is written unless the \texttt{address} + string is set. Quotes are not automatically inserted around + the \texttt{address} string. + \item[Set by] ETX files. + \item[Used by] The ETX-to-ENC converter. + \end{smalldes} + \item[afm-name] (string) + \begin{smalldes} + \item[Description] Name of source font. Internal variable. + \item[Set by] |\from|\dots\ commands. + \item[Used by] The |\transform|\-|font|, |\install|\-|font|, + |\install|\-|raw|\-|font|, and |\reglyph|\-|font| commands. + \end{smalldes} + \item[ascender] (integer denoting length) + \begin{smalldes} + \item[Description] The ascender height of the font. + \item[Set by] MTX files. The AFM-to-MTX converter usually writes + |\setint| commands for this integer. + \item[Used by] Some MTX and ETX files. + \end{smalldes} + \item[author] (string) + \begin{smalldes} + \item[Description] Author name(s) put in \BibTeX-style file + header of automatically generated ENC files. See the macro + |\ref_to_sourcefile| for more details. + \item[Set by] ETX files. + \item[Used by] The ETX-to-ENC converter. When not set, the + value \texttt{"See file }\meta{etx name}\texttt{"} is used + instead. + \end{smalldes} + \item[\cs{autoinstallfamily}] (command) + \begin{smalldes} + \item[Description] Command called by the font installation + commands, as + \begin{quote} + |\autoinstallfamily|\marg{encoding}\marg{family} + \end{quote} + when they are asked to install a font with a combination of + \meta{encoding} and \meta{family} that has not been seen + before (there was no explicit |\installfamily|). + \item[Set by] Explicit commands. Defaults to calling + |\installfamily|. + \item[Used by] Font installation commands. + \end{smalldes} + \item[axisheight] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{22}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[baselineskip] (integer denoting length) + \begin{smalldes} + \item[Description] + The font designer's recommendation for natural length of the + \TeX\ parameter |\baselineskip|. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[bigopspacing1] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\xi\sb{9}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[bigopspacing2] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\xi\sb{10}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[bigopspacing3] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\xi\sb{11}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[bigopspacing4] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\xi\sb{12}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[bigopspacing5] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\xi\sb{13}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[capheight] (integer denoting length) + \begin{smalldes} + \item[Description] The height of the font's full capitals. + \item[Set by] MTX files. The AFM-to-MTX converter usually writes + |\setint| commands for this variable. + \item[Used by] Some MTX and ETX files. + \end{smalldes} + \item[codingscheme] (string) + \begin{smalldes} + \item[Description] The codingscheme name. + \item[Set by] ETX files. + \item[Used by] The (V)PL writer. When not set, the + value \texttt{UNKNOWN} is used instead. + \end{smalldes} + \item[defaultrulethickness] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\xi\sb{8}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[delim1] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{20}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[delim2] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{21}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[denom1] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{11}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[denom2] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{12}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[descender] (integer denoting length) + \begin{smalldes} + \item[Description] The depth of lower case letters with descenders. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[descender_neg] (integer denoting length) + \begin{smalldes} + \item[Description] The vertical position of the descender line + of the font, i.e., the negative of the font's descender depth. + \item[Set by] MTX files. The AFM-to-MTX converter usually writes + |\setint| commands for this variable. + \item[Used by] Some MTX and ETX files. + \end{smalldes} + \item[designsize] (dimension) + \begin{smalldes} + \item[Description] The design size of the font. + \item[Set by] MTX files. The (V)PL-to-MTX converter usually writes + |\setdim| commands for this variable. + \item[Used by] The (V)PL writer. The design size defaults to + $10\,\mathrm{pt}$ if this variable is not set. + \item[Note] The value of this variable has no effect on how + the font is declared to \LaTeX. + \end{smalldes} + \item[designunits] (dimension denoting a real number) + \begin{smalldes} + \item[Description] The design size of a font expressed in the + design unit used in a (V)PL file. + \item[Set by] MTX files. The (V)PL-to-MTX converter usually writes + |\setdim| commands for this variable. + \item[Used by] Nothing. If this variable is set, but to any + value other than $1\,\mathrm{pt}$, then some metrics are most + likely wrong. + \end{smalldes} + \item[digitwidth] (integer denoting length) + \begin{smalldes} + \item[Description] The median width of the digits in the font. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[email] (string) + \begin{smalldes} + \item[Description] Email address put in \BibTeX-style file + header of automatically generated ENC files. See the macro + |\ref_to_sourcefile| for more details. + \item[Set by] ETX files. + \item[Used by] The ETX-to-ENC converter. When not set, the + value \texttt{"See file }\meta{etx name}\texttt{"} is used + instead. + \end{smalldes} + \item[encodingname] (string) + \begin{smalldes} + \item[Description] The name by which the encoding in question is + made known to a Postscript interpreter. + \item[Set by] ETX files. + \item[Used by] The ETX-to-ENC converter. When not set, the + value |fontinst-|\nolinebreak[1]|autoenc-|\nolinebreak[1]% + \meta{etx name} is used instead. + \end{smalldes} + \item[etx-name] (string) + \begin{smalldes} + \item[Description] Name of ETX file. Internal variable in + |\transform|\-|font|. + \item[Set by] The |\reencodefont| command. + \item[Used by] The |\mtxtomtx| command. + \end{smalldes} + \item[extraspace] (integer denoting length) + \begin{smalldes} + \item[Description] + The natural width of extra interword glue at the end of a + sentence. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[fontdimen($n$)] (integer) + \begin{smalldes} + \item[Description] Family of semi-internal variables that store + the values to use for font dimension $n$. It is preferred + that the newer |\set|\-|font|\-|dimen| interface is used for + setting these values. + \item[Set by] ETX files. + \item[Used by] The (V)PL writer. + \end{smalldes} + \item[\cs{iftokeep}] (macro) + \begin{smalldes} + \item[Description] |\iftokeep|\,\#1\,|\then|, where \#1 will + be a \meta{number}, behaves like a switch and decides whether + a glyph is kept or not while reglyphing. + \item[Set by] Explicit commands. Defaults to + $$ + \mbox{\cs{iftokeep}\,\#1\,\cs{then}} \mapsto + \mbox{\cs{ifnum}\,\texttt{-1<}\#1} + $$ + \item[Used by] The |\reglyphfont| command. + \end{smalldes} + \item[interword] (integer denoting length) + \begin{smalldes} + \item[Description] The natural width of interword glue (spaces). + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[italicslant] (integer denoting factor) + \begin{smalldes} + \item[Description] The italic slant of a font. + \item[Set by] MTX files generated from AFM or (V)PL files. MTX + files generated by |\transformfont|. Locally in the AFM-to-MTX + converter for possible use in |\uprightitalcorr| or + |\slanteditalcorr|. + \item[Used by] MTX files (\texttt{latin.mtx} and the like). ETX + files (for determining \texttt{fontdimen(1)}). + \end{smalldes} + \item[killweight] (integer) + \begin{smalldes} + \item[Description] Weight for glyphs that are killed. + \item[Set by] Explicit commands. Defaults to $-10$ if not set. + \item[Used by] The |\kill|\-|glyph| command; indirectly + the |\reglyphfont| command. + \end{smalldes} + \item[letterspacing] (integer denoting length) + \begin{smalldes} + \item[Description] Extra width added to all glyphs of a font. + \item[Set by] ETX or MTX files. + \item[Used by] The (V)PL writer. Defaults to $0$ if not set. + \end{smalldes} + \item[maxdepth] (integer denoting length) + \begin{smalldes} + \item[Description] The maximal depth over all slots in the font. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[maxdepth_neg] (integer denoting length) + \begin{smalldes} + \item[Description] The negative of the maximal depth of a glyph in + the font. + \item[Set by] MTX files. The AFM-to-MTX converter usually writes + |\setint| commands for this variable. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[maxheight] (integer denoting length) + \begin{smalldes} + \item[Description] The maximal height of a glyph in the font. + \item[Set by] MTX files. The AFM-to-MTX converter usually writes + |\setint| commands for this variable. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[minimumkern] (integer denoting length) + \begin{smalldes} + \item[Description] Kerns whose size in absolute value is less + than or equal to this variable are ignored. + \item[Set by] \package{fontinst} command files or MTX files. + \item[Used by] The AFM-to-MTX converter and the (V)PL file + generator. When not set, the value $0$ is used instead. + \end{smalldes} + \item[monowidth] (flag integer) + \begin{smalldes} + \item[Description] Set if this font is monowidth, unset otherwise. + \item[Set by] MTX files. The AFM-to-MTX converter writes a + |\setint| command for this variable if the AFM specifies + \texttt{IsFixedPitch true}. + \item[Used by] Some MTX files (\texttt{latin.mtx} and the like), + ETX files. + \end{smalldes} + \item[num1] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{8}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[num2] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{9}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[num3] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{10}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[quad] (integer denoting length) + \begin{smalldes} + \item[Description] + The quad width of the font, normally approximately equal to + the font size and\slash or the width of an `M'. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[PSfontsuffix] (string) + \begin{smalldes} + \item[Description] Suffix added to font names to form name of + file to download to include font. + \item[Set by] Explicit commands in \textsf{finstmsc} command + files. Defaults to `\texttt{.pfa}'. + \item[Used by] The map file fragments writer. + \end{smalldes} + \item[rawscale] (integer denoting factor) + \begin{smalldes} + \item[Description] Scaling factor applied to raw glyphs. + \item[Set by] The |\installfont| command (\texttt{scaled} + clauses in argument \#2). Unset for metric files listed + without a \texttt{scaled} clause. + \item[Used by] The |\set|\-|raw|\-|glyph|, + |\set|\-|not|\-|glyph|, |\set|\-|scaled|\-|raw|\-|glyph|, + |\set|\-|scaled|\-|not|\-|glyph|, |\set|\-|kern|, and + |\reset|\-|kern| commands. + \end{smalldes} + \item[renameweight] (integer) + \begin{smalldes} + \item[Description] Weight for glyphs that are renamed. + \item[Set by] Explicit commands. Defaults to $1$ if not set. + \item[Used by] The |\rename|\-|glyph| command; indirectly + the |\reglyphfont| command. + \end{smalldes} + \item[requireglyphs] (flag integer) + \begin{smalldes} + \item[Description] Set if warnings are to be generated for + glyphs listed in ETX files but not present in the glyph + base. + \item[Set by] Explicit commands. By defaults not set. + \item[Used by] The (V)PL file generator. + \end{smalldes} + \item[rightboundary] (string) + \begin{smalldes} + \item[Description] The name of a glyph with the property that + kerns on the left may be intended as right word boundary kerns. + \item[Set by] MTX files. The (V)PL-to-MTX converter can write + |\setstr| commands for this variable. + \item[Used by] Some MTX files. + \end{smalldes} + \item[shrinkword] (integer denoting length) + \begin{smalldes} + \item[Description] + The (finite) shrink component of interword glue. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[slant-scale] (integer denoting factor) + \begin{smalldes} + \item[Description] Factor to slant by. + Internal variable in |\transform|\-|font|. + \item[Set by] The |\slant|\-|font|, |\xscale|\-|font|, and + |\scale|\-|font| commands. + \item[Used by] The |\mtxtomtx| command. + \end{smalldes} + \item[\cs{SlantAmount}] (macro expanding to an integer expression) + \begin{smalldes} + \item[Description] Slant factor used for faking oblique shape. + \item[Set by] Explicit commands. Defaults to \texttt{167}. + \item[Used by] The |\latinfamily| command. + \end{smalldes} + \item[\cs{slanteditalcorr}] + (macro expanding to an integer expression) + \begin{smalldes} + \item[Description] The integer expression used to calculate a + guess for the italic correction of glyphs in a font with + positive slant. It has the syntax + \begin{quote} + \cs{slanteditalcorr}\marg{width}\marg{left}\marg{right}^^A + \marg{bottom}\marg{top} + \end{quote} + where \meta{width} is the glyph's advance width, and the + remaining arguments are coordinates of sides of the glyph's + 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}\}$. + \item[Used by] The AFM-to-MTX converter. + \end{smalldes} + \item[stretchword] (integer denoting length) + \begin{smalldes} + \item[Description] + The (finite) stretch component of interword glue. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[sub1] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{16}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[sub2] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{17}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[subdrop] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{19}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[sup1] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{13}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[sup2] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{14}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[sup3] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{15}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[supdrop] (integer denoting length) + \begin{smalldes} + \item[Description] Math formula parameter $\sigma\sb{18}$. + \item[Set by] MTX files. + \item[Used by] Some ETX and MTX files. + \end{smalldes} + \item[TFMfileprefix] (string) + \begin{smalldes} + \item[Description] Prefix (typically a path) added to names of + TFM files. + \item[Set by] Explicit commands in \textsf{finstmsc} command + files. By default not set, which is equivalent to being empty. + \item[Used by] The \textsf{PLtoTF} ``map file fragments writer''. + \end{smalldes} + \item[underlinethickness] (integer denoting length) + \begin{smalldes} + \item[Description] The recommended thickness of an underlining + rule. + \item[Set by] MTX files. The AFM-to-MTX converter usually writes + |\setint| commands for this variable. + \item[Used by] Some MTX files (\texttt{latin.mtx} and the like). + \end{smalldes} + \item[\cs{uprightitalcorr}] + (macro expanding to an integer expression) + \begin{smalldes} + \item[Description] The integer expression used to calculate a + guess for the italic correction of glyphs in a font with + non-positive slant. It has the syntax + \begin{quote} + \cs{uprightitalcorr}\marg{width}\marg{left}\marg{right}^^A + \marg{bottom}\marg{top} + \end{quote} + where \meta{width} is the glyph's advance width, and the + remaining arguments are coordinates of sides of the glyph's + 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 $0$. + \item[Used by] The AFM-to-MTX converter. + \end{smalldes} + \item[version] (string) + \begin{smalldes} + \item[Description] Version number put in \BibTeX-style file + header of automatically generated ENC files. See the macro + |\ref_to_sourcefile| for more details. + \item[Set by] ETX files. + \item[Used by] The ETX-to-ENC converter. When not set, the + value \texttt{"See file }\meta{etx name}\texttt{"} is used + instead. + \end{smalldes} + \item[verticalstem] (integer denoting length) + \begin{smalldes} + \item[Description] The dominant width of vertical stems + (usually the width of stems of lower case letters). + \item[Set by] MTX files. The AFM-to-MTX converter writes + |\setint| commands for this variable if the AFM file specifies + \texttt{StdVW}. + \item[Used by] Currently nothing. + \end{smalldes} + \item[\texttt{warningspecials}] (switch) + \begin{smalldes} + \item[Description] Controls whether |\glyphwarning| commands + will generate VPL \texttt{SPECIAL}s. Defaults to `true'. + \item[Set by] Explicit commands (|\warningspecialstrue| and + |\warningspecialsfalse|). + \item[Used by] The (V)PL file generator. + \end{smalldes} + \item[x-scale] (integer denoting factor) + \begin{smalldes} + \item[Description] Horizontal scaling factor. + Internal variable in |\transform|\-|font|. + \item[Set by] The |\xscale|\-|font| and |\scale|\-|font| commands. + \item[Used by] The |\mtxtomtx| command. + \end{smalldes} + \item[xheight] (integer denoting length) + \begin{smalldes} + \item[Description] The x-height of the font. + \item[Set by] MTX files. The AFM-to-MTX and (V)PL-to-MTX + converters usually write |\setint| commands for this variable. + \item[Used by] MTX files, and ETX files (for determining + \texttt{fontdimen(5)}). + \end{smalldes} + \item[y-scale] (integer denoting factor) + \begin{smalldes} + \item[Description] Vertical scaling factor. + Internal variable in |\transform|\-|font|. + \item[Set by] The |\yscale|\-|font| and |\scale|\-|font| commands. + \item[Used by] The |\mtxtomtx| command. + \end{smalldes} + \item[\meta{\rmfamily glyph}-spacing] (integer denoting length) + \begin{smalldes} + \item[Description] Glyph-specific override for + \texttt{letterspacing}; extra width added to the glyph + \meta{glyph} as part of the process of writing a VPL + file. + \item[Set by] ETX or MTX files. + \item[Used by] The (V)PL writer. Defaults to $0$ if not set. + \end{smalldes} +\end{list} +Besides these, the |\latinfamily| command provides a whole range of +parameters that are often used somewhat like variables. That subject +does however deserve to be treated separately. + + +\section{\package{fontdoc} package overview} + +The purpose of the \package{fontdoc} package is to support +typesetting of \texttt{.etx} and \texttt{.mtx} files intended +for use with \package{fontinst}. +The typical format of these files looks something like this: +\begin{quote} + |\relax|\\ + |\documentclass[twocolumn]{article}|\\ + |\usepackage{fontdoc}|\\[0.5\baselineskip] + |\begin{document}|\\ + {}~~\textit{\LaTeX\ commands}\\ + |\encoding| or |\metrics| \\ + {}~~\textit{\package{fontinst} commands}\\ + |\endencoding| or |\endmetrics|\\ + {}~~\textit{\LaTeX\ commands}\\ + |\end{document}| +\end{quote} +To make it work, \package{fontdoc} has to define all the user-level +\package{fontinst} commands in terms of typesetting instructions. This +goal is currently only partially achieved, but the percentage of +\package{fontinst} commands covered by \package{fontdoc} is still +fairly large, so it is our impression that problems with commands not +covered occur only very rarely. + + +\subsection{Some \package{fontdoc} commands that \package{fontinst} + doesn't know} + +Some of the commands defined by \package{fontdoc} are not defined by +\package{fontinst} because they have no meaning in that context. +Most of these commands are lower-level commands that are used in the +implementations of commands common to \package{fontinst} and +\package{fontdoc}, but a few are simply only meant to be used in the +parts of ETX and MTX files that \package{fontinst} never executes. + +With v\,1.916 the mechanism for formatting integer expressions changed +dramatically. The new base command to use is +\DescribeMacro{\TypesetIntegerExpression}|\Typeset|\-|Integer|\-% +|Expression|, which takes as its only argument the integer expression +to format and typesets it. |\Typeset|\-|Integer|\-|Expression| expects +to be used in math mode only. A similar command is +\DescribeMacro{\TypesetStringExpression}|\Typeset|\-|String|\-% +|Expression|, which takes a string expression as argument, formats, +and typesets it. |\Typeset|\-|String|\-|Expression| can be used in any +mode. + +The \DescribeMacro{\macroparameter}|\macroparameter| command is (in +integer and string expressions) understood as a ``placeholder for a +macro parameter''. This is primarily useful in comments that describe +a user-defined macro; see \texttt{ltcmds.mtx} for examples. + + + +% \part*{Implementation} +% \addcontentsline{toc}{part}{Implementation} + +\changes{1.800}{1998/06/22}{\texttt{fontinst.sty} and + \texttt{fontdoc.sty} now generated from \texttt{fontinst.dtx}. (UV)} +\changes{1.900}{1999/02/05}{\texttt{fontinst.dtx} split into several + source files. (LH)} +\changes{1.902}{1999/04/18}{Fixed some silly markup. (LH)} + +\DocInclude{fibasics} +\DocInclude{ficommon} +\DocInclude{fimain} +\DocInclude{ficonv} +\DocInclude{filtfam} +\DocInclude{fimapgen} + +\PrintIndex +\pagestyle{plain}\tracingmacros=2\tracingcommands=2 +\PrintChanges +\tracingcommands=0\tracingmacros=0 + +\clearpage +\appendix +\part*{Internal notes} +\addcontentsline{toc}{part}{Internal notes} + + +\section{Typographic treatment} + +\begin{itemize} + \item + I have been following \emph{The \LaTeX\ Companion} in that I have + set all names of packages and the like---\package{fontinst}, + \package{fontdoc}, \package{trig}, \package{doc}, and + \package{docstrip} (I might have forgotten some)---in sans serif + type. Actually, I have defined a command |\package| in + \texttt{fisource.sty} (or is that \package{fisource}?) which does + this, so if we decide on some other formatting, we can just change + that. /LH + \item + It seems to me that there should indeed be some space between the + `v' and the digits in a version number when it is typeset, but I + also think a full space is too much, so I have been using thin + spaces. These are unbreakable and under \LaTeX\ you can simply use + |\,| to get one (while you are not in math mode, that is). /LH + \item + While I went through (some of) the code, I came across a few + inconsistencies. \ambiguity{I have marked them out like this% + \offindex}---some boldfaced text in a paragraph and a large A + in the margin. I defined a command |\ambiguity| for doing this. /LH + \item + There is also a similar command |\question| which is intended for + situations where there isn't really an error, but something seems + like it should be taken care of in some other way. \question{The + \cs{question} command puts a question mark in the margin.% + \offindex} + \item + I also noticed that there are several \package{fontinst} commands, + not all of which are new, which are not defined in \package{fontdoc}. + {\offindex\missing{doc}{\foo}}To mark out such things, I have + written things like the one shown in the margin by this paragraph. + I defined a command |\missing| for doing this. /LH +\end{itemize} + + +\section{Planning topics} + +This section lists items in the larger design of \package{fontinst} +which need to be resolved in one way or another. Debates about these +items on the fontinst mailing list are welcome. + + +\subsection{Reorganisation of the source} + +At the moment, all the ideas suggested have been realized. +% \begin{itemize} +% \item +% How about moving the first section of \texttt{fimain.dtx} to +% \texttt{fibasics.dtx}? /LH +% \item +% How about extracting the code which has to do with file +% conversions (Sections~\ref{Sec:Conv. input}, +% \ref{Sec:Font.trans}, and Subsection~\ref{Ssec:MTX->PL}) from +% \texttt{fimain.dtx} and put it in a file of its own +% (\texttt{ficonv.dtx}, say)? /LH +% \end{itemize} + + +\subsection{Files} + +Which files should be considered temporary and placed in the location +specified with |\tempfileprefix|? Should files be explicitly be looked +for at this location or should it be assumed that fontinst users +include that location in their \TeX\ input file search path? In the +former case, \emph{which} files should be looked for in that +location? Should files be looked for in the temporary location before +they are looked for without a specified location, or should it be the +other way round? + + + + + +\section{Contributors} + +[The \package{fontinst} source has been pretty inconsistent in how +people are credited for what they have done---some appear only as +acronyms while others appear as rather striking e-mail addresses---so +I thought it best that this is shaped up a bit. My suggestion is that +we use names or acronyms in the source and move everything else here. +I also thought it could be interesting with a short description of +what each person has done and is doing, so I have started ever so +slightly on something along those lines. Feel free to add things! /LH] + +\medskip + +The following people have contributed substantial amounts of code or +documentation to \package{fontinst}. They are listed in strict +alphabetical order. + +\begin{description} + \item[Thierry Bouche] + Thierry saw to that the \texttt{T1} encoded fonts got font + dimensions comparable to the \texttt{ec} fonts. Thierry is also + the author of several papers (published in the \textit{Cahiers + GUTenberg} and \textit{TUGboat}) which deal with non-trivial + applications of \package{fontinst}, such as creating metrics for + Adobe Minion Multiple Master fonts and developing a corresponding + math font setup. + + E-mail: \texttt{Thierry.Bouche@ujf-grenoble.fr} + + \item[Lars Hellstr\"om (LH)] + Lars is responsible for most of the things in v\,1.9 that were + not there in v\,1.8. + + Lars is currently a member of the \package{fontinst} + maintenance team. He is also a Ph.D.\ in mathematics looking for + employment. + + \item[Alan Jeffrey (ASAJ)] + Alan is the original author of \package{fontinst}. He is not + currently on the development team, but he is still managing the + \package{fontinst} mailing list. + + E-mail (\package{fontinst} mailing list subscriptions):% + \nobreak\hfill\penalty0\hskip -2em plus -1fill\ \relax + \vadjust{}\nobreak\hskip 2em\relax + \texttt{fontinst-request@cogs.susx.ac.uk}. + + \item[Constantin Kahn (CK)] + Constantin is one (Sebastian is the other) of the original coauthors + of the current |\latinfamily| command. + % \footnote{Am I right about this? It's a bit before my time, + % I've just read \texttt{CHANGES}. /LH} + + \item[Rowland McDonnell] + Rowland rewrote Alan's old v\,1.5 documentation for + \package{fontinst} and updated it for v\,1.8. + + \item[Sebastian Rahtz (SPQR)] + Sebastian is one (Constantin is the other) of the original coauthors + of the current |\latinfamily| command. He has also contributed + numerous ETX files and made the ``unofficial'' v\,1.6 and v\,1.7, + which included the first \package{fontinst} support for making + \texttt{TS1} encoded files. + + \item[Ulrik Vieth (UV)] + Ulrik converted \texttt{fontinst.sty} to \package{doc}\slash + \package{docstrip} format, reunited Alan's v\,1.511 and + Sebastian's v\,1.7, and made the first official release of + \package{fontinst} (v\,1.8) for more than two years. + + Ulrik is currently a member of the \package{fontinst} + maintenance team. He is also involved in the Joint TUG\slash + \LaTeX~3 Project Working Group on extended math font encodings. + + \item[\textellipsis] +\end{description} +Anyone else? + + +\section{To do} + +This section is based on the \texttt{TODO} file from \package{fontinst} +v\,1.504, but a couple of new entries have been added and some have +been equipped with comments. + +\subsection{Things to do in the ``near'' future} + +\begin{itemize} + \item + Update documentation. (Lars, knowing he isn't saying anything new) + + \item + Rewrite the entire substitution mechanism from scratch! The main + problem with the current mechanism is that it only allows one + substitution per shape and one per series. One cannot substitute + the |it| shape for both the |sl| and the |ui| shapes since each + new |\substitute|(|noisy|\textbar|silent|) with |it| in the + \meta{from} argument will overwrite the setting made by the + previous; + \begin{quote} + |\substitutenoisy{ui}{it}|\\ + |\substitutesilent{sl}{it}| + \end{quote} + is effectively the same as + \begin{quote} + |\substitutesilent{sl}{it}| + \end{quote} + Another big problem is that it isn't well defined what the + substitution mechanism should do. (Lars) + + I've got a sketch for a new substitution mechanism, but I'm not + at all sure it will make it into any v\,1.9xx. /LH + (The code that was written is now in \texttt{fimain.dtx}, but + it's not included in any of the generated files.) + + An alternative to substitutions is to use explicit + |\installfontas| commands. This provides complete control. /LH + + \item + Consider removing the following unreliable fakes from + \texttt{textcomp.mtx}: + \begin{quote} + \texttt{asciiacutedbl}, \texttt{asciigravedbl}, + \texttt{bardbl}, \texttt{openbracketleft}, and + \texttt{openbracketright} + \end{quote} + and consider adding fakes for the following unavailable glyphs: + \begin{quote} + \texttt{dollaroldstyle} (use \texttt{dollar}), + \texttt{centoldstyle} (use \texttt{cent}), \texttt{lira} (use + \texttt{sterling}), and \texttt{pilcrow} (use + \texttt{paragraph}) + \end{quote} + These suggestions are of course open for debate. (Ulrik) + + \item + One thing I miss in [the typeset form of an encoding + specification] is a simple hex/octal/decimal chart showing all + the character names in their positions (and ideally even an + example of the printed character, although I know that would be + harder). (Karl Berry) + +\end{itemize} + + +\subsection{Things that probably won't be done in the near future} + +\begin{itemize} + \item + Find a way to automatically generate math fonts. (Alan) + + I doubt that this will ever be possible to do automatically. + \package{mathptm} and \package{mathptmx} are already hackish enough, + not to mention the prototype implementations for new math font + encodings. /UV + + \item + Investigate using Alternate sets. (Alan) + + AFAIK, Thierry Bouche has done some work with alternate sets + for AGaramond, ACaslon and Minion, but this implies a lot of + manual work to compose the proper calls to \package{fontinst}. /UV + + \item + Create \LaTeX\ packages? In fact, rethink the whole package + interface \textellipsis\ (Alan) + + Sebastian's Perl front-end to \package{fontinst} does create trivial + \LaTeX\ packages automatically for the CTAN fonts. /UV + + \item + Worry about excessive kern tables in \texttt{T1} fonts. (Alan) + + I think the best way to get at this would be to write a program + that can optimize (for size) kern tables by making use of the |SKIP| + instruction. There's often room for quite a lot of compression. + Such a program would however have to be written in some compiling + language, otherwise it wouldn't be fast enough. /LH + + \item + Consider making |\set|(|left|\textbar|right|)|kerning| parameterized + by the size of the other glyph, eg so that faking |<Asmall><T>| can + be different from |<Aacutesmall><T>|. Suggested by Hilmar Schlegel. + +\end{itemize} + + +\subsection{Things that have been done} + +\begin{itemize} + \item + Update documentation (comments from Karl and Damian). + + Rowland has meritoriously done the update requested here. On the + other hand, it needs to be updated again, since many new features + have been added. /LH + + \item + Investigate using raw SC fonts. (Alan) + + This problem comes up on the mailing list from time to time. + The problem is that \package{fontinst}'s |\latinfamily| command + is geared towards fonts that come with standard and expert font + sets (as with Adobe and Monotype fonts) rather than fonts that + come with standard and small caps (as with Linotype fonts). + I'm afraid it would be to complicated to handle both cases + in the same |\latinfamily| procedure. /UV + + \item + Investigate problems with duplicate kerns appearing in VPL files + (Hilmar Schlegel). + + The problem has been investigated and is solved with v\,1.9. /LH + + \item + Find out why, if you have a font with both medium and light variants + but no italic, you get |m|/|it| $\mapsto$ |l|/|it| $\mapsto$ + |l|/|sl| rather than |m|/|it| $\mapsto$ |m|/|sl|. + (Sebastian). + + Because for every shape that \package{fontinst} is allowed to use + a given font for, it will perform all possible series substitutions. + If the |\installfont| for |l|/|sl| came before the |\installfont| for + |m|/|sl|, then substitutions will be as described above. See also + item about the substitution mechanism. /LH + + \item + AFM files can contain real units, not just integers. (Gintautas + Grigelionis). + + This is fixed with v\,1.9. /LH + + \item + Make \texttt{fontdoc.sty} and co.\ use PS fonts. (Alan) + + I think |\useexamplefont| and friends (introduced with v\,1.8) + pretty much do what was intended here. /LH + + \item + \texttt{latin.mtx} uses \package{fontinst} rather than + \package{fontdoc}! (Rob Hutchings). + + \item + Allow |.vpl| files to be read as |.pl| files. (Constantin) + + \item + Richard Walker reports that if you say + \begin{quote} + |\latinfamily{mbvx}{}|\\ + |\latinfamily{mbv9}{}| + \end{quote} + then the 2nd run doesn't use old-style digits, because the 1st run + has already defined |\digit|. If so, this is because |\latinfamily| + is missing a bracing level. I should investigate. + + I think it is best to do oldstyle and non-oldstyle variants in two + separate fontinst runs, i.e. don't use |\latinfamily| more than once + in a single run. (IIRC, grouping doesn't work properly since + every single font closes and reopens a |\begingroup|-|\endgroup| + pair to encapsulate the kerning info\footnote{And glyph metrics + info, and glyph mapcommands info \textellipsis /LH} or something + like that.) /UV + + \item + Consider writing an |\installfontas| command which doesn't + generate a (V)PL but makes an entry in the FD file. + Typical usage: Install an \texttt{sc} shape of a \texttt{TS1} + font family by using the font made for the \texttt{n} shape. + (Lars) + + Done. The described installation for the \texttt{m} series of the + \texttt{ptm} font family can be done through + \begin{quote} + |\installfontas{ptmr8c}{TS1}{ptm}{m}{sc}{}| + \end{quote} + Note however that you need to do it in each series explicitly. /LH + + \item + Use the \texttt{StdVW} property from AFM 4.0 files instead of the + width of \textit{I} for standard stem fontdimen. Pointed out by + Hilmar Schlegel. + + Partially done. |\afmtomtx| writes a + |\setint{verticalstem}|\marg{value} when it encounters a + \texttt{StdVW} property. The ETX files have not yet (2000/05/30) + been changed to use this value. /LH + + \item + \package{fontdoc} has a problem with glyph, integer, string, + etc.\ names that contains underscores, since these will cause + \TeX\ to jump to math mode when one tries to typeset these things. + Unfortunately \package{fontinst} itself writes two such integers: + \texttt{descender_neg} and \texttt{maxdepth_neg}. There are at + least three solutions to this. The first is to make underscore an + `other' character throughout, but this might break some comments in + MTX and ETX files. The second is to temporarily change the catcode + in the arguments of the commands, but that will complicate the + definitions of almost all \package{fontdoc} commands dramatically. + The third is to declare this as unsupported by \package{fontdoc} and + change \package{fontinst} so that the troublesome integers are + renamed, e.g.\ \texttt{descender-neg} and \texttt{maxdepth-neg}, but + this can break people's code. (Lars) + + After thinking about it for a couple of months, I realized that + none of the above is the right solution. That is instead to use + something similar to the harmless character strings of the + \package{xdoc} package when typesetting names of variables etc.\ + in \package{fontdoc}. This got implemented in v\,1.916. /LH + + \item + Modify the (V)PL-to-MTX converter so that |\setint|\discretionary + {}{}{}|{fontdimen(|\meta{n}|)}|\discretionary{}{}{}|{\int|% + \marg{name}|}| commands in the ETX file declare that + \texttt{PARAMETER} (or equivalent) properties for fontdimen + \meta{n} should be converted to |\setint| commands for the integer + \meta{name}. This ought to be particularly useful for math fonts. + (Lars) + + Done with v\,1.917, but only for the new \cs{setfontdimen} + command. /LH + + \item + Update \texttt{fontdoc.sty} and co.\ for \LaTeXe. (Alan) + + \texttt{fontdoc.sty} underwent a major overhaul from v\,1.916 on, + so I suspect this can be said to have been done now. The basic + vertical spacing put in by \cs{Aheading} and \cs{Bheading} may + however need more work; sometimes it doesn't come out as one + would want it to. /LH + + \item + \texttt{latin.mtx} fakes composite SC glyphs [kerning?] from the + composite glyph, eg. + \begin{quote} + |\setleftrightkerning{Aacutesmall}{Aacute}{900}|, + \end{quote} + rather than from the SC non-composite, eg. + \begin{quote} + |\setleftrightkerning{Aacutesmall}{Asmall}{1000}| + \end{quote} + This may cause problems with SC fonts with explicit SC--C kerns, + eg. + \begin{quote} + |\setkern{V}{Asmall}{100}| + \end{quote} + This needs to be thought about. Pointed out by Hilmar Schlegel. + + \texttt{newlatin.mtx} does this right; shrunk glyphs get shrunk + kerning, whereas constructed glyphs get kerning from the base + letter. /LH + +\end{itemize} + + +\subsection{Other notes} + +Alan's \texttt{TODO} file also contains some items regarding +\package{mathptm}, but that seems to have migrated out of +\package{fontinst} (if it ever really was a part). The problem is that +\package{mathptm} cannot be changed any more for the sake of checksum +consistency and backwards compatibility. A new variant called +\package{mathptmx} tries to do a little better, but there may still be +room for improvements. + + + +\section{Efficiency} + +This section records the results of some (rather simple) test runs +that have been made to test the efficiency of \package{fontinst}, +primarily to see how changes in the implementation affect efficiency +by comparing the time and space used by different \package{fontinst} +versions to complete the same task. + + +\subsection{Alan Jeffrey's tests} +\label{Ssec: ASAJ tests} + +I compared the version where you try to keep ints as |\mathchardef|s +with the version where you don't bother, and for a sample font without +|\mathchardef|s I got: +\begin{quote} + 114673 words of memory out of 150001\\ + Time elapsed: 135.0 seconds +\end{quote} +and with, I got: +\begin{quote} + 114050 words of memory out of 150001\\ + Time elapsed: 134.5 seconds +\end{quote} +so I've saved a little memory and time. Not brilliant, but I may as +well keep it in. + +Where possible, we avoid re-scaling kerns, which saves a bit of time +and memory. With a sample font, the version where we didn't avoid +re-scaling used: +\begin{quote} + 114050 words of memory out of 150001\\ + Time elapsed: 134.5 seconds +\end{quote} +whereas the version where we do avoid it used: +\begin{quote} + 113786 words of memory out of 150001\\ + Time elapsed: 124.9 seconds +\end{quote} + +We keep the names of the glyphs to kern with as |\l-|\meta{name} and +|\r-|\meta{name} to save on token space, and this got the resources +used down to: +\begin{quote} + 88574 words of memory out of 150001\\ + Time elapsed: 106.1 seconds +\end{quote} +Keeping track of the kern amounts as |\|\meta{amount} got the resources +used down to: +\begin{quote} + 75424 words of memory out of 150001\\ + Time elapsed: 97.2 seconds +\end{quote} +Mind you, I then added all the |\transformfont| stuff, and it went +back to: +\begin{quote} + 77079 words of memory out of 150001\\ + Time elapsed: 97.7 seconds +\end{quote} + + + +\subsection{Current tests} + +The setup for this test is that \TeX\ is run on a \texttt{.tex} file +consisting of the following commands. +\begin{quote} + |\batchmode|\\ + |\input fontinst.sty|\\ + |\latinfamily{pad}{}|\\ + |\tracingstats=1\bye| +\end{quote} +All the font metrics are generated from the AFM files; temporary MTX, +PL, and VPL files are deleted between test runs. The format used was +generated by typing |\dump| at ini\TeX's |**| prompt; thus there is no +overhead from a typesetting format in the space requirements. + +[It appears the exact data from these tests will have to wait, since +I haven't been able to get access to any computer with reliable +process timing. For the next release perhaps \textellipsis\ /LH] + +% The \TeX\ version used is \TeX~3.14159. The \TeX\ implementation used +% is te\TeX~0.9 (Web2C~7.2), running on a +% +% The \emph{input sources} figure lists how many items are used on +% \TeX's stack for simultaneous input sources. As an input source in +% this context is considered not only input files, but also (and mainly) +% various token lists. Most of these token lists are replacement texts +% and parameters of macros, but token list items on this stack also come +% from expansions of |\the| (not only when applied to a |\toks| register) +% and the like. The input source stack sizes of normal \TeX\ +% implementations are usually several times larger than what +% \package{fontinst} uses, so this particular resource shouldn't cause +% any trouble. +% +% The \emph{parameter} figure is the maximal number of macro parameters that +% \TeX\ has to remember at any one time. The reason this number is +% greater than 9 is that it counts parameters in \emph{all} macros that +% are on the input sources stack, not just those in the top one. The +% same remark about the likelyhood of \TeX\ running out of this resource +% during a \package{fontinst} run as for input sources applies for +% parameters. +% +% The \emph{buffer characters} stack holds lines read from input files that +% are partially tokenized (if several files are on the input sources +% stack then \TeX\ must remember the last line read from each of them) and +% characters for |\csname| \textellipsis |\endcsname| constructions that +% are being expanded. This shouldn't cause any trouble either. +% +% The \emph{save values} figure is the maximum number of items on \TeX's +% save stack at any time. \package{fontinst} uses massive amounts of +% space here (compared to normal \TeX\ documents), but there isn't much +% that can be done about this since \package{fontinst} uses \TeX's +% grouping mechanism to clear data for one font from memory before +% processing begins with the next. +% +% The \emph{multiletter control sequences} figure is exactly +% that---the number of control sequences whose names consist of more than +% one character. When these become too many, \TeX\ complains that its +% hash table is full. Some of these control sequences are macros that +% \package{fontinst} uses in a procedure-like manner, but many of them are +% rather used as data tables. As a comparision of the figure I might +% mension that my \LaTeX\ used 3748 multiletter control sequences for +% typesetting this document, so \package{fontinst} rather average in +% this respect (perhaps a bit above, but not much). +% +% The \emph{strings} figure tells how many items \TeX\ put in its string +% pool and the \emph{string characters} figure tells how many characters +% these contain altogether. There are two main categories of things that +% occur here: names of multiletter control sequences and \TeX's builtin +% error messages. One thing which certainly doesn't occur here is the +% texts you save using \package{fontinst}'s |\setstr| command; these will +% instead become token lists and occupy main memory space (the \emph{names} +% of string variables will however become part of a control sequence name, +% so that will be stored as a string). Unlike some other \TeX\ +% implementations however, the Web2C \TeX\ seems to only report new +% entries in the string pool, so the \emph{strings} and \emph{string +% characters} figures below do not include the builtin error messages. +% On the other hand, they don't include the names of the 322 primitive +% multiletter control sequences either, which is why the figures below +% report more control sequences than strings. +% +% The \emph{main memory}, finally, is where \TeX\ stores almost +% everything else (I've skipped some of the memory categories \TeX\ +% reports since they are ``only'' used for typesetting), most notably +% tokens. Each token occupies one word of memory. I don't think +% \package{fontinst}'s consumption of main memory is that high (in +% comparision with normal \LaTeX\ jobs) since \package{fontinst} doesn't +% have to store any boxes here and thus frees space for more tokens. +% +% \begin{description} +% \item[v\,1.801] +% \consumption{126.68}{%954.9 +% % 5261 strings out of 8681 +% % 54607 string characters out of 136047 +% % 112422 words of memory out of 200001 +% % 3814 multiletter control sequences out of 10000 +% % 8 words of font info for 0 fonts, out of 180000 for 256 +% % 0 hyphenation exceptions out of 2551 +% % 30i,0n,42p,220b,1696s stack positions out of 600i,150n,200p,3000b,4094s +% 3903 strings out of 13688 +% 42612 string characters out of 101822 +% 112422 words of memory out of 263001 +% 3961 multiletter control sequences out of 10000+0 +% 7 words of font info for 0 fonts, out of 200000 for 1000 +% 0 hyphenation exceptions out of 1000 +% 30i,0n,42p,220b,1770s stack positions out of 300i,100n,500p,30000b,4000s +% }% Compulsory comment; TeX inserts a & at the end of this line +% % as a side-effect of the implementation of \consumption. +% \item[v\,1.902] +% \consumption{139.59}{%997.4 +% % 6196 strings out of 8681 +% % 69530 string characters out of 136047 +% % 112617 words of memory out of 200001 +% % 4749 multiletter control sequences out of 10000 +% % 8 words of font info for 0 fonts, out of 180000 for 256 +% % 0 hyphenation exceptions out of 2551 +% % 28i,0n,42p,220b,2004s stack positions out of 600i,150n,200p,3000b,4094s +% 4690 strings out of 13688 +% 52734 string characters out of 101822 +% 112613 words of memory out of 263001 +% 4748 multiletter control sequences out of 10000+0 +% 7 words of font info for 0 fonts, out of 200000 for 1000 +% 0 hyphenation exceptions out of 1000 +% 28i,0n,42p,220b,2000s stack positions out of 300i,100n,500p,30000b,4000s +% }% +% Comparing the figures for v\,1.902 with those of v\,1.801, there +% are mainly three things which are of interest. The first is that +% the number of items on the save stack have increased quite a lot. +% Most of this is due to the mechanism by which \package{fontinst} +% avoids writing multiple kerns to (V)PL files. The second thing to +% notice is that the number of control sequences has increased quite +% dramatically (over 20\%). This is to be expected, as a number of +% new features have been added and the implementation of these +% features requires many new macros. +% +% Some 200 of these new control sequences are however not there +% because of new features, but because of a silly implementation of +% how slot numbers for glyphs are stored. In an attempt to save +% tokens, I (LH) stored these numbers as control sequence names +% rather than token sequences, just like kern amounts have been +% stored for some time now. One notable feature of kern +% amounts is however that although these may assume just about any +% value you can think of, within any given font family they tend to +% assume only a handful of values. This means that the number of +% hash positions occupied by such control sequences is never very +% large and the storage is efficient. On the other hand, the set of +% slot numbers that occur usually consists of all integers in the +% range 0--255, with each slot number occuring in at most one +% position. This means that the storage method, although efficient +% in the number of tokens, really squanders space in the hash table. +% A much better method (which should be implemented, once I get round +% to it) is to store slot numbers in the character codes of `ordinary' +% tokens. +% +% The third noticable thing is that although the number of macros +% has grown quite a lot, the amount of main memory used has hardly +% increased at all! Some of this is probably due to that the ENC to +% ETX converter was moved to \texttt{finstmsc.sty}, since this +% consists of only two macros but lots of tokens. Another factor +% that has probably helped is that |\glyph| now avoids rescaling a +% glyph by one thousand; this saves 9 tokens for each time +% |\glyph|\marg{name}|{1000}| gets executed. +% \item[v\,1.907] +% \consumption{138.88}{%1019.9 +% % 6226 strings out of 8681 +% % 69918 string characters out of 136047 +% % 113820 words of memory out of 200001 +% % 4779 multiletter control sequences out of 10000 +% % 8 words of font info for 0 fonts, out of 180000 for 256 +% % 0 hyphenation exceptions out of 2551 +% % 28i,0n,42p,220b,2006s stack positions out of 600i,150n,200p,3000b,4094s +% % 6225 strings out of 8681 +% 4719 strings out of 13688 +% 53105 string characters out of 101822 +% 113814 words of memory out of 263001 +% 4777 multiletter control sequences out of 10000+0 +% 7 words of font info for 0 fonts, out of 200000 for 1000 +% 0 hyphenation exceptions out of 1000 +% 28i,0n,42p,220b,2002s stack positions out of 300i,100n,500p,30000b,4000s +% }% +% This is pretty much what could be expected. A couple of new +% features have been added, so naturally some of the numbers have +% grown a little. +% \item[v\,1.908] +% This version is devoted to optimizing \package{fontinst}. +% +% The first idea was to avoid moving the contents of +% |\glyph_map_commands| and |\glyph_map_fonts| to a macro and back +% again each time these are updated. This changed the numbers to +% \consumption{135.64}{% +% 4719 strings out of 13688 +% 53105 string characters out of 101822 +% 113810 words of memory out of 263001 +% 4777 multiletter control sequences out of 10000+0 +% 7 words of font info for 0 fonts, out of 200000 for 1000 +% 0 hyphenation exceptions out of 1000 +% 28i,0n,42p,220b,2002s stack positions out of 300i,100n,500p,30000b,4000s +% }% +% Hence I've earned a few seconds. +% +% The next idea is to expand the |\space|s in |\out_lline| and +% friends when these are defined, instead of expanding them anew +% each time an output line is written. +% \item[v\,1.909] +% \consumption{}{%1159.8 % Ow! It's getting worse. +% % 6155 strings out of 8681 +% % 68824 string characters out of 136047 +% % 113918 words of memory out of 200001 +% % 4708 multiletter control sequences out of 10000 +% % 8 words of font info for 0 fonts, out of 180000 for 256 +% % 0 hyphenation exceptions out of 2551 +% % 28i,0n,42p,220b,1982s stack positions out of 600i,150n,200p,3000b,4094s +% } +% \item[v\,1.910] +% \consumption{}{%1031.6 % Perhaps not ... +% % 5949 strings out of 8681 +% % 68261 string characters out of 136047 +% % 113840 words of memory out of 200001 +% % 4502 multiletter control sequences out of 10000 +% % 8 words of font info for 0 fonts, out of 180000 for 256 +% % 0 hyphenation exceptions out of 2551 +% % 28i,0n,42p,220b,1756s stack positions out of 600i,150n,200p,3000b,4094s +% } +% \end{description} +% + + +\begin{thebibliography}{99} +\bibitem{Fontname} + Karl Berry: \textit{Fontname}, CTAN:\discretionary{}{}{}% + \texttt{info}\slash \texttt{fontname}\slash \texttt{fontname.texi} + (and most of the other files in that directory as well). +\bibitem{mfnt} + Matthias Clasen and Ulrik Vieth: + \texttt{mfnt} (their ``work with math fonts''), 1997--8, + see \textsc{http}:/\slash \texttt{www.tug.org}\slash + \texttt{twg}\slash \texttt{mfg}\slash\texttt{archives}/. +\bibitem{LaTeX-companion} + Michel Goossens, Frank Mittelbach, Alexander Samarin: + \textit{The \LaTeX\ Companion}, + Ad\-di\-son-Wes\-ley, Reading, MA, USA, 1994. + % Addison and Wesley are names of two persons, but they + % should be joined by a hyphen since Addison-Wesley is + % a company name. Tricky that. +\bibitem{LaTeX-graph-comp} + Michel Goossens, Sebastian Rahtz, Frank Mittelbach: + \textit{The \LaTeX\ Graphics Companion: Illustrating Documents with + \TeX\ and PostScript}, + Ad\-di\-son-Wes\-ley, Reading, MA, USA, 1997; + ISBN~0-201-85469-4. +\bibitem{TAOCP2} + Donald E.\ Knuth: \textit{The art of computer programming}, + vol.~2 (\textit{Seminumerical algorithms}), 3rd ed., + Ad\-di\-son-Wes\-ley, 1997. +\bibitem{TeXbook} + Donald E.\ Knuth, Duane Bibby (illustrations): + \textit{The \TeX book}, + Ad\-di\-son-Wes\-ley, 1991, ISBN~0-201-13448-9; + also volume A of \textit{Computers and typesetting}, + ISBN~0-201-13447-0. +\bibitem{fntguide} + \LaTeX3 Project Team: \textit{\LaTeXe{} font selection}, + CTAN: \texttt{macros}\slash + \texttt{latex}\slash\texttt{base}\slash\texttt{fntguide.tex}. +\end{thebibliography} + + +\end{document} diff --git a/Master/texmf-dist/source/fontinst/base/fontinst.ins b/Master/texmf-dist/source/fontinst/base/fontinst.ins new file mode 100644 index 00000000000..7916a253328 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/fontinst.ins @@ -0,0 +1,131 @@ +% +% Copyright 1998, 1999, 2000, 2001 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. +% ----------------------------------------------------- +% +% 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. +% +% This file may only be modified if (i) it is given another name and +% (ii) all files the modified file generates using a nonempty subset +% of the files listed in the arguments of \from commands below are +% given the same preamble as that listed between \preamble and +% \endpreamble below. +% +\input docstrip.tex +\keepsilent + +\preamble + +This is a generated file. + +Copyright 1993, 1994, 1995, 1996 Alan Jeffrey, +hacked and maintained 1997, 1998 Sebastian Rahtz, +copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 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. +----------------------------------------------------- + +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. + +\endpreamble + +\declarepreamble\docpreamble + +This is a generated file. + +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. + +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. +This file may also be distributed by itself provided it is unchanged +and accompanied by some prominent file which states the location of +the sources for the fontinst system, from which this file was +generated. + +\endpreamble + + + + + +\generate{% + \usedir{tex/fontinst/base} + \file{fontinst.sty}{% + \from{fibasics.dtx}{pkg}% + \from{ficommon.dtx}{pkg}% + \from{fimain.dtx}{pkg}% + \from{ficonv.dtx}{pkg}% + \from{filtfam.dtx}{pkg,textcomp,debug}% + \from{fimapgen.dtx}{pkg}% + \from{fibasics.dtx}{pkg2}% + }% + \file{cfntinst.sty}{% + \from{fibasics.dtx}{pkg}% + \from{ficommon.dtx}{pkg}% + \from{fimain.dtx}{pkg,boundaryCompability}% + \from{ficonv.dtx}{pkg}% + \from{filtfam.dtx}{pkg,textcomp,debug}% + \from{fimapgen.dtx}{pkg}% + \from{fibasics.dtx}{pkg2}% + }% + \file{xfntinst.sty}{% + \from{fibasics.dtx}{pkg}% + \from{ficommon.dtx}{pkg}% + \from{fimain.dtx}{pkg}% + \from{ficonv.dtx}{pkg}% + \from{filtfam.dtx}{pkg,textcomp,debug,oldstyle}% + \from{fimapgen.dtx}{pkg}% + \from{fibasics.dtx}{pkg2}% + }% + \file{finstmsc.sty}{% + \from{fibasics.dtx}{pkg}% + \from{ficommon.dtx}{pkg}% + \from{fimain.dtx}{misc}% + \from{ficonv.dtx}{misc}% + \from{fimapgen.dtx}{map}% + \from{fibasics.dtx}{pkg2,misc}% + }% + \file{fontinst.ini}{\from{fibasics.dtx}{ini}}% + \usedir{tex/fontinst/misc}% + \file{csc2x.tex}{\from{ficonv.dtx}{reglyphfigures,reglyphletters,glyphs}}% + \file{csckrn2x.tex}{\from{ficonv.dtx}{reglyphfigures,reglyphletters}}% + \file{osf2x.tex}{\from{ficonv.dtx}{reglyphfigures,glyphs}}% + \usedir{tex/latex/misc}% + \usepreamble\docpreamble + \file{fontdoc.sty}{% + \from{fibasics.dtx}{doc}% + \from{ficommon.dtx}{doc}% + \from{fimain.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 + +\endbatchfile +\endinput diff --git a/Master/texmf-dist/source/fontinst/base/trig.dtx b/Master/texmf-dist/source/fontinst/base/trig.dtx new file mode 100644 index 00000000000..8540ec3dee7 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/trig.dtx @@ -0,0 +1,308 @@ +% \iffalse +%% File: trig.dtx Copyright (C) 1993 1994 1995 1996 1997 1999 David Carlisle +%% +%% This file is part of the Standard LaTeX `Graphics Bundle'. +%% 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.0 or, at your option, any later version. +%% +% +%<*dtx> + \ProvidesFile{trig.dtx} +%</dtx> +%<*!plain> +%<package&!plain>\NeedsTeXFormat{LaTeX2e} +%<package&!plain>\ProvidesPackage{trig} +%<driver> \ProvidesFile{trig.drv} +% \fi +% \ProvidesFile{trig.dtx} + [1999/03/16 v1.09 sin cos tan (DPC)] +% +% \iffalse +%</!plain> +%<*driver> +\documentclass{ltxdoc} +\usepackage{trig} +\begin{document} + \DocInput{trig.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{trig.dtx} +% \title{The \textsf{trig} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{David Carlisle} +% \date{\filedate} +% \maketitle +% +% \CheckSum{246} +% +% \changes{v1.00}{1993/00/00}{Undocumented versions} +% \changes{v1.05}{1993/10/07}{Documented, added tan} +% \changes{v1.06}{1994/02/01}{Update for LaTeX2e} +% \changes{v1.07}{1994/03/15}{Use ltxdoc} +% \changes{v1.08}{1994/10/16}{Change \cs{@xc} to \cs{nin@ty}} +% +% \section{Introduction} +% +% 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{\value{mycounter}}|, +% |\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{} +% +% \section{The Macros} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macro}{\nin@ty}\begin{macro}{\@clxx} +% \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\@clxx=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 can not 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. +% \begin{macrocode} +{\catcode`t=12\catcode`p=12\gdef\noPT#1pt{#1}} +\def\TG@rem@pt#1{\expandafter\noPT\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} +% +% \begin{macro}{\CalculateSin} +% If this angle has already been computed, do nothing, else store the +% angle, and call |\TG@@sin|. +% \begin{macrocode} +\def\CalculateSin#1{{% + \expandafter\ifx\csname sin(\number#1)\endcsname\relax + \dimen@=#1\p@\TG@@sin + \expandafter\xdef\csname sin(\number#1)\endcsname + {\TG@rem@pt\dimen@}% + \fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\CalculateCos} +% As above, but use the relation $\cos(x) = \sin(90-x)$. +% \begin{macrocode} +\def\CalculateCos#1{{% + \expandafter\ifx\csname cos(\number#1)\endcsname\relax + \dimen@=\nin@ty\p@ + \advance\dimen@-#1\p@ + \TG@@sin + \expandafter\xdef\csname cos(\number#1)\endcsname + {\TG@rem@pt\dimen@}% + \fi}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TG@reduce} +% 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@reduce#1#2{% +\dimen@#1#2\nin@ty\p@ + \advance\dimen@#2-\@clxx\p@ + \dimen@-\dimen@ + \TG@@sin} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\TG@@sin} +% Slightly cryptic, but it seems to work\ldots +% \begin{macrocode} +\def\TG@@sin{% + \ifdim\TG@reduce>+% + \else\ifdim\TG@reduce<-% + \else\TG@series\fi\fi}% +% \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@ +\expandafter\let\csname sin(0)\endcsname\z@num +\expandafter\let\csname cos(0)\endcsname\@ne +\expandafter\let\csname sin(90)\endcsname\@ne +\expandafter\let\csname cos(90)\endcsname\z@num +\expandafter\let\csname sin(-90)\endcsname\m@ne +\expandafter\let\csname cos(-90)\endcsname\z@num +\expandafter\let\csname sin(180)\endcsname\z@num +\expandafter\let\csname cos(180)\endcsname\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$. +% \begin{macrocode} +\def\CalculateTan#1{{% + \expandafter\ifx\csname tan(\number#1)\endcsname\relax + \CalculateSin{#1}% + \CalculateCos{#1}% + \@tempdima\UseCos{#1}\p@ + \divide\@tempdima\@iv + \@tempdimb\UseSin{#1}\p@ + \@tempdimb\two@fourteen\@tempdimb + \divide\@tempdimb\@tempdima + \expandafter\xdef\csname tan(\number#1)\endcsname + {\TG@rem@pt\@tempdimb}% + \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} +\expandafter\def\csname tan(90)\endcsname{\errmessage{Infinite tan !}} +\expandafter\let\csname tan(-90)\expandafter\endcsname + \csname tan(90)\endcsname +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/fontinst/base/xdoc/README b/Master/texmf-dist/source/fontinst/base/xdoc/README new file mode 100644 index 00000000000..58744d4985d --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/xdoc/README @@ -0,0 +1,67 @@ +README for the xdoc and docindex packages. + +The standard LaTeX doc package is well-known to all LaTeX hackers. +Without its support for the .dtx-file style of literate programming, +the TeX world would probably be much more plagued by the horrors of +poorly commented and mysterious code than it is today. The past good +decade that doc has been with us has been -- good. But even the sun +has spots; doc is an old package and, as old code often tends to do, +it breaks if you try to bend it into doing something new. The xdoc +package is (or rather is meant to be) a rewrite from scratch +which both can take a lot more bending and is ready for LaTeX2e*. + +What exists so far is only xdoc2: the "second prototype" for the xdoc +package. xdoc2 is not a complete rewrite of doc, but rather an add-on +to doc which reimplements many of its mechanisms (more precisely those +mechanisms which I think should be possible to "bend" into doing new +things, but have found to be fixed to their present behaviour) and +provides a few new features of its own. Even though xdoc2 is a +prototype and some of the code in it is experimental, I consider it to +be safe enough to build productive applications on, as I intend to +keep xdoc2 available even after the final xdoc package is released. + +Among the features of xdoc2 are: + - new commands for describing things (cf. \DescribeMacro) and a + package/class writer's interface for defining new such commands. + - new environments for defining things in (cf. the macro + environment) and a package/class writer's interface for defining + new such environments. + - support for two-sided document designs. + - support for external cross-referencing. + - improved sorting of macros, with support for defining prefixes + that should be ignored when sorting. + - support for CVS-style version numbering. +The other new features are of little interest to the mere user, but +they may be ever so useful to those who are in the habit of hacking +doc. Here we have for example: + - basic commands implementing a robust "string" datatype. + - an abstract command interface for making index entries; + this would simplify supporting a different index sorting + program. + +Besides xdoc2, there are also the docindex/docidx2e packages. These +provide mechanisms for a more flexible formatting of the index and list of +changes than is possible with the mechanisms for this in the doc package. +In particular docindex/docidx2e provides for automatic collapsing of +trivial index levels, something which often happens in automatically +generated multilevel indices such as the list of changes. The reason there +are two packages is that docindex is a LaTeX2e* package, whereas docidx2e +is a "downgraded" variant which runs on a normal LaTeX2e installation. +Both do however follow the same internal logic. + + +The files in this directory are: + +README.txt - this file +docindex.dtx - the source for the docindex and docidx2e packages +docindex.ins - the docstrip installation script for the docindex and + docidx2e packages +xdoc2.dtx - the source for the xdoc2 package +xdoc2.ins - the docstrip installation script for the xdoc2 package +xdocdemo.tex - a document which demonstrates some of the features in + the xdoc2 package + +2003/07/06, +Lars Hellstr\"om + + diff --git a/Master/texmf-dist/source/fontinst/base/xdoc/docindex.dtx b/Master/texmf-dist/source/fontinst/base/xdoc/docindex.dtx new file mode 100644 index 00000000000..47139d32b12 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/xdoc/docindex.dtx @@ -0,0 +1,2100 @@ +% \CheckSum{893} +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\usepackage{xdoc2} + +\makeatletter +\NewMacroEnvironment{templatetype}{\XD@grab@harmless\relax}{1}% + {\MacroFont#1\ \normalfont type}% + {\XDMainIndex{\LevelSorted{#1}{\texttt{#1} template type}}}% + {{#1}{\texttt{#1} template type}}% + {}% +\NewMacroEnvironment*{template}{% + \XD@grab@harmless\relax\XD@grab@harmless\relax +}{2}% + {\XDParToMargin{\MacroFont #1\textnormal{\slash}#2 \normalfont + template}}% + {\XDMainIndex{ + \LevelSorted{#1}{\texttt{#1} template type}% + \LevelSorted{#2}{\texttt{#2} template}% + }}% + {{#1/#2}{\texttt{#1}\slash\texttt{#2} template}}% + {\def\XD@template@sort{% + \LevelSorted{#1}{\texttt{#1} template type}% + \LevelSorted{#2}{\texttt{#2} template}% + }}% +\NewMacroEnvironment*{instance}{% + \XD@grab@harmless\relax\XD@grab@harmless\relax +}{2}% + {\XDParToMargin{\MacroFont #1\textnormal{\slash}#2 \normalfont + instance}}% + {\XDMainIndex{ + \LevelSorted{#1}{\texttt{#1} template type}% + \LevelSorted{#2}{\texttt{#2} instance}% + }}% + {{#1/#2}{\texttt{#1}\slash\texttt{#2} instance}}% + {}% +\NewMacroEnvironment*{collectioninstance}{% + \XD@grab@harmless\relax\XD@grab@harmless\relax\XD@grab@harmless\relax +}{3}% + {\XDParToMargin{\MacroFont #2\textnormal{\slash}#3 \normalfont + instance (\texttt{#1} collection)}}% + {\XDMainIndex{ + \LevelSorted{#2}{\texttt{#2} template type}% + \LevelSorted{#3}{\texttt{#3} instance}% + \LevelSorted{#1}{\texttt{#1} collection}% + }}% + {{#2/#3/#1}% + {\texttt{#2}\slash\texttt{#3} instance (\texttt{#1} collection)}}% + {}% +\@namedef{XD@harmless\string\break}{% + \toks@=\expandafter{\the\toks@ \protect\nolinebreak[3]}% + \XD@harmless@ +} +\newcommand\keyvalitem[2]{% + \item[#1 (#2)% + \IndexEntry{\XD@template@sort + \LevelSorted{#1}{\textit{#1} keyval (#2)}% + }{usage}{\thepage}% + ]% +} +\newcommand{\xrefoff}{\scan@allowedfalse} +\newcommand{\xrefon}{\scan@allowedtrue} +\makeatother + +\newenvironment{syntax}{% + \let\\=\break + \list{}{% + \setlength\topsep{\medskipamount}% + \setlength\partopsep{0pt}% + \setlength\itemsep{0pt plus 1pt}% + \setlength\parsep{\itemsep}% + \setlength\leftmargin{3em}% + \setlength\listparindent{1em}% + \setlength\itemindent{-2em}% + \setlength\labelwidth{0pt}% + \setlength\labelsep{0pt}% + \csname @endparpenalty\endcsname=500 + \def\makelabel##1{\mbox{\meta{##1}${}\longrightarrow{}$}}% + }% + \addtolength\rightskip{0pt plus 1fil}% + \linepenalty=300% +}{\endlist} +\newcommand\branch{\({}\mid{}\)\ignorespaces} + +\DeclareRobustCommand{\package}[1]{\textsf{#1}} +\DeclareRobustCommand{\program}[1]{\textsf{#1}} +\DeclareRobustCommand\LaTeXplus{\LaTeXe$*$} + +\DoNotIndex{\addvspace,\@backslashchar,\begin,\begingroup,\bgroup} +\DoNotIndex{\csname,\DeclareInstance,\DeclareOption} +\DoNotIndex{\DeclareTemplate,\DeclareTemplateType,\def} +\DoNotIndex{\DoParameterAssignments,\edef,\egroup,\@eha} +\DoNotIndex{\@empty,\end,\endcsname,\endgroup,\endinput,\expandafter} +\DoNotIndex{\@firstofone,\@firstoftwo,\global,\@gobble,\hb@xt@,\hfil} +\DoNotIndex{\hsize,\hspace,\IfNoValueTF,\@ifpackageloaded} +\DoNotIndex{\@ifpackagewith,\@ifundefined,\ignorespaces,\@input@} +\DoNotIndex{\jobname,\leftskip,\let,\MessageBreak,\@namedef,\@ne} +\DoNotIndex{\NeedsTeXFormat,\newcommand,\nobreak,\@nobreakfalse} +\DoNotIndex{\nopagebreak,\normalsize,\NoValue,\number,\outer} +\DoNotIndex{\p@,\PackageError,\PackageInfo,\PackageWarningNoLine} +\DoNotIndex{\pagestyle,\par,\parfillskip,\parindent,\parskip} +\DoNotIndex{\@plus,\ProcessOptions,\protect,\protected@edef} +\DoNotIndex{\providecommand,\ProvidesPackage,\relax,\renewcommand} +\DoNotIndex{\RequirePackage,\rightskip,\romannumeral,\@secondoftwo} +\DoNotIndex{\small,\space,\textbf,\thispagestyle,\thr@@,\tw@} +\DoNotIndex{\vadjust,\vspace,\z@,\z@skip} +\DoNotIndex{\iffalse,\ifnum,\ifx,\else,\fi} % \fi \fi +\DoNotIndexBy{@} +\DoNotIndexBy{DI@} + +\CodelineIndex +\EnableCrossrefs +\RecordChanges +\setcounter{IndexColumns}{2} +\setcounter{StandardModuleDepth}{2} + + +\begin{document} +\DocInput{docindex.dtx} +\PrintChanges +\PrintIndex +\end{document} +%</driver> +% \fi +% +% \title{The \package{docindex} package} +% \author{Lars Hellstr\"om} +% \date{8 July 2003} +% \maketitle +% +% \begin{abstract} +% The \package{docindex} package implements template-based formatting +% of indices and lists of changes\slash glossaries. In addition to this, +% the control structures employed also provide for a couple of new +% features, such as automatic collapsing of trivial index levels. +% \end{abstract} +% +% \tableofcontents +% +% +% \section{Introduction} +% +% In automatically generated indices with multi-level entries, such as the +% list of changes of a \package{doc} document, it often happens that some +% entries are uniquely identified by their primary level sort keys, +% although there are sort keys and text for additional levels. If then +% the formatting is designed for entries that are uniquely identified +% only when their secondary or tertiary sort keys are considered, one +% ends up with a couple of entries that look rather peculiar (building +% a tree which never branches) and usually take up much more space than +% they need to. The remedy for this is of course to make the formatting +% smart enough to recognise this situation when it occurs and flexible +% enough to format the text is a more suitable manner. +% +% An example of this is that if a document contains the index +% entries\footnote{I'm using the default \program{makeindex} +% metacharacters in these examples, but the style file provided for +% this package actually uses the same metacharacters as those style files +% provided by the \package{doc} package---hence the `\package{doc}' +% in `\package{docindex}'. } +% \begin{quote} +% |\index{Bernoulli!Jacob}\index{Bernoulli!Johann}| +% \end{quote} +% then it is probably reasonable to format this as +% \begin{quote} +% Bernoulli,\\ +% \vadjust{}\quad Jacob\\ +% \vadjust{}\quad Johann +% \end{quote} +% but if the index entries instead were +% \begin{quote} +% |\index{Jacobi!Carl}\index{Bernoulli!Jacob}| +% \end{quote} +% then it is probably better to format this as +% \begin{quote} +% Bernoulli, Jacob\\ +% Jacobi, Carl +% \end{quote} +% than as +% \begin{quote} +% Bernoulli,\\ +% \vadjust{}\quad Jacob\\ +% Jacobi,\\ +% \vadjust{}\quad Carl +% \end{quote} +% +% The \program{makeindex} program has some features in this direction, +% but they only allow dependence on the previous item in the index, not +% the next item, which is what you need to know when deciding whether +% `Jacob' should go on the same line as `Bernoulli'. Therefore +% \package{docindex} pretty much ignores these features in +% \program{makeindex} and instead sees to that each command that is to +% typeset an index item knows what kind of items were before and after it. +% +% Another reason for writing this package was to try out the template +% mechanisms as provided by the \LaTeXplus\ \package{template} +% package.\footnote{\LaTeXplus\ is the name of the \LaTeX\ version after +% \LaTeXe. Rather than being a completely different kernel\slash format, +% \LaTeXplus\ is (will be) implemented as a collection of \LaTeXe\ +% packages which replace parts of the kernel. More information and +% package code can be found on the \LaTeX-project website~^^A +% \cite{LaTeX-project}.} My impression is that this experiment turned +% out strikingly well. I have always found the more layout-oriented +% aspects of \TeX\ programming a bit cumbersome, but the separation of +% layout details from control structures that becomes natural when +% employing template mechanisms seems to have made it much easier. I'm +% not sure why this is so, but it could be as simple as that the layout +% settings are no longer diluted in the control structures. In any +% case, I would recommend people creating new \LaTeXe\ packages to +% employ template mechanisms in at least the initial development +% versions of the package, for the following reasons: (i) it reduces the +% work of updating the package for \LaTeXplus, (ii) it furthers the +% development of \LaTeXplus, and (iii) it might actually become a +% better package. +% +% A third reason for writing the \package{docindex} package was to get +% the \LaTeX\ document ``back in control'' of how the index is formatted. +% Certainly it is the document which has the final say about what +% the command in the \texttt{.ind} file actually do, but the traditional +% \program{makeindex} style files that are used place severe restrictions +% on the formatting of the index simply because they control where the +% commands are put. \package{docindex} tries to reduce these +% restrictions by making all texts in the index arguments of commands. +% Certainly there is a lot more that could be done in this direction---in +% particular, the (page) numbers in the index could be coded as a +% |\do|-type list rather than as an explicitly comma-separated list as is +% done now---but what is in \package{docindex} at the moment seems to +% satisfy all my current needs. +% +% +% \section{Usage} +% +% \subsection{Straightforward usage} +% +% To make use of the \package{docindex} package in formatting the index +% and list of changes of a \package{doc}-type \LaTeX\ document, you must +% do the following: +% \begin{enumerate} +% \item Load the \package{docindex} package (or probably +% rather the \package{docidx2e} package---see below). +% \item Make sure that the index entries does not use any commands, +% such as |\verb|, that rely on changing catcodes or otherwise +% need to be executed before the entire entry text has been +% tokenized. +% \item Generate the \texttt{.ind} and \texttt{.gls} files using +% \texttt{docindex.ist} as style file for \program{make\-index}. +% \end{enumerate} +% (Item~2 may seem like a monumental task if one considers what the +% indices of \package{doc} documents traditionally looks like---there's +% a |\verb| for every macro name in the index---but it is really not +% that bad. \package{docindex} loads the \package{xdoc} package~^^A +% \cite{xdoc} which redefines \texttt{macro}, the cross-referencing +% mechanism, etc.\ so that the index entries generated by these no +% longer uses |\verb|. What is left for you to deal with are merely +% the possible uses of |\verb| in explicit |\index| or |\SortIndex| +% commands.) +% +% What advantages are there then for the normal user in having +% \package{docindex} formatting the index and list of changes, as +% opposed to using the default mechanisms in the \package{doc} package? +% I can only think of two: the index or list of changes may be typeset in +% a single column and the same \program{makeindex} style file can be +% used for both index and list of changes. Neither advantage is +% significant. Instead the advantage of \package{docindex} lies in that +% it becomes much simpler to change the formatting, which is rather an +% advantage for advanced users which have special needs, and +% in particular one can do this without having to supply e.g.\ extra +% \program{makeindex} style files. +% +% Another important point is that what you will want to use is probably +% not the \LaTeXplus\ \package{docindex} package, but the ``downgraded'' +% \LaTeXe\ version \package{docidx2e}, as the former uses the +% \package{galley2} package which currently wrecks pretty much all +% justification in all existing document classes. \package{docidx2e} +% provides the same features as \package{docindex}, but configuring it +% is somewhat more cumbersome since \package{template} won't do most of +% the coding for you. It is however rather straightforward to convert +% a definition using the \package{docindex} package to something which +% achieves the same results with the \package{docidx2e} package. +% +% +% \subsection{Multiple indices} +% +% The \package{docindex} package makes it comparatively simple to +% include several indices in the same document: all one has to do is +% use an instance or template of type \texttt{docindex} for each index +% one wishes to typeset. The syntax for using such an instance is +% \begin{quote} +% |\UseInstance{docindex}|\marg{instance}\marg{prologue}^^A +% \marg{epilogue} +% \end{quote} +% The \meta{prologue} and \meta{epilogue} are texts which will be +% printed just before and after the index, respectively, and either may +% be empty. The text for the index itself is read from another file, +% the name and extentsion of which are specified by the instance. The +% \texttt{std} template prints the \meta{prologue} and \meta{epilogue} +% in one-column mode, whereas the index itself can be printed in one- or +% multicolumn mode (the default is three columns). +% +% The \package{doc} commands |\PrintIndex| and |\PrintGlossary| are +% redefined to be +% \begin{quote} +% |\UseInstance{docindex}{index}{\index@prologue}{}| +% \end{quote} +% and +% \begin{quote} +% |\UseInstance{docindex}{changes}{\glossary@prologue}{}| +% \end{quote} +% respectively. The \texttt{index} and \texttt{changes} instances of +% type \texttt{docindex} give the same formatting as the \package{doc} +% defaults. (The \package{docidx2e} definitions even use the +% \package{doc} package parameters where applicable, but in +% \package{docindex} it is much simpler to redefine the instance from +% scratch.) +% +% The format of the sorted index files (\texttt{.ind}, \texttt{.gls}, +% etc.) that a \texttt{docindex} instance inputs is rather complicated +% and I would suggest that the generation of these files is left to the +% \program{makeindex} program, but the complete syntax is described in +% Subsection~\ref{Ssec:ist}. The syntax of the unsorted index files +% (\texttt{.idx}, \texttt{.glo}, etc.) is simpler; there are only a few +% things that are different from the index files of the \package{doc} +% package. +% +% The foremost difference is that the index entries should begin not +% with |\indexentry| or |\glossaryentry|, but with |\docindexentry|. The +% \package{xdoc} package provides hooks with which one can change these +% texts in entries generated using the |\index| and |\glossary| commands +% (as well as higher-level commands built on these, such as the +% |\SortIndex| and |\changes| commands) and \package{docindex} will use +% these hooks unless it gets passed the \describeoption{oldkeywords} +% \texttt{oldkeywords} option. If you are creating a third unsorted +% index file then you will have to make sure that the command for writing +% to that file uses |\docindexentry| in the right place. +% +% The other difference concerns the composite page numbers. The string +% which separates the parts of a composite page number is not a +% hyphen `|-|', but the string `|\+|'. (The |\+| command is locally +% defined for the typesetting of each index by the \texttt{docindex} +% template being used, and the default is to typeset a hyphen.) Again +% the \package{xdoc} package provides a hook for this, and this hook is +% used by \package{docindex} unless it gets passed the +% \texttt{oldkeywords} option. +% +% It also deserves to be listed which the metacharacters are that are +% the same as in \package{doc} indices. The level separator is `|>|', +% the sort~key\slash item~text separator is `|=|', and the quote +% character is `|!|'. All other \program{makeindex} metacharacter +% parameters have their default values. +% +% +% +% \subsection{Configuration} +% +% Configuration of the layout provided by the \package{docindex} +% package is primarily done by redefining the \texttt{index} and +% \texttt{changes} instances of type \texttt{docindex}, since these are +% the instances that are used by the |\PrintIndex| and |\PrintChanges| +% commands. +% +% The index in the \texttt{source2e.tex} file (the main driver for the +% \LaTeXe\ source) differs from the default in three respects: it is set +% in two columns rather than three, there is no seperator character +% between the parts of a composite page number, and the pagestyle is set +% to \texttt{docindex} during the index. This is set up by the +% redefinition +%\begin{verbatim} +%\DeclareInstance{docindex}{index}{std}{ +% columns=2, page-compositor={}, pagestyle=docindex +%} +%\end{verbatim} +% (There are however also some changes of parameters related to +% linebreaking; more on that in connection to configuration of the +% \texttt{changes} instance below.) +% +% Another kind of modification can be found in the \package{tclldoc} +% package~\cite{tclldoc}. Here the primary level in the index is used for +% names of procedures and variables, whereas the secondary level for the +% namespace of the same (the same name may have different definitions +% in different namespaces). If there is only one namespace for a given +% name then it is probably overkill to format them as two different +% index items, but better to join them. This can be achieved through +% the redefinition +%\begin{verbatim} +%\DeclareInstance{docindex}{index}{std}{% +% item1=fixed-r1a, item2=aloneaccept2 +%}% +%\end{verbatim} +% An item handled by the \texttt{fixed-r1a} instance (of type +% \texttt{indexitem}) always tries to join with the following item but +% rejects to join with the preceeding one. An item handled by the +% \texttt{aloneaccept2} instance accepts to join with the preceeding +% item if neither that nor the following item is a secondary level item. +% Thus an item for a name will join with the following item for a +% namespace if there is only one such item. As the reader no doubt +% realises, this also solves the problem with the Bernoullis that was +% described in the introduction. +% +% \pagebreak[1] +% +% As for configuring the list of changes formatting, it is instructive +% to start by considering its default definition: +%\begin{verbatim} +%\DeclareInstance{docindex}{changes}{std}{ +% file-extension = gls, +% item2 = fixed-r2a-nocomma, +% item3 = fixed-a3r, +% columns = 2, +% letter-format = , +% letter-skip = 0pt +%} +%\end{verbatim} +% In the list of changes a secondary level item (which contains the name +% of the macro or whatever which was changed) is joined with the +% following tertiary level item (which details the change that was made). +% There are two columns and letter groups are not given any special +% formatting. +% +% The definition of \texttt{changes} that would be used for +% \texttt{source2e.tex} differs from the above in only one keyval, +% namely \textit{body-setup}, but that contains quite a lot of material. +% To begin with there is the default |\small| which selects the font. +% Then there is a |\makeatletter| which is needed because some |\changes| +% entries in the \LaTeX\ sources include commands (e.g.~|\TeX|) that +% (when written to file) expand to other commands whose names include the +% |@| character. If these are to be tokenized correctly, |@| must be a +% letter when the \texttt{.gls} file is being inputted. Last, but not +% least, there is a modification of the linebreaking parameters: +%\begin{verbatim} +%\UseTemplate{linebreak}{TeX}{ +%\end{verbatim} +% The file \texttt{source2e.tex} explicitly sets \textit{hbadness} and +% \textit{hfuzz} to make \TeX\ shut up about over- and underfull hboxes. +%\begin{verbatim} +% hbadness=10000, hfuzz=\maxdimen, +%\end{verbatim} +% In addition to this, there are a couple of parameters that are set by +% the \texttt{multicols} environment to values quite different from the +% defaults of the \texttt{TeX} template and thus must be set too. Here +% they are shown with their default values. The value of +% \textit{emergency\-stretch} could probably be increased. +%\begin{verbatim} +% pretolerance=-1, tolerance=9999, emergencystretch=8pt +%} +%\end{verbatim} +% Summing that up, we arrive at the following definition of the +% \texttt{changes} instance for \texttt{source2e.tex}. +%\begin{verbatim} +%\DeclareInstance{docindex}{changes}{std}{ +% file-extension = gls, +% item2 = fixed-r2a-nocomma, +% item3 = fixed-a3r, +% columns = 2, +% letter-format = , +% letter-skip = 0pt, +% body-setup = \small\makeatletter +% \UseTemplate{linebreak}{TeX}{ +% hbadness=10000, hfuzz=\maxdimen, +% pretolerance=-1, tolerance=9999, emergencystretch=8pt +% } +%} +%\end{verbatim} +% +% Another example can be found in the \package{fisource} +% package\footnote{It should probably rather be made a document class, +% but I haven't found it that necessary to change that aspect of it.}^^A +% ~(v\,2.10 or later), which sets up formatting for the \program{fontinst} +% source. There the list of changes should be set in one column, with +% items from the tertiary level being joined with their parent +% secondary level items iff the tertiary item is the only one having +% that particular parent item. This is achieved through the definition +%\begin{verbatim} +%\DeclareInstance{docindex}{changes}{std}{% +% file-extension = gls, +% item2 = fixed-r2a-nocomma, +% item3 = aloneaccept3, +% columns = 1, +% letter-format = {}, +% letter-skip = 0pt +% } +%\end{verbatim} +% where the difference to the default definition is in the values for +% the \textit{item3} and \textit{columns} keys. +% +% For details on what they various keys mean, see the declaration of +% the \texttt{std} template of type \texttt{docindex} on +% page~\pageref{docindex:std}. +% +% With the \package{docidx2e} package, configuration follows the same +% logic, even though it is much more technical as one has to define +% the instances without the help of a template. The default instance +% definitions for the \package{docidx2e} package are the +% \begin{quote} +% |\@namedef{TP@I{}{docindex}{index}}#1#2{|\dots|}|\\ +% |\@namedef{TP@I{}{docindex}{changes}}#1#2{|\dots|}| +% \end{quote} +% that begin on pages~\pageref{p:index-instance} +% and~\pageref{p:changes-instance} respectively. +% +% +% +% +% +% \StopEventually{ +% % \begin{thebibliography}{9} +% \bibitem{xindex} +% Achim Blumensath: \textit{The \package{xindex} package}; +% \textsc{http:}/\slash +% \texttt{www-mgi.\nolinebreak[3]informatik.\nolinebreak[3]^^A +% rwth-aachen.de}\slash \texttt{\textasciitilde blume}/. +% \bibitem{makeindex-paper} +% Pehong Chen, Michael A. Harrison: +% \textit{Index Preparation and Processing}, +% Software: practice \& experience, vol. \textbf{19}, no. 9 (1988), +% 897--915; +% Computer Science Tech. Report 87/347, University of California, +% Berkeley, March 1987; +% \textsc{ctan:}\discretionary{}{}{\thinspace}\texttt{indexing}^^A +% \slash\texttt{makeindex}\slash\texttt{paper}\slash +% \texttt{ind.tex}. +% \bibitem{tclldoc} +% Lars Hellstr\"om: +% \textit{The \package{tclldoc} package and class}, +% v\,2.20 or newer; +% \textsc{ctan}:\discretionary{}{}{\thinspace}\texttt{macros}\slash +% \texttt{latex}\slash \texttt{contrib}\slash +% \texttt{tclldoc}\slash \texttt{tclldoc.dtx}. +% Note: At the time of writing, this has not yet been uploaded +% to CTAN. +% \bibitem{xdoc} +% Lars Hellstr\"om: +% \textit{The \package{xdoc} package --- experimental +% reimplementations of features from \package{doc}, +% second~prototype}, 2000--2003; +% \textsc{ctan}:\discretionary{}{}{\thinspace}\texttt{macros}\slash +% \texttt{latex}\slash \texttt{contrib}\slash \texttt{xdoc}\slash +% \texttt{xdoc2.dtx}. +% \bibitem{xindy} +% Roger Kehr: +% \textit{\program{xindy} --- A Flexible Indexing System}; +% \textsc{ctan}:\discretionary{}{}{\thinspace}\texttt{indexing}^^A +% \slash\texttt{xindy}/. +% \bibitem{LaTeX-project} +% The \LaTeX3 Project: \textit{The \LaTeX\ Project Home Page}; +% \textsc{http:}/\slash\texttt{www.latex-project.org}/. +% \bibitem{multicol} +% Frank Mittelbach: \textit{An environment for multicolumn output}; +% \textsc{ctan}:\discretionary{}{}{\thinspace}\texttt{macros}\slash +% \texttt{latex}\slash \texttt{required}\slash \texttt{tools}\slash +% \texttt{multicol.dtx}. +% \bibitem{doc} +% Frank Mittelbach, B.~Hamilton Kelly, Andrew Mills, Dave Love, and +% Joachim \mbox{Schrod}: \textit{The \package{doc} and +% \package{shortvrb} Packages}, The \LaTeX3 Project; ^^A , 1993~ff. +% \textsc{ctan}:\discretionary{}{}{\thinspace}\texttt{macros}\slash +% \texttt{latex}\slash \texttt{base}\slash \texttt{doc.dtx}. +% \end{thebibliography} +% } +% +% +% +% +% \section{Implementation} +% +% \subsection{\package{docstrip} modules} +% +% This file contains a number of \package{docstrip} module directives, +% and many of these guard code that is not going to be used. In part +% this mirrors the development of the code (and may get cleared up +% eventually), but most of this duplication has to do with making the +% code work in many different set-ups (some of which involve other +% packages whose interface is rapidly changing). +% +% The modules which control \LaTeX\ code are: +% \begin{description} +% \item[\textsf{pkg}] +% Main guard for code that is to end up in some \LaTeX\ package. +% \item[\textsf{template}] +% Guard for code which uses features of the \package{template} +% package. This code will end up in the \package{docindex} package, +% whereas the equivalent code which avoids using templates ends up +% in the \package{docidx2e} package. +% \item[\textsf{default}] +% This code protects the default values for template keys. The +% syntax for this is changing, so the default values are currently +% being assigned in the template bodies instead. +% \end{description} +% +% The modules which control \program{makeindex} style files are: +% \begin{description} +% \item[\textsf{ist}] +% Code for the main style file \texttt{docindex.ist}. +% \item[\textsf{idx}] +% Code for a style file which is like the main one, but the input +% parameters are set to the same values as in the standard \LaTeX\ +% \texttt{gind.ist}. +% \item[\textsf{glo}] +% Code for a style file which is like the main one, but the input +% parameters are set to the same values as in the standard \LaTeX\ +% \texttt{gglo.ist}. +% \end{description} +% +% +% \subsection{Initial stuff} +% +% \begin{macrocode} +%<*pkg> +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage +%<template> {docindex} +%<!template> {docidx2e} + [2001/04/11 v1.00 doc index formatting package] +% \end{macrocode} +% +% Since the \texttt{multicols} environment is used by the \texttt{std} +% template of type \texttt{docindex}, the \package{multicol} package +% must have been loaded. +% \begin{macrocode} +\RequirePackage{multicol} +% \end{macrocode} +% This will probably change in \package{docindex} once I get around to +% check how this kind of thing is implemented in the \LaTeXplus\ output +% routine. +% +% Since the \texttt{docindex} pagestyle may be used the \package{xdoc} +% package must have been loaded. This also loads the \package{doc} +% package which contains the definition of |\pfill|. +% \begin{macrocode} +\RequirePackage{xdoc2}[2001/03/26] +% \end{macrocode} +% +% +% \begin{option}{oldkeywords} +% The \texttt{oldkeywords} option tells the \package{docindex} +% package to not change the index entry keywords from the \package{doc} +% defaults. The code for this option appears further down. +% \begin{macrocode} +\DeclareOption{oldkeywords}{} +% \end{macrocode} +% \end{option} +% +% \begin{option}{usedocindexps} +% The \texttt{usedocindexps} option tells the \package{docindex} +% package to set the pagestyle to \texttt{docindex} (defined by +% \package{xdoc}) when typesetting the index. The code for this option +% appears further down. +% \begin{macrocode} +\DeclareOption{usedocindexps}{} +% \end{macrocode} +% \end{option} +% +% \begin{macrocode} +\ProcessOptions\relax +%</pkg> +% \end{macrocode} +% +% +% +% \subsection{Index style files} +% \label{Ssec:ist} +% +% The \program{makeindex} style files uses four commands. The most +% important command is \DescribeMacro{\indexitem}|\indexitem|, which +% has the two syntaxes +% \begin{quote} +% |\indexitem|\marg{level}\marg{text}\marg{next level}\\ +% |\indexitem|\marg{level}\marg{text}|{9}|\marg{numbers}^^A +% \marg{next level} +% \end{quote} +% The \meta{level} is an integer in the range 1--3, the \meta{next level} +% is an integer in the range 0--3, the \meta{text} is the item text, +% and the \meta{numbers} is a list of (page or the like) numbers. The +% reason for this dual syntax is limitations of \program{makeindex}: +% there is no way of making the text inserted after an item depend on +% whether there are any page numbers for this item, so one cannot make +% \meta{numbers} a straightforward optional argument. +% +% The level numbers specify at what level the item is. Level~1 +% corresponds to |\item|, level~2 corresponds to |\subitem|, and +% level~3 corresponds to |\subsubitem|. The \meta{next level} number +% may also be 0, and that denotes non-|\indexitem| material such as a +% space between letter groups or the end of the index. The purpose of +% the \meta{next level} argument is to let the formatting of an item +% depend on what level the next item has, a feature that +% \program{makeindex} alone doesn't provide. Since \program{makeindex} +% only supports putting text in front of things, each new item must +% begin by inserting the closing brace on the second last argument and +% the very last argument of the \emph{previous} item before it can do +% anything for itself. This leads to the following contents of the +% \program{makeindex} |item_|\textellipsis\ parameters. +% +% \xrefoff +% \begin{macrocode} +%<*ist|idx|glo> +item_0 "}{1}\n\\indexitem{1}{" +item_1 "}{2}\n \\indexitem{2}{" +item_01 "}{2}\n \\indexitem{2}{" +item_x1 "}{2}\n \\indexitem{2}{" +item_2 "}{3}\n \\indexitem{3}{" +item_12 "}{3}\n \\indexitem{3}{" +item_x2 "}{3}\n \\indexitem{3}{" +% \end{macrocode} +% \SpecialIndex{\indexitem} ^^A I can't believe I'm using this! +% \begin{macrocode} +delim_0 "}{9}{" +delim_1 "}{9}{" +delim_2 "}{9}{" +delim_n ", " +delim_r "--" +%</ist|idx|glo> +% \end{macrocode} +% \xrefon +% +% +% \begin{macro}{\indexitem} +% \begin{macro}{\DI@indexitem} +% \begin{macro}{\DI@indexitem@} +% \begin{macro}{\DI@last@level} +% The |\indexitem| command (and its subsidiary macros |\DI@indexitem| +% and |\DI@indexitem@| only handle argument grabbing and some +% elementary processing of level numbers. The formatting of the item +% is instead handled by the |\DI@indexitem@|\meta{level}, where +% \meta{level} is the roman numeral |i|, |ii|, or |iii|, family of +% control sequences. |\indexitem| itself doesn't grab any arguments, +% instead it inserts the contents of |\DI@last@level| as an +% additional argument in front of |\DI@indexitem|. The actual +% argument structures of the other macros are +% \begin{quote} +% |\DI@indexitem|\marg{last}\marg{this}\marg{text}^^A +% \marg{next/\texttt{9}}\\ +% |\DI@indexitem@|\marg{cmd}\marg{last}|{9}|\marg{text}^^A +% |\NoValue|\marg{figures}\marg{next} +% \end{quote} +% where \meta{this} is the level of this item, \meta{next} is the +% level of the next item, \meta{text} is the item text, and +% \meta{figures} are the (page) numbers for this item. Several of the +% arguments of |\DI@indexitem@| are immediately gobbled; they are +% only used when the original |\indexitem| did not have a +% \meta{numbers} argument. +% +% The |\DI@last@level| macro stores the level of the last item before +% the current. It is set and used by |\DI@indexitem@|. +% \begin{macrocode} +%<*pkg> +\newcommand\indexitem{% + \relax + \expandafter\DI@indexitem \expandafter{\DI@last@level}% +}% +% \end{macrocode} +% \begin{macrocode} +\def\DI@indexitem#1#2#3#4{% + \edef\DI@last@level{\number#2\expandafter}% + \ifnum #4=9 + \expandafter\expandafter \expandafter\DI@indexitem@ + \fi + \csname DI@indexitem@\romannumeral#2\expandafter\endcsname + {#1}{#4}{#3}\NoValue +} +% \end{macrocode} +% \begin{macrocode} +\def\DI@indexitem@#1#2#3#4#5#6#7{#1{#2}{#7}{#4}{#6}} +% \end{macrocode} +% \begin{macrocode} +\def\DI@last@level{0} +%</pkg> +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% The \describecsfamily{DI@indexitem@\meta{level}}|\DI@indexitem@|^^A +% \meta{level}, where \meta{level} is the lower case roman numeral form +% of the level number, family of control sequences have the syntax +% \begin{quote} +% |\DI@indexitem@|\meta{level}\,\marg{previous}\marg{next}^^A +% \marg{text}\marg{figures} +% \end{quote} +% where \meta{previous} and \meta{next} are the levels of the previous +% and following index items, \meta{text} is the entry text of this +% item, and \meta{figures} are the (page) numbers for this item, if it +% has any, or the token |\NoValue|, if it hasn't. +% +% +% \xrefoff +% \begin{macrocode} +%<*ist|idx|glo> +group_skip "}{0}\n%^^A\n\\indexnewletter{0}{" +heading_prefix "" +heading_suffix "" +headings_flag 1 +%</ist|idx|glo> +% \end{macrocode} +% \SpecialIndex{\indexnewletter} +% \xrefon +% +% +% \begin{macro}{\indexnewletter} +% \changes{v\,1.00}{2001/04/05}{Made it \cs{outer}. (LH)} +% The |\indexnewletter| command is placed in front of a new letter +% group. It has the syntax +% \begin{quote} +% |\indexnewletter|\marg{first}\marg{letter}\marg{next} +% \end{quote} +% where \meta{first} is a flag (|1| if this |\indexnewletter| +% is at the very beginning of the index, |0| otherwise), \meta{letter} +% is the letter name (according to the \program{makeindex} program; it +% can be e.g.\ the string `Symbols') and \meta{next} is the level of +% the next item (I think this will always be |1| with +% \program{makeindex}). The command takes care of declining an offer +% to join with the previous index item, inserts some vertical space +% if the \meta{first} is |0|, print the \meta{letter} using +% |\DI@letter@format|, and doesn't offer to join with the following +% item. +% \begin{macrocode} +%<*pkg> +\@ifundefined{indexnewletter}{}{% + \PackageInfo +%<template> {docindex} +%<!template> {docidx2e} + {Command \protect\indexnewletter\space redefined} +} +\outer\def\indexnewletter#1#2#3{% + \DI@item@nojoin + \ifnum #1=\z@ \vspace{\DI@letter@skip}\fi + \DI@letter@format{#2}% + \def\DI@last@level{0}% + \let\DI@item@join\@firstofone + \let\DI@item@nojoin\@empty +} +%</pkg> +% \end{macrocode} +% \end{macro} +% +% The index style files also need to set some parameters which aren't +% directly connected to the commands provided by the \package{docindex} +% package. First there's the input style parameters:\xrefoff +% \begin{macrocode} +%<*ist|idx|glo> +actual '=' +quote '!' +level '>' +% \end{macrocode} +% Then the page precedence should be changed. This is mainly for the +% convenience of use with documents that |\DocInclude| files, since +% these by default number the files using letters. +% \begin{macrocode} +page_precedence "naArR" +% \end{macrocode} +% In \texttt{docindex.ist}, both the \texttt{keyword} and the +% |page_compositor| strings are different from their standard values. It +% turns out to be hard to use a normal command as page compositor, +% because \program{makeindex} always rejects spaces and braces in the +% page number even if they is in the |page_compositor| parameter! +% \begin{macrocode} +%<ist>keyword "\\xdocindexentry" +%<ist>page_compositor "\\+" +% \end{macrocode} +% \SpecialIndex{\+} +% Finally, in the style file for the list of changes, the keyword must +% be changed to |\glossaryentry|. +% \begin{macrocode} +%<glo>keyword "\\glossaryentry" +%</ist|idx|glo> +% \end{macrocode} +% \xrefon +% +% +% \begin{option}{oldkeywords} +% \begin{macro}{\XD@index@keyword} +% \begin{macro}{\XD@glossary@keyword} +% \begin{macro}{\XD@page@compositor} +% \changes{v\,1.00}{2001/04/05}{Changed it from \cs{PageCompositor-} to +% \cs{+}. (LH)} +% To make the contents of the \texttt{.idx} and \texttt{.glo} files +% compatible with the input parameter settings of +% \texttt{docindex.ist}, some macros used by the \package{xdoc} +% package must be redefined. This can however be stopped if the +% \texttt{oldkeywords} option is passed to the \package{docindex} +% package. +% \begin{macrocode} +%<*pkg> +\@ifpackagewith +%<template> {docindex} +%<!template> {docidx2e} + {oldkeywords}{}{ + \edef\XD@index@keyword{\@backslashchar xdocindexentry} + \let\XD@glossary@keyword\XD@index@keyword + \def\XD@page@compositor{\@backslashchar +} +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{option} +% +% \changes{v\,1.00}{2001/03/25}{The index file is no longer a +% \texttt{thedocindex} environment---the layout must instead be set +% by the command which \cs{input}s the index. Introduced the +% \cs{docindexguard} command to handle situations with incompatible +% index styles. (LH)} +% +% \begin{macro}{\docindexguard} +% \begin{macro}{\DI@ind@setup} +% The first line of every \texttt{docindex} style sorted index file is +% \begin{quote} +% |\docindexguard{\endinput}| +% \end{quote} +% If the index file is inputted as a classical sorted index file then +% this will produce an undefined command error and no more lines in +% the index will be read. If the index file is inputted using the +% conventions of the \package{docindex} package then the +% |\docindexguard| will instead gobble the |\endinput| so that the +% file will be read. +% +% One can also have the opposite problem: a classical style index file +% is being input using \package{docindex} conventions. It is to +% overcome this problem that the |\DI@ind@setup| command has been +% introduced. Classical style index files begin by a |\begin| +% command, so that command is temporarily redefined to print a warning +% message and |\endinput| the file. Should the first command instead +% be |\docindexguard| then everything will be reset to normal. To +% accomplish this, |\DI@ind@setup| opens a group which should be +% closed by the initial |\docindexguard| or |\begin|. +% \begin{macrocode} +\def\DI@ind@setup{\bgroup + \def\docindexguard##1{\egroup}% + \def\begin##1{% + \egroup + \PackageWarningNoLine +%<template> {docindex}% +%<!template> {docidx2e}% + {Ignoring old style index file} + \endinput + }% +} +%</pkg> +% \end{macrocode} +% \end{macro}\end{macro} +% +% \xrefoff +% \begin{macrocode} +%<*idx|glo|ist> +preamble "\\docindexguard{\\endinput}\n%^^A\n\\indexnewletter{1}{" +postamble "}{0}\n\\endinput" +%</idx|glo|ist> +% \end{macrocode} +% \SpecialIndex{\docindexguard} +% \SpecialIndex{\indexnewletter} +% \xrefon +% +% In summary, this is the BNF syntax for a sorted index file that is to +% be typeset using \package{docindex}: +% \begin{syntax} +% \item[sorted index file] +% \meta{guard}\meta{lettergroups}|\endinput| +% \item[guard] |\docindexguard{\endinput}| +% \item[lettergroups] \meta{lettergroup}\branch +% \meta{lettergroup}\meta{lettergroups} +% \item[lettergroup] \meta{heading}\meta{items} +% \item[heading] +% |\indexnewletter|\marg{first}\marg{letter}\marg{next} +% \item[items] \meta{empty}\branch \meta{item}\meta{items} +% \item[item] |\indexitem|\marg{level}\marg{text}\marg{next}\branch +% |\indexitem|\marg{level}\marg{text}|{9}|\marg{numbers}\marg{next} +% \end{syntax} +% A \meta{level} is |1|, |2|, or |3|. A \meta{next} is |0|, |1|, |2|, or +% |3|. Within a \meta{lettergroup}, the \meta{next} of one \meta{item} +% or the \meta{heading} must equal the \meta{level} of the next +% \meta{item} and the \meta{next} of the last item must be |0|. The +% \meta{first} should be |1| in the first \meta{lettergroup} and |0| in +% all the others. +% +% +% \subsection{Template mechanisms} +% +% The \package{docindex} package loads the \package{xhj} and +% \package{galley2} packages to gain access to the \texttt{justification} +% type templates. This indirectly loads the \package{xparse} and +% \package{template} packages. +% \begin{macrocode} +%<*pkg> +%<template>\RequirePackage{xhj,galley2} +% \end{macrocode} +% +% Since the \package{docidx2e} package doesn't use the template mechanisms +% provided by the \package{template} package, but still is to follow the +% logic of the \package{docindex} package which does use these +% mechanisms, it becomes convenient to define fakes for a couple of +% \package{template} commands. First \package{docidx2e} checks if the +% real \package{template} package has been loaded and emits a warning if +% it has. +% \begin{macrocode} +%<*!template> +\@ifpackageloaded{template}{ + \PackageWarningNoLine{docidx2e}{The docidx2e package is only meant% + \MessageBreak for use when LaTeX2e* packages like + template\MessageBreak are not available.} +}{} +% \end{macrocode} +% +% Before continuing with the definitions, some of the data structures +% used by the \package{template} mechanisms must be explained. A +% template \emph{instance} is really only a macro; what makes instances +% different from macros in general is that they usually aren't +% explicitly programmed. Instead they are formed by combining two +% different pieces of code: one which is the code part of some template, +% and one which is a piece of code which sets the \emph{container} +% macros\slash registers\slash parameters for the key values of this +% template. In general, the first piece of code contains the +% programming-like aspects of what the instance does, whereas the latter +% contains those that have to do with lauout and design. The advantage +% of this model is that it lets you implement many layouts without +% requiring you to know everything about \LaTeX\ programming that it +% would take to implement everything using macros. +% +% Instances are stored in control sequences of the form +% \begin{quote} +% \describecsfamily{TP@I{\meta{collection}}\break +% {\meta{type}}\break{\meta{name}}} +% |\TP@I|\marg{collection}\marg{type}\marg{name} +% \end{quote} +% The \meta{type} is the primary distinction between instances; for each +% type there exists a specification of what all instances of that type +% must do, and all instances of a type must be interchangeable. In +% particular, all instances of a given template type must have the same +% argument structure. The \meta{name} is simply the name used to +% identify the instance (amongst all other instances of that type). +% Finally, the \meta{collection} is something which can be used in +% circumstances where one needs to quickly switch between different +% definitions of an instance. If they have different \meta{collection}s +% then they can exist simutaneously; which of them is used is determined +% by which collection is currently active. +% +% Collections are active on a ``per type'' basis; which collection is +% active for instances of type \meta{type} is determined by the +% contents of the \describecsfamily{TP@T{\meta{type}}} +% |\TP@T|\marg{type} control sequences, which are macros with the +% structure +% \begin{quote} +% \marg{collection}\marg{arguments} +% \end{quote} +% If there is no instance with the requested name in the currently +% active collection then the instance with the same name from the +% normal collection (whose name is the empty string) will be used. The +% \meta{arguments} part of the macro is simply the number of arguments +% of instances of this type; it is only used when declaring templates. +% +% \begin{macro}{\UseCollection} +% The |\UseCollection| command sets the active collection for a given +% type. It has the syntax +% \begin{quote} +% |\UseCollection|\marg{type}\marg{collection} +% \end{quote} +% This macro was used up to v\,1.00 of \package{docindex} but a change +% in the package logic made it unnecessary. +% \begin{macrocode} +% \providecommand*\UseCollection[2]{% +% \expandafter\edef \csname TP@T{#1}\endcsname{% +% {#2}% +% {\expandafter\expandafter \expandafter\@secondoftwo +% \csname TP@T{#1}\endcsname}% +% }% +% } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@letinstance} +% The |\@letinstance| macro |\let|s the (currently used) instance +% with given name and type to the \meta{target} control sequence. It +% has the syntax +% \begin{quote} +% |\@letinstance|\marg{target}\marg{type}\marg{name} +% \end{quote} +% \begin{macrocode} +\def\@letinstance#1#2#3{% + \expandafter\let \expandafter#1% + \csname TP@I% + {\expandafter\expandafter \expandafter\@firstoftwo + \csname TP@T{#2}\endcsname}% + {#2}{#3}% + \endcsname + \ifx \relax#1% + \expandafter\let \expandafter#1\csname TP@I{}{#2}{#3}\endcsname + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\UseInstance} +% The |\UseInstance| calls the (currently used) instance with given +% name and type. Its syntax is +% \begin{quote} +% |\UseInstance|\marg{type}\marg{name}\,\meta{arguments of instance} +% \end{quote} +% \begin{macrocode} +\providecommand*\UseInstance[2]{% + \@letinstance\@tempa{#1}{#2}% + \ifx \relax\@tempa + \PackageError{docidx2e}{Instance #2 of type #1 undefined}\@eha + \else + \expandafter\@tempa + \fi +} +%</!template> +% \end{macrocode} +% \end{macro} +% +% +% +% \subsection{Templates for index item formatting} +% +% \begin{templatetype}{justification} +% In \package{docidx2e}, we have to provide a dummy definition of +% |\TP@T{justification}|. +% \begin{macrocode} +%<!template>\@namedef{TP@T{justification}}{{}{0}} +% \end{macrocode} +% \end{templatetype} +% +% \changes{v\,1.00}{2001/04/08}{Using \texttt{single} template rather +% than the \texttt{std} template for the \texttt{indexitem}$n$ +% instances of type \texttt{justification}. (LH)} +% \begin{instance}{justification}{indexitem1} +% \begin{instance}{justification}{indexitem2} +% \begin{instance}{justification}{indexitem3} +% The \texttt{indexitem}\meta{level} instances of the +% \texttt{justification} template set up paragraph indentation etc.\ +% for a paragraph containing an index item at that level. The layout +% is the same as that used by the \package{doc} package, but it is +% not specified in quite the same way. +% \begin{macrocode} +%<*template> +\DeclareInstance{justification}{indexitem1}{single}{ + leftskip=30pt, rightskip=15pt, startskip=-30pt, parfillskip=-15pt, + linefillskip=0pt plus 1fil, parindent=0pt +} +\DeclareInstance{justification}{indexitem2}{single}{ + leftskip=30pt, rightskip=15pt, startskip=-15pt, parfillskip=-15pt, + linefillskip=0pt plus 1fil, parindent=0pt +} +\DeclareInstance{justification}{indexitem3}{single}{ + leftskip=30pt, rightskip=15pt, startskip=-5pt, parfillskip=-15pt, + linefillskip=0pt plus 1fil, parindent=0pt +} +%</template> +%<*!template> +\@namedef{TP@I{}{justification}{indexitem1}}{% + \leftskip=30\p@ + \rightskip=15\p@ + \parindent=-30\p@ + \parfillskip=-\rightskip +} +\@namedef{TP@I{}{justification}{indexitem2}}{% + \leftskip=30\p@ + \rightskip=15\p@ + \parindent=-15\p@ + \parfillskip=-\rightskip +} +\@namedef{TP@I{}{justification}{indexitem3}}{% + \leftskip=30\p@ + \rightskip=15\p@ + \parindent=-5\p@ + \parfillskip=-\rightskip +} +%</!template> +% \end{macrocode} +% \end{instance}\end{instance}\end{instance} +% +% +% +% \subsubsection{The \texttt{indexitem} template type} +% +% \begin{templatetype}{indexitem} +% \begin{macro}{\DI@item@nojoin} +% \begin{macro}{\DI@item@join} +% The argument structure of a template of type \texttt{indexitem} is +% \begin{quote} +% \marg{previous}\marg{next}\marg{text}\marg{figures} +% \end{quote} +% \meta{previous} and \meta{next} are the level codes of the index +% item before and after the current item, \meta{text} is the item text +% of the current index item, and \meta{figures} are the (page) numbers +% for this item, if it has any, or the token |\NoValue|, if it hasn't. +% +% Templates of this type format and typeset one item in an index. In +% doing so they may do pretty much anything as long as the other items +% aren't affected: they may start and end paragraphs, change the +% paragraph justification, \textellipsis +% +% There is however one area in which the rules are rather strict, and +% that has to do with when two items can be joined. In a case where +% item A is followed by item B, item A can propose to item B that they +% should be joined and item B can then accept or decline this offer. +% Technically the offer consists of defining the two macros +% |\DI@item@join| and |\DI@item@nojoin|. If item B accepts the offer +% it will execute |\DI@item@join| and if it declines the offer it +% will execute |\DI@item@nojoin|. A typical definition of +% |\DI@item@join| might be to insert a punctuation mark and a typical +% definition of |\DI@item@nojoin| might be to end the current paragraph. +% +% There is however also a third case, namely that no offer was given. +% In this case |\DI@item@nojoin| should be |\let| to |\@empty| and +% |\DI@item@join| should be |\let| to |\@firstofone|. The reason for +% this last rule is that |\DI@item@join| has the syntax +% \begin{quote} +% |\DI@item@join|\marg{no-join recovery code} +% \end{quote} +% where the \meta{no-join recovery code} is code that item B needs to +% have executed if there is no join although item B would have +% accepted it. |\DI@item@nojoin|, on the other hand, takes no +% argument. +% \begin{macrocode} +%<template>\DeclareTemplateType{indexitem}{4} +%<!template>\@namedef{TP@T{indexitem}}{{}{4}} +\let\DI@item@join=\@firstofone +\let\DI@item@nojoin=\@empty +% \end{macrocode} +% \end{macro}\end{macro}\end{templatetype} +% +% \begin{template}{indexitem}{fixed} +% The \texttt{fixed} template of type \texttt{indexitem} formats an +% item as the items in \package{doc}'s \texttt{theindex} environment. +% It is fixed in that it ignores the levels of the surrounding items. +% +% The keys for this template are: +% \begin{description} +% \keyvalitem{justification-setup}{i} +% This is a template instance of type \texttt{justification}. It +% sets the justification for the paragraph containing the item, +% unless the item is being joined with the preceeding item. +% \keyvalitem{pre-join}{b} +% A switch for whether the item should accept to be joined with +% the item before. True means ``accept'', false means ``decline'' +% (which is the default). +% \keyvalitem{nofig-action}{f1} +% If the \meta{figures} argument is |\NoValue| then the \meta{text} +% argument is passed on to this macro for the actual formatting. +% The default expansion is precisely the \meta{text}. +% \keyvalitem{fig-action}{f2} +% If the \meta{figures} argument is not |\NoValue| then the +% \meta{text} and \meta{figures} arguments are passed on (in that +% order) to this macro for the actual formatting. The default +% expansion is +% \begin{quote} +% \meta{text}|\pfill|\meta{figures} +% \end{quote} +% \keyvalitem{post-join}{b} +% A switch for whether the item should offer to join with the +% following item. True means ``make offer'', false (which is the +% default) means ``don't make offer''. Making the offer is +% furthermore conditioned by that the \meta{figures} argument is +% |\NoValue|. +% \keyvalitem{nojoin-extra}{f0} +% Extra code which is inserted after the normal code for an item +% if the item neither has any figures nor offers to join with the +% following item. The default value is a space of length +% \textit{linefillskip} followed by a |\nopagebreak|.^^A +% \changes{v\,0.03}{2001/02/24}{Added the \textit{nojoin-extra} +% key. (LH)}^^A +% \changes{v\,0.03}{2001/02/25}{Added \cs{nopagebreak} from +% \cs{efill} to default for \textit{nojoin-extra} key. (LH)} +% \keyvalitem{join-extra}{f0} +% Extra text which is inserted after the normal text of the item +% if there is a join, by default a comma and a space. +% \keyvalitem{offjoin-extra}{f0} +% Extra code which is inserted after the normal text of the item +% if a join is offered but declined. The default value is a space +% of length \textit{linefillskip} followed by a |\nopagebreak| +% (larger than the one from \textit{nojoin-extra}; if not for +% this, the default could have been taken to be +% |\DI@nojoin@extra|). +% \end{description} +% +% Note that the contents of the \textit{nojoin-extra}, +% \textit{join-extra}, and \textit{offjoin-extra} keys must be robust +% as they may be subjected to a |\protected@edef|. +% \changes{v\,0.03}{2001/02/24}{\cs{protected@edef}ing the macros +% \cs{DI@item@join} and \cs{DI@item@nojoin}. (LH)} +% +% \begin{macrocode} +%<*template> +\DeclareTemplate{indexitem}{fixed}{4}{ + justification-setup =i{justification} \DI@item@justification, + pre-join =b +%<default> {false} + DI@prejoin@, + nofig-action =f1 +%<default> {#1} + \DI@nofig, + fig-action =f2 +%<default> {#1\pfill#2} + \DI@hasfig, + post-join =b +%<default> {false} + DI@postjoin@, + nojoin-extra =f0 +%<default> {\hspace*{\justification@g} +%<default> \protect\nopagebreak[2]} + \DI@nojoin@extra, + join-extra =f0 +%<default> {,\space} + \DI@join@extra, + offjoin-extra =f0 +%<default> {\hspace*{\justification@g} +%<default> \protect\nopagebreak[4]} + \DI@offjoin@extra +}{% +%<*!default> + \let\ifDI@prejoin@\iffalse + \let\DI@nofig\@firstofone + \def\DI@hasfig##1##2{##1\pfill##2}% + \let\ifDI@postjoin@\iffalse + \def\DI@nojoin@extra{% + \hspace*{\justification@g}\protect\nopagebreak[2]% + }% + \def\DI@join@extra{,\space}% + \def\DI@offjoin@extra{% + \hspace*{\justification@g}\protect\nopagebreak[4]% + }% +%</!default> + \DoParameterAssignments + \ifDI@prejoin@ + \DI@item@join{\DI@item@justification}% + \else + \DI@item@nojoin\DI@item@justification + \fi + \let\DI@item@join\@firstofone + \let\DI@item@nojoin\@empty + \IfNoValueTF{#4}{% + \DI@nofig{#3}% + \ifDI@postjoin@ + \protected@edef\DI@item@join##1{\DI@join@extra}% + \protected@edef\DI@item@nojoin{\DI@offjoin@extra\protect\par}% + \else + \DI@nojoin@extra\par + \fi + }{% + \DI@hasfig{#3}{#4}% + \par + }% + \ignorespaces +} +% \end{macrocode} +% \end{template} +% +% \begin{instance}{indexitem}{fixed1} +% \begin{instance}{indexitem}{fixed2} +% \begin{instance}{indexitem}{fixed3} +% The \texttt{fixed1}, \texttt{fixed2}, and \texttt{fixed3} instances +% of type \texttt{indexitem} are simply the \texttt{fixed} template +% with different values assigned to the \textit{justification-setup} +% key. +% \begin{macrocode} +\DeclareInstance{indexitem}{fixed1}{fixed} + {justification-setup = indexitem1} +\DeclareInstance{indexitem}{fixed2}{fixed} + {justification-setup = indexitem2} +\DeclareInstance{indexitem}{fixed3}{fixed} + {justification-setup = indexitem3} +%</template> +%<*!template> +\@namedef{TP@I{}{indexitem}{fixed1}}#1#2#3#4{% + \@letinstance\DI@item@justification{justification}{indexitem1}% + \DI@item@nojoin + \DI@item@justification + \ifx \NoValue#4% + #3\nobreak\hfil\nopagebreak[2]% + \else + #3\pfill#4% + \fi + \let\DI@item@join\@firstofone + \let\DI@item@nojoin\@empty + \par +} +\@namedef{TP@I{}{indexitem}{fixed2}}#1#2#3#4{% + \@letinstance\DI@item@justification{justification}{indexitem2}% + \DI@item@nojoin + \DI@item@justification + \ifx \NoValue#4% + #3\nobreak\hfil\nopagebreak[2]% + \else + #3\pfill#4% + \fi + \let\DI@item@join\@firstofone + \let\DI@item@nojoin\@empty + \par +} +\@namedef{TP@I{}{indexitem}{fixed3}}#1#2#3#4{% + \@letinstance\DI@item@justification{justification}{indexitem3}% + \DI@item@nojoin + \DI@item@justification + \ifx \NoValue#4% + #3\nobreak\hfil\nopagebreak[2]% + \else + #3\pfill#4% + \fi + \let\DI@item@join\@firstofone + \let\DI@item@nojoin\@empty + \par +} +%</!template> +% \end{macrocode} +% \end{instance}\end{instance}\end{instance} +% +% \begin{instance}{indexitem}{fixed-r1a} +% \begin{instance}{indexitem}{fixed-r2a-nocomma} +% \begin{instance}{indexitem}{fixed-a3r} +% The \texttt{fixed-r1a}, \texttt{fixed-r2a-nocomma}, and +% \texttt{fixed-a3r} instances of type \texttt{indexitem} are again +% based on the \texttt{fixed} template, but here they always accept +% (or offer) to join with one neighbouring item, whereas they always +% reject to join with the other. As before, they differ in their +% values of the \textit{justification-setup} key, and the +% \texttt{-nocomma} is because that instance only inserts a space, +% not a comma and a space, when items are joined. +% \begin{macrocode} +%<*template> +\DeclareInstance{indexitem}{fixed-r1a}{fixed} + {justification-setup = indexitem1, post-join = true} +\DeclareInstance{indexitem}{fixed-r2a-nocomma}{fixed} + {justification-setup = indexitem2, + post-join = true, join-extra = {\space}} +\DeclareInstance{indexitem}{fixed-a3r}{fixed} + {justification-setup = indexitem3, pre-join = true} +%</template> +%<*!template> +\@namedef{TP@I{}{indexitem}{fixed-r1a}}#1#2#3#4{% + \@letinstance\DI@item@justification{justification}{indexitem1}% + \DI@item@nojoin + \DI@item@justification + \ifx \NoValue#4% + #3% + \def\DI@item@join##1{, }% + \def\DI@item@nojoin{\nobreak\hfil\nopagebreak[4]\par}% + \else + #3\pfill#4\par + \let\DI@item@join\@firstofone + \let\DI@item@nojoin\@empty + \fi + \ignorespaces +} +\@namedef{TP@I{}{indexitem}{fixed-r2a-nocomma}}#1#2#3#4{% + \@letinstance\DI@item@justification{justification}{indexitem2}% + \DI@item@nojoin + \DI@item@justification + \ifx \NoValue#4% + #3% + \def\DI@item@join##1{ }% + \def\DI@item@nojoin{\nobreak\hfil\nopagebreak[4]\par}% + \else + #3\pfill#4\par + \let\DI@item@join\@firstofone + \let\DI@item@nojoin\@empty + \fi + \ignorespaces +} +\@namedef{TP@I{}{indexitem}{fixed-a3r}}#1#2#3#4{% + \@letinstance\DI@item@justification{justification}{indexitem3}% + \DI@item@join{\DI@item@justification}% + \ifx \NoValue#4% + #3\hfil\nopagebreak[2]% + \else + #3\pfill#4% + \fi + \let\DI@item@join\@firstofone + \let\DI@item@nojoin\@empty + \par +} +%</!template> +% \end{macrocode} +% \end{instance}\end{instance}\end{instance} +% +% +% \begin{template}{indexitem}{aloneaccept} +% The \texttt{aloneaccept} template of type \texttt{indexitem} formats +% an item as the items in \package{doc}'s \texttt{theindex} environment. +% It accepts to be joined with the preceeding item if and only if +% both that and the following item are at a lower level than the item +% itself is. +% +% The keys for this template are: +% \begin{description} +% \keyvalitem{justification-setup}{i} +% This is a template instance of type \texttt{justification}. It +% sets the justification for the paragraph containing the item, +% unless the item is being joined with the preceeding item. +% \keyvalitem{ownlevel}{C} +% This is the (nominal) level of this item; it will accept a join +% with the preceeding item if and only if the levels of both that +% and the following item are different from this number. +% \changes{v\,1.00}{2001/03/25}{Changed condition for accepting a +% join from ``neighbouring item levels are lower'' to +% ``neighbouring item levels are not equal to''. (LH)} +% The default is 2. +% \keyvalitem{nofig-action}{f1} +% If the \meta{figures} argument is |\NoValue| then the \meta{text} +% argument is passed on to this macro for the actual formatting. +% The default expansion is the \meta{text} followed by a space of +% linefillskip. +% \keyvalitem{fig-action}{f2} +% If the \meta{figures} argument is not |\NoValue| then the +% \meta{text} and \meta{figures} arguments are passed on (in that +% order) to this macro for the actual formatting. The default +% expansion is +% \begin{quote} +% \meta{text}|\pfill|\meta{figures} +% \end{quote} +% \keyvalitem{post-join}{b} +% A switch for whether the item should offer to join with the +% following item. True means ``make offer'', false (which is the +% default) means ``don't make offer''. Making the offer is +% furthermore conditioned by that the \meta{figures} argument is +% |\NoValue|. +% \keyvalitem{nojoin-extra}{f0} +% Extra code which is inserted after the normal code for an item +% if the item neither has any figures nor offers to join with the +% following item. The default value is a space of length +% \textit{linefillskip}. +% \changes{v\,0.03}{2001/02/24}{Added the \textit{nojoin-extra} +% key. (LH)} +% \keyvalitem{join-extra}{f0} +% Extra text which is inserted after the normal text of the item +% if there is a join, by default a comma and a space. +% \keyvalitem{offjoin-extra}{f0} +% Extra code which is inserted after the normal text of the item +% if a join is offered but declined, by default the +% \textit{nojoin-extra} code followed by a |\nopagebreak|. +% \end{description} +% +% Note that the contents of the \textit{nojoin-extra}, +% \textit{join-extra}, and \textit{offjoin-extra} keys must be robust +% as they may be subjected to a |\protected@edef|. +% \changes{v\,0.03}{2001/02/24}{\cs{protected@edef}ing the macros +% \cs{DI@item@join} and \cs{DI@item@nojoin}. (LH)} +% +% \begin{macrocode} +%<*template> +\DeclareTemplate{indexitem}{aloneaccept}{4}{ + justification-setup =i{justification} \DI@item@justification, + ownlevel =C +%<default> {2} + \DI@this@level, + nofig-action =f1 +%<default> {#1} + \DI@nofig, + fig-action =f2 +%<default> {#1\pfill#2} + \DI@hasfig, + post-join =b +%<default> {false} + DI@postjoin@, + nojoin-extra =f0 +%<default> {\hspace*{\justification@g}} + \DI@nojoin@extra, + join-extra =f0 +%<default> {,\space} + \DI@join@extra, + offjoin-extra =f0 +%<default> {\DI@nojoin@extra\protect\nopagebreak[4]} + \DI@offjoin@extra +}{% +%<*!default> + \def\DI@this@level{2}% + \let\DI@nofig\@firstofone + \def\DI@hasfig##1##2{##1\pfill##2}% + \let\ifDI@postjoin@\iffalse + \def\DI@nojoin@extra{\hspace*{\justification@g}}% + \def\DI@join@extra{,\space}% + \def\DI@offjoin@extra{\DI@nojoin@extra\protect\nopagebreak[4]}% +%</!default> + \DoParameterAssignments + \ifnum \DI@this@level=#1 + \DI@item@nojoin \DI@item@justification + \else\ifnum \DI@this@level=#2 + \DI@item@nojoin \DI@item@justification + \else + \DI@item@join{\DI@item@justification}% + \fi\fi + \let\DI@item@join\@firstofone + \let\DI@item@nojoin\@empty + \IfNoValueTF{#4}{% + \DI@nofig{#3}% + \ifDI@postjoin@ + \protected@edef\DI@item@join##1{\DI@join@extra}% + \protected@edef\DI@item@nojoin{\DI@offjoin@extra\protect\par}% + \else + \DI@nojoin@extra \par + \fi + }{% + \DI@hasfig{#3}{#4}% + \par + }% + \ignorespaces +} +%</template> +% \end{macrocode} +% \end{template} +% +% \begin{instance}{indexitem}{aloneaccept2} +% \begin{instance}{indexitem}{aloneaceept3} +% The \texttt{aloneaccept2} and \texttt{aloneaccept3} instances of type +% \texttt{indexitem} are simply the \texttt{aloneaccept} template +% with the levels fixed to two and three, respectively. +% \begin{macrocode} +%<*template> +\DeclareInstance{indexitem}{aloneaccept2}{aloneaccept} + {justification-setup = indexitem2, ownlevel = 2} +\DeclareInstance{indexitem}{aloneaccept3}{aloneaccept} + {justification-setup = indexitem3, ownlevel = 3} +%</template> +%<*!template> +\@namedef{TP@I{}{indexitem}{aloneaccept2}}#1#2#3#4{% + \@letinstance\DI@item@justification{justification}{indexitem2}% + \ifnum #1=\tw@ + \DI@item@nojoin \DI@item@justification + \else\ifnum #2=\tw@ + \DI@item@nojoin \DI@item@justification + \else + \DI@item@join{\DI@item@justification}% + \fi\fi + \ifx \NoValue#4% + #3\nobreak\hfil\vadjust{}% + \else + #3\pfill #4% + \fi + \let\DI@item@join\@firstofone + \let\DI@item@nojoin\@empty + \par +} +\@namedef{TP@I{}{indexitem}{aloneaccept3}}#1#2#3#4{% + \@letinstance\DI@item@justification{justification}{indexitem3}% + \ifnum #1=\thr@@ + \DI@item@nojoin \DI@item@justification + \else\ifnum #2=\thr@@ + \DI@item@nojoin \DI@item@justification + \else + \DI@item@join{\DI@item@justification}% + \fi\fi + \ifx \NoValue#4% + #3\nobreak\hfil\vadjust{}% + \else + #3\pfill #4% + \fi + \let\DI@item@join\@firstofone + \let\DI@item@nojoin\@empty + \par +} +%</!template> +% \end{macrocode} +% \end{instance}\end{instance} +% +% +% \subsubsection{The \texttt{docindex} template type} +% +% \begin{templatetype}{docindex} +% A template of type \texttt{docindex} takes care of typesetting an +% index found in a file (which is |\input|ted as part of this +% process), hence using an instance of type \texttt{docindex} is +% the same kind of action that the |\printindex| and |\printglossary| +% commands make. +% +% The template decides from which file the index should be read. It +% takes two arguments: the index prologue and the index epilogue. +% These are two pieces of text (which may just as well include a +% sectioning command) that are printed just before and after the +% index. Either argument may be empty. Immediately after the file +% containing the body of the index has been inputted, the template +% must execute |\DI@item@nojoin| to make sure that the last item is +% properly typeset. +% +% Templates of type \texttt{docindex} must begin by opening a group +% and end by closing it. They must furthermore locally define the +% following macros before any part of the index is typeset. +% \begin{description} +% \item[\cs{DI@indexitem@i}, \cs{DI@indexitem@ii}, and +% \cs{DI@indexitem@iii}] +% Handlers for index items at level 1, 2, and 3 respectively. +% These handlers must conform to the specification for +% \texttt{indexitem} instances. +% \item[\cs{DI@letter@skip}, \cs{DI@letter@format}] +% These are described in the comments to the |\indexnewletter| +% command. +% \item[\cs{+}] +% The command for typesetting the separator between two parts of +% a composite (page) number. This is a parameterless macro. +% \end{description} +% +% \begin{macrocode} +%<template>\DeclareTemplateType{docindex}{2} +%<!template>\@namedef{TP@T{docindex}}{{}{2}} +% \end{macrocode} +% \end{templatetype} +% +% \begin{template}{docindex}{std} +% The \texttt{std} template of type \texttt{docindex} typesets an +% index while providing all the formatting parameters of the +% \package{doc} index and list of changes (and a few more). +% \changes{v\,1.00}{2001/04/08}{The \mbox{\textit{-font}} keyvals +% renamed to \mbox{\textit{-setup}}, but the type stayed the +% same (f0). (LH)} +% +% \label{docindex:std} +% The keys of the template are: +% \begin{description} +% \keyvalitem{file-name}{n} +% The base name of the file in which the index is stored, by +% default the |\jobname|.\changes{v\,1.00}{2001/03/25}{Added +% \textit{file-name} and \textit{file-extension} keys, removed +% the \textit{default-prologue} and \textit{default-epilogue} +% keys. (LH)} +% \keyvalitem{file-extension}{n} +% The extension of the file in which the index is stored, by +% default \texttt{ind}. +% \keyvalitem{item1}{i} +% \texttt{indexitem} instance for level 1 items, by default +% \texttt{fixed1}. +% \keyvalitem{item2}{i} +% \texttt{indexitem} instance for level 2 items, by default +% \texttt{fixed2}. +% \keyvalitem{item3}{i} +% \texttt{indexitem} instance for level 3 items, by default +% \texttt{fixed3}. +% \keyvalitem{columns}{C} +% The number of columns in the index, by default 3. +% \keyvalitem{reserved-height}{L} +% The minimal amount of vertical space that must be left on the +% current page if the index is to start on it, by default +% 80\,pt.^^A +% \changes{v\,1.00}{2001/03/25}{Made \textit{reserved-height} work +% even when \textit{columns} is 1 by using the +% \package{multicol} macro \cs{enough@room}. (LH)} +% \keyvalitem{column-sep}{l} +% The horizontal separation between columns in the index, by +% default 10\,pt. (This may seem strange in comparison with +% \package{doc}, since |\IndexParms| contains the command +% |\columnsep=15pt|, but \package{doc} doesn't execute +% |\IndexParms| until \LaTeX\ is already in multi-column mode, and +% then it is too late for the changed value to have any effect.) +% \keyvalitem{prologue-setup}{f0} +% Various commands setting layout parameters (e.g.\ the font) for +% the prologue; by default empty. +% \keyvalitem{body-setup}{f0} +% Various commands setting layout parameters (e.g.\ the font) for +% the body of the index; by default |\small|. +% \keyvalitem{epilogue-setup}{f0} +% Various commands setting layout parameters (e.g.\ the font) for +% the epilogue; by default |\normalsize| (to counter the |\small| +% in the \textit{body-setup}). +% \keyvalitem{letter-skip}{L} +% The skip inserted before a new letter group, by default 10\,pt +% plus 2\,pt minus 3\,pt. +% \keyvalitem{letter-format}{f1} +% The macro which formats new letter groups; the argument is the +% heading for the group, as generated by \program{makeindex}. By +% defaults it typesets the argument in boldface, centered on a +% line. +% \keyvalitem{pagestyle}{n} +% If this is nonempty then the pagestyle by that name will be +% selected for the index. By default it is empty. +% \keyvalitem{parskip}{l} +% The value of |\parskip| to use inside the index, by default +% 0\,pt plus 1\,pt. This key value is likely to change as the +% \LaTeXplus\ interfaces for galleys evolve. +% \changes{v\,0.03}{2001/02/27}{Added \textit{parskip} keyval. (LH)} +% \keyvalitem{page-compositor}{f0} +% The text that is typeset to separate two parts of a composite +% (page) number, by default a hyphen. +% \changes{v\,1.00}{2001/04/05}{Added \textit{page-compositor} +% keyval. (LH)} +% \end{description} +% +% \begin{macrocode} +%<*template> +\DeclareTemplate{docindex}{std}{2}{ + file-name =n +%<default> {\jobname} + \DI@file@name, + file-extension =n +%<default> {ind} + \DI@file@ext, + item1 =i{indexitem} +%<default> {fixed1} + \DI@indexitem@i, + item2 =i{indexitem} +%<default> {fixed2} + \DI@indexitem@ii, + item3 =i{indexitem} +%<default> {fixed3} + \DI@indexitem@iii, + reserved-height =L +%<default> {80pt} + \DI@reserved@height, + columns =C +%<default> {3} + \DI@columns, + column-sep =l +%<default> {10pt} + \columnsep, + prologue-setup =f0 +%<default> {} + \DI@prologue@setup, + body-setup =f0 +%<default> {\small} + \DI@body@setup, + epilogue-setup =f0 +%<default> {\normalsize} + \DI@epilogue@setup, + letter-skip =L +%<default> {10pt plus 2pt minus 3pt} + \DI@letter@skip, + letter-format =f1 +%<default> {\UseInstance{justification}{center}% +%<default> \textbf{#1}\nopagebreak\csname par\endcsname} + \DI@letter@format, + pagestyle =n +%<default> {} + \DI@pagestyle, + parskip =l +%<default> {0pt plus 1pt} + \parskip, + page-compositor =f0 +%<default> {-} + \+ +}{% + \begingroup +%<*!default> + \def\DI@file@name{\jobname}% + \def\DI@file@ext{ind}% + \@letinstance\DI@indexitem@i{indexitem}{fixed1}% + \@letinstance\DI@indexitem@ii{indexitem}{fixed2}% + \@letinstance\DI@indexitem@iii{indexitem}{fixed3}% + \def\DI@reserved@height{80pt}% + \def\DI@columns{3}% + \columnsep=10pt% + \let\DI@prologue@setup\@empty + \def\DI@body@setup{\small}% + \def\DI@epilogue@setup{\normalsize}% + \def\DI@letter@skip{10pt plus 2pt minus 3pt}% + \def\DI@letter@format##1{% + \UseInstance{justification}{center}% + \textbf{##1}\nopagebreak\par + }% + \parskip=\z@\@plus\p@ + \let\DI@pagestyle\@empty + \def\+{-}% +%</!default> + \DoParameterAssignments + \IfFileExists{\DI@file@name.\DI@file@ext}{% + \ifnum \DI@columns>\@ne + \begin{multicols}{\DI@columns}% + [\DI@prologue@setup #1][\DI@reserved@height]% + \else + \enough@room{\DI@reserved@height}% + \DI@prologue@setup #1\par + \addvspace\multicolsep + \fi + \ifx \DI@pagestyle\@empty \else \pagestyle{\DI@pagestyle}\fi + \DI@body@setup + \DI@ind@setup + \input{\DI@file@name.\DI@file@ext}% + \DI@item@nojoin + \ifx \DI@pagestyle\@empty \else + \expandafter\thispagestyle \expandafter{\DI@pagestyle}% + \fi + \ifnum \DI@columns>\@ne + \end{multicols}% + \else + \enough@room\postmulticols + \addvspace\multicolsep + \fi + \DI@epilogue@setup #2\par + }{\typeout{No file \DI@file@name.\DI@file@ext.}}% + \endgroup +} +% \end{macrocode} +% \end{template} +% +% +% \begin{instance}{docindex}{index} +% \begin{option}{usedocindexps} +% The \texttt{index} instance of the \texttt{docindex} template type +% prints the normal index (as opposed to the list of changes). There +% are two different definitions of the instance: one which sets the +% pagestyle in the index, and one which does not; which one is used +% depends on whether the \texttt{usedocindexps} option has been +% passed to the package or not. +% \begin{macrocode} +\@ifpackagewith{docindex}{usedocindexps}{% + \DeclareInstance{docindex}{index}{std}{pagestyle=docindex}% +}{% + \DeclareInstance{docindex}{index}{std}{}% +} +%</template> +% \end{macrocode} +% +% The implementations of the \texttt{index} instance in +% \package{docidx2e} are slightly off in that they use \package{doc} +% parameters for various settings in the extent such parameters exist. +% \changes{v\,0.03}{2001/02/24}{Added \cs{@nobreakfalse} in +% \package{docidx2e} implementation; the first item in the index +% does not directly follow a \cs{section}-type heading. (LH)} +% \label{p:index-instance} +% \begin{macrocode} +%<*!template> +\@ifpackagewith{docidx2e}{usedocindexps}{% + \@namedef{TP@I{}{docindex}{index}}#1#2{% + \begingroup + \@letinstance\DI@indexitem@i{indexitem}{fixed1}% + \@letinstance\DI@indexitem@ii{indexitem}{fixed2}% + \@letinstance\DI@indexitem@iii{indexitem}{fixed3}% + \columnsep=10pt% + \parskip=0pt plus 1pt% + \def\DI@letter@skip{10pt plus 2pt minus 3pt}% + \def\DI@letter@format##1{% + \par + \hb@xt@\hsize{\hfil\textbf{##1}\hfil}% + \nopagebreak + }% + \def\+{-}% + \IfFileExists{\jobname.ind}{% + \ifnum \c@IndexColumns>\@ne + \begin{multicols}{\c@IndexColumns}[#1][\IndexMin]% + \else + \enough@room{\IndexMin}% + #1\par + \addvspace\multicolsep + \fi + \pagestyle{docindex}% + \small + \@nobreakfalse + \DI@ind@setup + \input{\jobname.ind}% + \DI@item@nojoin + \thispagestyle{docindex} + \ifnum \c@IndexColumns>\@ne + \end{multicols}% + \else + \enough@room\postmulticols + \addvspace\multicolsep + \fi + \normalsize #2\par + }{\typeout{No file \jobname.ind.}}% + \endgroup + } +}{% + \@namedef{TP@I{}{docindex}{index}}#1#2{% + \begingroup + \@letinstance\DI@indexitem@i{indexitem}{fixed1}% + \@letinstance\DI@indexitem@ii{indexitem}{fixed2}% + \@letinstance\DI@indexitem@iii{indexitem}{fixed3}% + \columnsep=10pt% + \parskip=0pt plus 1pt% + \def\DI@letter@skip{10pt plus 2pt minus 3pt}% + \def\DI@letter@format##1{% + \par + \hb@xt@\hsize{\hfil\textbf{##1}\hfil}% + \nopagebreak + }% + \def\+{-}% + \IfFileExists{\jobname.ind}{% + \ifnum \c@IndexColumns>\@ne + \begin{multicols}{\c@IndexColumns}[#1][\IndexMin]% + \else + \enough@room{\IndexMin}% + #1\par + \addvspace\multicolsep + \fi + \small + \@nobreakfalse + \DI@ind@setup + \input{\jobname.ind}% + \DI@item@nojoin + \ifnum \c@IndexColumns>\@ne + \end{multicols}% + \else + \enough@room\postmulticols + \addvspace\multicolsep + \fi + \normalsize #2\par + }{\typeout{No file \jobname.ind.}}% + \endgroup + } +} +%</!template> +% \end{macrocode} +% \end{option}\end{instance} +% +% +% \begin{instance}{docindex}{changes} +% The \texttt{changes} instance of the \texttt{docindex} template +% type typesets a \package{doc} list of changes. +% \changes{v\,0.03}{2001/02/24}{Added \cs{@nobreakfalse} in +% \package{docidx2e} implementation; the first item in the index +% does not directly follow a \cs{section}-type heading. (LH)} +% \changes{v\,1.00}{2001/04/07}{Added \cs{makeatletter} in +% \package{docidx2e} implementation; it doesn't hurt and it is +% sometimes necessary (when commands that expand to private +% control sequences are used in the argument of \cs{changes}). +% (LH)} +% \begin{macrocode} +%<*template> +\DeclareInstance{docindex}{changes}{std}{ + file-extension = gls, + item2 = fixed-r2a-nocomma, + item3 = fixed-a3r, + columns = 2, + letter-format = {}, + letter-skip = \z@skip +} +%</template> +% \end{macrocode} +% \label{p:changes-instance} +% \begin{macrocode} +%<*!template> +\@namedef{TP@I{}{docindex}{changes}}#1#2{% + \begingroup + \@letinstance\DI@indexitem@i{indexitem}{fixed1}% + \@letinstance\DI@indexitem@ii{indexitem}{fixed-r2a-nocomma}% + \@letinstance\DI@indexitem@iii{indexitem}{fixed-a3r}% + \columnsep=10pt% + \parskip=0pt plus 1pt% + \def\DI@letter@skip{\z@skip}% + \let\DI@letter@format\@gobble + \def\+{-}% + \IfFileExists{\jobname.gls}{% + \ifnum \c@GlossaryColumns>\@ne + \begin{multicols}{\c@GlossaryColumns}[#1][\GlossaryMin]% + \else + \enough@room{\GlossaryMin}% + #1\par + \addvspace\multicolsep + \fi + \small + \makeatletter + \@nobreakfalse + \DI@ind@setup + \input{\jobname.gls}% + \DI@item@nojoin + \ifnum \c@GlossaryColumns>\@ne + \end{multicols}% + \else + \enough@room\postmulticols + \addvspace\multicolsep + \fi + \normalsize #2\par + }{\typeout{No file \jobname.gls.}} + \endgroup +} +%</!template> +% \end{macrocode} +% \end{instance} +% +% \begin{macro}{\PrintIndex} +% \begin{macro}{\PrintChanges} +% The |\PrintIndex| and |\PrintChanges| commands are redefined to use +% the respective instances of template type \texttt{docindex}. +% \begin{macrocode} +\renewcommand\PrintIndex{% + \UseInstance{docindex}{index}{\index@prologue}{}% + \global\let\PrintIndex\@empty +} +\renewcommand\PrintChanges{% + \UseInstance{docindex}{changes}{\glossary@prologue}{}% + \global\let\PrintChanges\@empty +} +%</pkg> +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \section{Notes and acknowledgements} +% +% The exact descriptions of the parameters of the \program{makeindex} +% program is the paper \cite{makeindex-paper} by Chen and Harrison, but +% I have seen claims that there are parameters not listed there +% (presumably becuase they were added after this paper was written). +% \texttt{docindex.ist} does not change any such undocumented +% parameter, however. +% +% There are other index sorting programs than \package{makeindex} +% around, such as for example \program{x\r{\i}ndy}~\cite{xindy}. +% Should someone create index style files for such systems that are +% equivalent (or superior, for that matter) to \texttt{docindex.ist} +% then I would be happy to add them to the \package{docindex} +% distribution. +% +% Most of the actual layout parameter settings used by the +% \package{docindex} package are not of my design, but copied from +% various other \LaTeX\ packages such as~\cite{multicol,doc} (mainly by +% Frank Mittelbach). I have however tried to sort out which parameters +% are actually in force under the various conditions---something which +% turned out to be less obvious than I originally suspected. +% +% The idea to have the \texttt{docindex} type templates input the sorted +% index file (rather than simply setting up the formatting of it as was +% the case in v\,0.03) was taken from the \package{xindex} +% package~\cite{xindex} by Achim Blumensath. +% +% \hbadness=10000 +% +% \Finale +% +% +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/source/fontinst/base/xdoc/docindex.ins b/Master/texmf-dist/source/fontinst/base/xdoc/docindex.ins new file mode 100644 index 00000000000..d5d85cc6c32 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/xdoc/docindex.ins @@ -0,0 +1,48 @@ +% This file is the docstrip installation script for the docindex package. +% +% It may be distributed under the conditions of the LaTeX +% Project Public License, either version 1.2 of this license or +% (at your option) any later version. The latest version of this +% license is in +% http://www.latex-project.org/lppl.txt +% and version 1.2 or later is part of all distributions of LaTeX +% version 1999/12/01 or later. +% +% Copyright 2001 Lars Hellstr\"om + +\input docstrip + +\keepsilent + +\preamble + +This file may be distributed and/or modified under the conditions +of the LaTeX Project Public License, either version 1.2 of this +license or (at your option) any later version. The latest version +of this license is in + http://www.latex-project.org/lppl.txt +and version 1.2 or later is part of all distributions of LaTeX +version 1999/12/01 or later. + +This file may only be distributed together with a copy of the source +file from which it was generated. You may distribute that source file +without this generated file. + +\endpreamble + +\declarepostamble\noendinput +\endpostamble + +\generate{% + \usedir{tex/latex/misc} + \file{docindex.sty}{\from{docindex.dtx}{pkg,template}}% + \file{docidx2e.sty}{\from{docindex.dtx}{pkg}}% + \usepostamble\noendinput + \usedir{makeindex/latex} + \file{docindex.ist}{\from{docindex.dtx}{ist}}% +% \file{ngind.ist}{\from{docindex.dtx}{idx}}% +% \file{ngglo.ist}{\from{docindex.dtx}{glo}}% +} + +\endbatchfile +\end diff --git a/Master/texmf-dist/source/fontinst/base/xdoc/docindex.pdf b/Master/texmf-dist/source/fontinst/base/xdoc/docindex.pdf Binary files differnew file mode 100644 index 00000000000..0c3c9379563 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/xdoc/docindex.pdf diff --git a/Master/texmf-dist/source/fontinst/base/xdoc/xdoc2.dtx b/Master/texmf-dist/source/fontinst/base/xdoc/xdoc2.dtx new file mode 100644 index 00000000000..c0d4a22d3d1 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/xdoc/xdoc2.dtx @@ -0,0 +1,5166 @@ +% \CheckSum{2952} +% +% \iffalse meta-comment +% +% This file may be distributed and/or modified under the conditions +% of the LaTeX Project Public License, either version 1.2 of this +% license or (at your option) any later version. The latest version +% of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.2 or later is part of all distributions of LaTeX +% version 1999/12/01 or later. +% +% Copyright 2000 2001 2002 Lars Hellstr\"om +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{array,longtable} + +\makeatletter +\IfFileExists{xdoc2.sty}{% + \usepackage[dolayout]{xdoc2} + \NewMacroEnvironment{xrefcmd}{\XD@grab@harmless\relax}{1}% + {\MacroFont##1 \normalfont XXR-command}% + {\XDMainIndex{% + \levelsorted{##1 (XXR-command)}{\texttt{##1} (XXR-command)}% + }% + \XDMainIndex{% + \levelsame{XXR-commands:}\levelsorted{##1}{\texttt{##1}}% + }}% + {{##1}{XXR-command \texttt{##1}}}% + {}% + \@namedef{XD@harmless\string\Bslash}{% + \toks@=\expandafter{\the\expandafter\expandafter\expandafter\toks@ + \csname XD@harmless@92\endcsname}% + \XD@harmless@ + }% + \IfFileExists{docidx2e.sty}{% + \usepackage{docidx2e}% + \AtEndDocument{% + \typeout{*********************************}% + \typeout{* Use docindex.ist when sorting *}% + \typeout{* xdoc2.idx and xdoc2.glo. \@spaces\space*}% + \typeout{*********************************}% + }% + }% +}{% + \newenvironment{option}[1]{\trivlist\item[]}{\endtrivlist}% + \newenvironment{xrefcmd}[1]{\trivlist\item[]}{\endtrivlist}% + \@ifpackagelater{doc}{2000/05/20}{}{% + \let\XD@fragile@meta=\meta + \def\meta{% + \ifx \protect\@typeset@protect + \expandafter\futurelet \expandafter\@let@token + \expandafter\XD@fragile@meta + \else + \noexpand\meta + \fi + }% + }% +} +\makeatother + +\providecommand\describecsfamily[1]{% + \leavevmode + \GenericDescribePrint{\MacroFont\Bslash#1}% + \ignorespaces +} +\providecommand\describeoption[1]{% + \leavevmode + \GenericDescribePrint{\MacroFont#1 \normalfont option}% + \ignorespaces +} +\providecommand\GenericDescribePrint[1]{% + \marginpar{\raggedleft\strut #1}% +} +\providecommand\Bslash{\bslash} +\providecommand\DoNotIndexBy[1]{} +\DoNotIndexBy{@} +\DoNotIndexBy{@@} +\DoNotIndexBy{XD@} + +\DeclareRobustCommand\package[1]{\textsf{#1}} +\DeclareRobustCommand\LaTeXplus{\LaTeXe$*$} +\newcommand\B{\penalty\exhyphenpenalty} +\ProvideTextCommandDefault\textminus{\textendash} + +\hfuzz=15pt + +\AlsoImplementation +\setcounter{IndexColumns}{2} + +\CodelineIndex +\EnableCrossrefs +\RecordChanges + +\begin{document} + +\DocInput{xdoc2.dtx} + +\PrintChanges +\PrintIndex + +\end{document} +%</driver> +% \fi +% +% \title{The \package{xdoc} package --- experimental reimplementations +% of features from \package{doc}, second~prototype} +% \author{Lars Hellstr\"om^^A +% \thanks{E-mail: \texttt{Lars.Hellstrom@math.umu.se}}} +% \date{2003/07/07} +% \maketitle +% +% \DoNotIndex{\,,\-,\/,\ ,\#,\%,\&,\\,\^,\|} +% \DoNotIndex{\@addtoreset,\@auxout,\@bsphack,\@cclv,\@ctrerr} +% \DoNotIndex{\@eha,\@empty,\@esphack,\@evenfoot} +% \DoNotIndex{\@firstofone,\@firstoftwo,\@for} +% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo} +% \DoNotIndex{\@ifclassloaded,\@ifdefinable,\@ifpackagewith,\@ifundefined} +% \DoNotIndex{\@input,\@latexerr,\@mainaux,\@mparswitchtrue} +% \DoNotIndex{\@namedef,\@nameuse,\@ne,\@next,\@nil,\@oddfoot,\@partaux} +% \DoNotIndex{\@partlist,\@secondoftwo,\@sptoken} +% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@totalleftmargin} +% \DoNotIndex{\@typeset@protect,\@unexpandable@protect} +% \DoNotIndex{\@vobeyspaces,\@writeckpt,\@xxxii} +% \DoNotIndex{\active,\addto@hook,\addtolength,\advance,\AtBeginDocument} +% \DoNotIndex{\baselineskip,\begingroup,\bgroup,\box,\boxmaxdepth} +% \DoNotIndex{\catcode,\char,\clearpage,\closeout,\color@begingroup} +% \DoNotIndex{\color@endgroup,\copy,\csname} +% \DoNotIndex{\deadcycles,\DeclareOption,\DeclareRobustCommand,\def} +% \DoNotIndex{\discretionary,\divide,\do@space,\dp} +% \DoNotIndex{\edef,\egroup,\else,\em,\endcsname,\endgroup,\ensuremath} +% \DoNotIndex{\escapechar,\everypar,\expandafter} +% \DoNotIndex{\fi,\font,\footnotesize,\frenchspacing,\futurelet} +% \DoNotIndex{\g@addto@macro,\gdef,\global} +% \DoNotIndex{\hb@xt@,\hbox,\hfill,\hss,\ht,\hyphenchar} +% \DoNotIndex{\if,\if@filesw,\if@inlabel,\if@mparswitch,\if@partsw} +% \DoNotIndex{\if@reversemargin,\if@tempswa,\ifcase,\ifcat,\iffalse} +% \DoNotIndex{\ifmmode,\ifnum,\ifodd,\iftrue,\ifx,\ignorespaces} +% \DoNotIndex{\immediate,\include,\indexentry,\input,\inputlineno,\item} +% \DoNotIndex{\itshape,\kern} +% \DoNotIndex{\labelsep,\langle,\language,\leavevmode,\let,\long,\loop} +% \DoNotIndex{\m@ne,\m@ta,\makelabel,\marginpar,\marginparsep,\maxdimen} +% \DoNotIndex{\MessageBreak,\multiply} +% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newdimen,\newlanguage} +% \DoNotIndex{\nfss@text,\noexpand,\normalfont,\normalmarginpar,\number} +% \DoNotIndex{\obeyspaces,\openout,\or} +% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning} +% \DoNotIndex{\PackageWarningNoLine,\pagestyle,\paperwidth,\parbox,\part} +% \DoNotIndex{\ProcessOptions,\protect,\protected@edef,\protected@write} +% \DoNotIndex{\protected@xdef,\ProvidesPackage} +% \DoNotIndex{\raggedleft,\raggedright,\rangle,\relax,\renewcommand} +% \DoNotIndex{\repeat,\RequirePackage} +% \DoNotIndex{\setbox,\setlength,\sixt@@n,\space,\string,\strut,\strutbox} +% \DoNotIndex{\textasciicircum,\textasciitilde,\textbackslash,\textbar} +% \DoNotIndex{\textbf,\textbraceleft,\textbraceright,\textdollar} +% \DoNotIndex{\textgreater,\textless,\textquotedbl,\textquoteleft} +% \DoNotIndex{\textquoteright,\texttt,\textunderscore,\textvisiblespace} +% \DoNotIndex{\textwidth,\the,\topsep,\trivlist,\tw@} +% \DoNotIndex{\uccode,\unhbox,\unrestored@protected@xdef,\unvbox} +% \DoNotIndex{\uppercase} +% \DoNotIndex{\vbox,\vss,\vtop,\write,\xdef,\z@} +% +% \changes{prot1}{2000/06/15}{Started writing first prototype. (LH)} +% \changes{prot2}{2000/07/13}{Began work on the second prototype. (LH)} +% +% \begin{abstract} +% The \package{xdoc} package contains reimplementations of some of +% the features found in the standard \LaTeX\ \package{doc} +% package~\cite{doc} by Mittelbach \emph{et~al. }The ultimate goals +% for these reimplementations are that the commands should be better, +% easily configurable, and be easy to extend, but this is only a +% second prototype implementation and nothing in it is guaranteed to +% be the same in the third prototype.\footnote{But there are no +% guarantees there will ever be a third prototype either.} +% \end{abstract} +% +% \tableofcontents +% +% +% \section{Usage} +% +% When I began working on this package I thought that there would be no +% need for a usage section (at least on the prototype stage)---either you +% are interested in using the new features and then you might just as +% well read the descriptions of the commands in the implementation part +% of this document (they are written as specifications of what the +% commands do), or else you can simply insert a |\usepackage|\B|{xdoc2}| +% in the preamble and see how things work a little better than when you +% simply use \package{doc}---but with some features it became natural +% to introduce incompatible changes and some new features ought to be +% mentioned. Hence I wrote a short section on usage after all. +% +% It is my intention that this document will eventually evolve into the +% source for a package \package{xdoc}\footnote{The name \package{doc2} +% has also been discussed; we'll see when we get there.} which will +% either build on the \package{doc} package and provide better +% implementations of many of its features, or replace it completely, +% but this document is still only the source for a prototype for that +% package. As I believe that the need for some improvement in this area +% is rather large however, I have decided to release this prototype so +% that other people can use it in their documents or create packages that +% are based on it. In doing so, one must of course bear in mind that this +% prototype needs not be compatible with the final \package{xdoc} +% package, and to overcome most incompatibility problems I therefore +% release it under the variant name \package{xdoc2}. This way, documents +% based on this prototype can still be typeset using the package they +% were written for long after the next \package{xdoc} prototype (or final +% version) is released. +% +% Thus although this document frequently speaks of \package{xdoc}, you +% might just as well read it as \package{xdoc2}. +% +% +% \subsection{Changes to old features} +% +% Whereas \package{doc} more or less assumes that all pages have the +% same layout, \package{xdoc} takes measures to ensure that the +% \package{doc} features support two-sided document designs. If the +% left margin has been widened to better accommodate long macro names +% however (like for example the \package{ltxdoc} document class does), +% then you may find that the outer margin on right (odd) pages is too +% narrow for printing macro names in. The remedy for this is the +% \GenericDescribePrint{\MacroFont dolayout \normalfont option}^^A +% \SortIndex{dolayout}{\texttt{dolayout} option\encapchar +% usage}\texttt{dolayout} option; in two-sided mode it causes +% \package{xdoc} to recompute the |\oddsidemargin| so that the outer +% margin has the same size on right pages as it previously did on left +% pages. In documents which are not processed in two-sided mode the +% \texttt{dolayout} option has no effect. +% +% |\DocInput| has been changed to not make percent a comment character +% upon return unless it was before the |\DocInput|. This makes |\DocInput| +% nestable and I recommend that \texttt{.dtx} files which input other +% \texttt{.dtx} files use |\DocInput| for this. +% +% The |\DocInclude| command, which is defined by the \package{ltxdoc} +% document class rather than \package{doc}, is also by default +% redefined in an incompatible manner by \package{xdoc}, but you can +% stop \package{xdoc} from making incompatible changes if you pass it the +% option \GenericDescribePrint{\MacroFont olddocinclude \normalfont +% option}\SortIndex{olddocinclude}{\texttt{olddocinclude} option^^A +% \encapchar usage}\texttt{olddocinclude}. The main incompatibility +% lies in that the default redefinition of |\DocInclude| behaves purely +% as an |\include| command which |\DocInput|s a \texttt{.dtx} file rather +% than merely |\input|ting a \texttt{.tex} file---you must pass the +% \GenericDescribePrint{\MacroFont fileispart \normalfont option}^^A +% \SortIndex{fileispart}{\texttt{fileispart} option\encapchar +% usage}\texttt{fileispart} option to \package{xdoc} to get the |\part| +% headings etc.\ for each new file---but there are also minor changes +% in the appearance of these headings, in how page styles are set, and +% in how the information presented in the page footer is obtained. +% +% Other changes are as far as I can tell minor and within the bounds of +% expected behaviour, but code that relies on the implementation of some +% feature in \package{doc} may of course behave differently or break +% completely. Note in particular that the formats of the internal +% \package{doc} variables |\saved@macroname|, |\macro@namepart|, and +% |\index@excludelist| have changed completely (see +% Section~\ref{Sec:Changes}, Subsection~\ref{Ssec:Scanning macrocode}, +% and Subsection~\ref{Ssec:Index-exclude} respectively)---hence any hack +% involving one of these must be revised before it is used with +% \package{xdoc}. These are however exceptions; in my experience the most +% noticeable changes not listed above are that the index exclude +% mechanism actually works for control sequences whose names consist of +% a single non-letter and that symbols get sorted in a different order. +% +% +% \subsection{Some notable new features} +% +% The main new feature is the \DescribeMacro\NewMacroEnvironment +% |\NewMacroEnvironment| command, which defines a new \texttt{macro}-like +% environment. The command offers complete control of the argument +% structure, the formatting of the marginal heading, the code for making +% index entries, and the change entry sorting and formatting, but the +% syntax is too complex to explain here. Those who are interested in +% using it should read Section~\ref{Sec:Macro-environments}. In +% particular, Subsections~\ref{Ssec:Macro&environment}--^^A +% \ref{Ssec:More macros} contain several examples of how it can be +% used. In addition to using |\New|\-|Macro|\-|Environment| for +% redefining the \DescribeEnv{macro}\texttt{macro} and +% \DescribeEnv{environment}\texttt{environment} environments, +% \package{xdoc} also defines an \DescribeEnv{option}\texttt{option} +% environment (which is intended for document class and package +% options) and a \DescribeEnv{switch}\texttt{switch} environment (which +% is intended for switches defined using |\newif|; the argument should +% not include the |\if|). +% +% There is also a companion command \DescribeMacro\NewDescribeCommand +% |\NewDescribeCommand| which defines new commands similar to +% |\Describe|\-|Macro| and |\Describe|\-|Env|. The syntax of +% |\New|\-|Describe|\-|Command| is also too complex to explain here, so +% I have to refer readers who want to use it to Section~^^A +% \ref{Sec:Describing}. Two more commands which are defined in that +% section are \DescribeMacro\describeoption|\describe|\-|option|, which +% is the \texttt{describe}\dots\ companion of the \texttt{option} +% environment, and \DescribeMacro\describecsfamily +% |\describe|\-|cs|\-|family| which is meant for describing control +% sequence families (see the table on page~\pageref{Tab:CS-families} for +% examples of what I mean). The argument of this latter command is simply +% the material you would put between |\csname| and |\endcsname|. Variant +% parts are written as |\meta|\B\marg{text} and print as one would expect +% them to (but notice that the \meta{text} is a moving argument) whereas +% most other characters can be written verbatim without any special +% quoting (but |\|, |{|, |}|, and |%| need quoting; see the comments to +% the definition of |\describe|\-|cs|\-|family| for information on how +% to do that). +% +% The \DescribeMacro\DoNotIndexBy|\DoNotIndexBy| command tells the +% commands that make index entries for macros to ignore a certain +% character sequence when the index entries are sorted. The +% |\DoNotIndexBy| command takes one argument: the character sequence to +% ignore. If |\DoNotIndexBy| is used more than once then the indexing +% commands will look for, and if it finds it ignore, each of the +% character sequences given to it, starting with the one specified last. +% +% It has already been mentioned that the |\DocInclude| command has been +% changed. What has not been mentioned is its companion +% \DescribeMacro\setfileinfo|\setfileinfo|, +% which the partfiles should use for setting the date and version +% information presented in the page footer, but that is explained in +% detail in Subsection~\ref{Ssec:New DocInclude}. +% +% Finally there is a new variant of the |\changes| command which is +% intended for changes that, although not limited to a single macro and +% thus being ``general'' changes in the \package{doc} terminology, affect +% only a few (probably widely dispersed) macros (or whatever). The basic +% idea is that you can define a change with a specific version, date, +% and text using the \DescribeMacro{\definechange}|\definechange| command +% and then recall those parameters later using the +% \DescribeMacro{\usechange}|\usechange| command. Primarily this ensures +% that the entry texts are identical so that \package{makeindex} will +% combine them into one entry, but it is also specified which macro +% was changed at which page. See Section~\ref{Sec:Changes} for more +% details. Another new feature concerning |\changes| is that there is +% now support for sorting version numbers according to mathematical +% order rather than ASCII order. Traditionally the version numbers +% \texttt{2}, \texttt{11}, and \texttt{100} would have been sorted so +% that \texttt{100}${}<{}$\texttt{11}${}<{}$\texttt{2}, but if they are +% entered as \DescribeMacro{\uintver}|\uintver{2}|, |\uintver{11}|, and +% |\uintver{100}| then they will be sorted as +% \texttt{2}${}<{}$\texttt{11}${}<{}$\texttt{100}. The argument of +% |\uintver| must be a \TeX\ \meta{number}. +% +% \medskip +% +% \package{xdoc} also contains several features which are of little use +% as direct user commands, but which can simplify the definitions of other +% commands. The foremost of these are the `harmless character strings', +% which can be seen as a datatype for (short pieces of) verbatim text. +% \TeX\ typesets a harmless character string in pretty much the same way +% as the corresponding string of `other' tokens, but the harmless +% character string can also be written to file and read back arbitrarily +% many times without getting garbled, it doesn't make \package{makeindex} +% choke, and it survives being fed to a |\protected@edef|. The most +% important commands related to harmless character strings are +% \DescribeMacro\PrintChar|\PrintChar|, which is used for representing +% problematic characters, and \DescribeMacro\MakeHarmless|\MakeHarmless|, +% which converts arbitrary \TeX\ code to the corresponding harmless +% character string. +% +% The superfluity of indexing commands in \package{doc} has been +% replaced by the single command \DescribeMacro\IndexEntry|\IndexEntry|, +% which has been designed with the intention that it should provide a +% clear interface between the user level macros and the index sorting +% program. It takes three arguments: the index entry specification, the +% name of the encapsulation scheme that should be used, and the number to +% put in the index. The index entry specification is a sequence of +% |\LevelSame| and\slash or |\LevelSorted| commands, which have the +% respective syntaxes +% \begin{quote} +% \DescribeMacro\LevelSame|\LevelSame|\marg{text}\\ +% \DescribeMacro\LevelSorted|\LevelSorted|\marg{sort key}\marg{text} +% \end{quote} +% Each such command specifies one level of the index entry. In the case of +% |\LevelSorted|, the \meta{text} is what will be written in the sorted +% index at that level and \meta{sort key} is what the index-sorting +% program should look at when sorting the entry (at that level). In the +% case of |\LevelSame|, the \meta{text} is used both as sort key and +% contents of entry in the sorted index. The first command is for the +% topmost level and each subsequent command is for the next sublevel. +% The complete description appears in Subsection~\ref{Ssec:IndexEntry}. +% +% \package{xdoc} also contains support for external cross-referencing +% programs (see Subsection~\ref{Ssec:XXR} for details) and a system for +% determining whether a piece of text falls on an even or an odd page +% (see Section~\ref{Sec:Twoside} for details). I expect that the latter +% system will eventually migrate out of \package{xdoc}, either to a +% package of its own, or into oblivion because the \LaTeXplus\ output +% routine makes it obsolete. +% +% +% \subsection{The \package{docindex} package} +% +% As of prototype version 2.2, the \package{xdoc} package has a companion +% package \package{docindex}~\cite{docindex} which provides improved +% formatting of the index and list of changes. \package{xdoc} works fine +% without \package{docindex}, however. +% +% +% \subsection{A note on command names} +% +% The \package{doc} package defines several commands with mixed-case +% names which (IMHO) should really have all-lower-case names (according +% to the rule of thumb spelled out in \cite[Ssec.~2.4]{clsguide}) since +% people use them in the capacity of being the author of a \texttt{.dtx} +% file rather than in the capacity of being the writer of a class or +% package. The names in question are +% \begin{longtable}{ll} +% \textbf{Name in \package{doc}}& \textbf{Better (?) name}\endhead +% \cs{AlsoImplementation}& \cs{alsoimplementation}\\ +% \cs{CharacterTable}& \cs{charactertable}\\ +% \cs{CharTableChanges}& \cs{chartablechanges}\\ +% \cs{CheckModules}& \cs{checkmodules}\\ +% \cs{CheckSum}& \cs{checksum}\\ +% \cs{CodelineIndex}& \cs{codelineindex}\\ +% \texttt{CodelineNo} (counter)& \texttt{codelineno}\\ +% \cs{CodelineNumbered}& \cs{codelinenumbered}\\ +% \cs{DeleteShortVerb}& \cs{deleteshortverb}\\ +% \cs{DescribeEnv}& \cs{describeenv}\\ +% \cs{DescribeMacro}& \cs{describemacro}\\ +% \cs{DisableCrossrefs}& \cs{disablecrossrefs}\\ +% \cs{DocInput}& \cs{docinput}\\ +% \cs{DoNotIndex}& \cs{donotindex}\\ +% \cs{DontCheckModules}& \cs{dontcheckmodules}\\ +% \cs{EnableCrossrefs}& \cs{enablecrossrefs}\\ +% \cs{Finale}& \cs{finale}\\ +% \texttt{GlossaryColumns} (counter)& \texttt{glossarycolumns}\\ +% \cs{GlossaryPrologue}& \cs{glossaryprologue}\\ +% \texttt{IndexColumns} (counter)& \texttt{indexcolumns}\\ +% \cs{IndexInput}& \cs{indexinput}\\ +% \cs{IndexPrologue}& \cs{indexprologue}\\ +% \cs{MakePrivateLetters}& \cs{makeprivateletters}\\ +% \cs{MakeShortVerb}& \cs{makeshortverb}\\ +% \cs{OnlyDescription}& \cs{onlydescription}\\ +% \cs{PageIndex}& \cs{pageindex}\\ +% \cs{PrintChanges}& \cs{printchanges}\\ +% \cs{PrintIndex}& \cs{printindex}\\ +% \cs{RecordChanges}& \cs{recordchanges}\\ +% \cs{SortIndex}& \cs{sortindex}\\ +% \cs{SpecialEscapechar}& \cs{specialescapechar}\\ +% \texttt{StandardModuleDepth} (counter)& \texttt{standardmoduledepth}\\ +% \cs{StopEventually}& \cs{stopeventually} +% \end{longtable} +% \noindent With the exception for \texttt{CodelineNo},\footnote{Where I +% recommend using \texttt{codelineno} instead of \texttt{CodelineNo}, +% \cs{PrintCodelineNo} instead of \cs{theCodelineNo}, and +% \cs{thecodelineno} instead of \cs{number}\cs{c@CodelineNo}; see +% Subsection~\ref{Ssec:CodelineNo}.} I haven't changed any of the +% \package{doc} names in this \package{xdoc} prototype, nor introduced any +% of the ``better names'' as alternatives, but I think the matter should +% be given a bit of thought during the future development of +% \package{doc}\slash \package{xdoc}. +% +% For completeness, I should also remark that there are several macros +% that \package{doc} gives mixed-case names which I haven't listed above. +% The logo command names have special capitalizing rules by tradition. +% Some macros and named registers---for example |\Docstyle|\-|Parms|, +% |\Index|\-|Parms|, |\Macro|\-|Font|, |\Macro|\-|Topsep|, +% |\Make|\-|Percent|\-|Ignore|, and |\Print|\-|Macro|\-|Name|---are part +% of the package or document class writer's interface to \package{doc}, +% although I cannot claim it to be obvious that for example +% |\Index|\-|Parms| and the \texttt{IndexColumns} counter should belong +% to different classes here (but several of these control sequences will +% probably disappear from the interface in \LaTeXplus\ anyway, so the +% problem isn't that important). The |\Special|\dots\B|Index| commands +% (and their even more special variants, such as +% |\Left|\-|Brace|\-|Index|) are internal commands rather than user level +% commands. Finally there is the |\Get|\-|File|\-|Info| command, which I +% doubt there is any point in having. +% +% +% \StopEventually{} +% +% +% \subsection{\package{docstrip} modules} +% +% The \package{docstrip} modules in \texttt{xdoc2.dtx} are: +% \begin{description} +% \item[\textsf{pkg}] +% This module directive surrounds the code for the \package{xdoc} +% package. +% \item[\textsf{driver}] +% The driver. +% \item[\textsf{internals}] +% This module contains an alternative replacement text for the +% |\Print|\-|Visible|\-|Char| command that uses ``\LaTeX\ internal +% character representation'' (i.e., as much as possible +% encoding-specific commands---|\text|\textellipsis\ commands and +% the like) rather than the primitive |\char| command for +% typesetting visible characters. +% It is provided as a separate module mainly for compability with +% prototype version~2.0, as this alternative definition can (as of +% prot.\,2.1) be chosen by passing the option +% \describeoption{notrawchar}\texttt{notrawchar} to \package{xdoc}. +% \item[\textsf{economical}] +% There is little point in storing the harmless representations of +% the 161 non-visible-ASCII characters as these representations are +% always the same and can be formed on the fly whenever they are +% needed. The \textsf{economical} modules contain some alternative +% code which makes use of this fact to reduce the number of control +% sequences used for storing the table of harmless representations. +% The \Module{economical} module appears inside the \Module{pkg} +% module. +% \item[\textsf{xdoc2}] +% This module contains code for compability with previous releases +% of \package{xdoc2}. It will not be included in \package{xdoc3} +% or \package{xdoc} (whichever is the next major version). +% \item[\textsf{enccmds}] +% This module contains the code for defining two \texttt{macro}-like +% environments for encoding-specific commands. These are not included +% in the \package{xdoc} package since so few \texttt{.dtx} files +% define encoding-specific commands. +% \item[\textsf{rsrccmd}] +% Similar to the \textsf{enccmds} module, but demonstrates the +% |\New|\-|Describe|\-|Command| command instead. +% \item[\textsf{example}] +% This surrounds some code which to \package{docstrip} looks like it +% should be copied, but isn't meant to. +% \end{description} +% +% +% +% \section{Initial stuff} +% +% First there's the usual |\NeedsTeXFormat| and |\ProvidesPackage|. +% \begin{macrocode} +%<*pkg> +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{xdoc2}[2003/07/06 prot2.5 doc reimplementation package] +% \end{macrocode} +% +% \subsection*{Options} +% +% The first option has to do with the page layout. +% Although \package{doc} itself doesn't modify any of the main layout +% parameters, it is well known that using it does tend to restrict +% one's choices in terms of document layout. In particular the +% \texttt{macro} and \texttt{environment} environments require a rather +% large left margin since they will otherwise print long macro names +% partially outside the paper. It is furthermore hard to decrease the +% |\textwidth| as it should be wide enough to contain about 70 columns of +% |\MacroFont| text. Thus the only solution is to do as the +% \package{ltxdoc}~\cite{ltxdoc} document class and enlarge the left +% margin at the expense of the right. +% +% The resulting layout has a left--right asymmetry with the main galley +% (the text rectangle) on the right and a very wide left margin (in +% which marginal headings and marginal notes appears). Although this +% layout is not uncommon in technical manuals, it is inappropriate for +% two-sided designs since the vertical line at which the two pages of a +% spread meet becomes the natural vertical symmetry axis for the entire +% spread and it breaks this symmetry to let the left margin be the +% widest on all pages. It would look better to always let the outer +% margin be the largest. +% +% \begin{option}{dolayout} +% \begin{macro}{\oddsidemargin} +% The \texttt{dolayout} option modifies |\oddsidemargin| so that +% spreads are symmetric around the center in two-sided mode. As size +% of the outer margin is taken the size of the left margin on left +% (even) pages, i.e., |\evensidemargin|${}+1\,\mathrm{in}$. +% +% In one-sided mode, the \texttt{dolayout} option does nothing. +% \begin{macrocode} +\DeclareOption{dolayout}{% + \if@twoside + \setlength\oddsidemargin{\paperwidth} + \addtolength\oddsidemargin{-\textwidth} + \addtolength\oddsidemargin{-\evensidemargin} + \addtolength\oddsidemargin{-2in} + \fi +} +% \end{macrocode} +% \end{macro}\end{option} +% +% \begin{option}{olddocinclude} +% \begin{option}{fileispart} +% The \texttt{olddocinclude} and \texttt{fileispart} options are +% related to the |\DocInclude| command defined by the \package{ltxdoc} +% document class. Some of the code related to that command relies on +% modifying the \package{doc} internal macro |\codeline@wrindex|, but +% that has no effect with \package{xdoc} so in order to get the +% expected results one has to reimplement the |\DocInclude| command as +% well. The \texttt{olddocinclude} and \texttt{fileispart} options +% control how this should be done. +% +% If the \texttt{olddocinclude} option is passed to \package{xdoc} +% then only the parts of the implementation of |\DocInclude| which +% must be altered to make the command work with the \package{xdoc} +% implementation of indexing and cross-referencing are changed. These +% redefinitions will furthermore only be made if the \package{ltxdoc} +% document class has been loaded; nothing is done if the +% \texttt{olddocinclude} option is passed and \package{ltxdoc} hasn't +% been loaded. Passing the \texttt{olddocinclude} option can be +% considered as requesting a ``compatibility mode'' for |\DocInclude|. +% +% If the \texttt{olddocinclude} option is not passed then the +% |\DocInclude| command is reimplemented from scratch, regardless of +% whether some definition of it has already been given or not. The +% basis of this reimplementation is the observation that the +% |\DocInclude| command of \package{ltxdoc} really does two quite +% distinct things at once---it is an |\include| command which +% |\DocInput|s files rather than |\input|ting them, but it also starts +% a new |\part|, sets the pagestyle, and changes how the values of +% some counters are typeset. This latter function is by default +% disabled in the \package{xdoc} implementation of |\DocInclude|, but +% passing the \texttt{fileispart} option enables it. +% +% There is no code for these two options here, as it is rather long; +% instead that code appears in Section~\ref{Sec:DocInclude}. The +% |\Pass|\-|Options|\-|To|\-|Package| commands make sure that these +% options are registered as local options for \package{xdoc}, so that +% one can test for them using |\@if|\-|package|\-|with| below. +% \begin{macrocode} +\DeclareOption{olddocinclude}{% + \PassOptionsToPackage{\CurrentOption}{xdoc2}% +} +\DeclareOption{fileispart}{% + \PassOptionsToPackage{\CurrentOption}{xdoc2}% +} +% \end{macrocode} +% \end{option}\end{option} +% +% \changes{prot2.5}{2003/07/06}{Reregeristing options in case +% they were global. (LH)} +% +% \begin{option}{notrawchar} +% The \texttt{notrawchar} option controls how the |\PrintVisibleChar| +% command is defined, and thereby what method is used for typesetting +% visible characters in e.g.\ macro names. The default is to use the +% |\char| primitive (which is better for \texttt{T1}-encoded fonts and +% non-italic \texttt{OT1}-encoded typewriter fonts), but the +% \texttt{notrawchar} option causes things to go via the ``\LaTeX\ +% internal character representation'' instead (which is necessary +% for e.g.\ \texttt{OT1}-encoded non-typewriter fonts). +% +% There is no code for this option here; instead that code is found +% in the definition of |\Print|\-|Visible|\-|Char|. +% \begin{macrocode} +\DeclareOption{notrawchar}{% + \PassOptionsToPackage{\CurrentOption}{xdoc2}% +} +% \end{macrocode} +% \end{option} +% +% +% Then options are processed. +% \begin{macrocode} +\ProcessOptions\relax +% \end{macrocode} +% And finally the \package{doc} package is loaded. +% \begin{macrocode} +\RequirePackage{doc} +% \end{macrocode} +% +% +% \section{Character strings} +% +% A source of much of the complexity in \package{doc} is that it has to +% be able to deal with rather arbitrary strings of characters (mainly +% the names of control sequences). Once the initial problems with +% characters having troublesome catcodes have been overcome however, it +% is usually no problem to manage such things in \TeX. \package{doc} +% does however complicate things considerably by also putting these +% things in the index and list of changes. Not only must they then be +% formatted so that the \package{makeindex} program doesn't choke on +% them, but they must also be wrapped up in code that allows \TeX\ to +% make sense of them when they are read back. \package{doc} manages the +% \package{makeindex} problems mainly by allowing the user to change what +% characters are used as \package{makeindex} metacharacters and the +% reading back problem by making abundant use of |\verb|. +% +% All this relies on that the author of a document is making sure that +% the metacharacters aren't used for anything else. If for example the +% |\verbatimchar| (by default |+|) is one of the ``private letters'' +% then names of control sequences containing that character will be +% typeset incorrectly because the |\verb| used to typeset it is +% terminated prematurely---control sequence names such as `|\lost+found|' +% will be typeset as `|\lost|found+'. On top of that, one also has to +% make sure that the font used for typesetting these |\verb| sections +% contains all the characters needed. +% +% For \package{xdoc}, I have chosen a completely different approach. +% Instead of allowing the strings (after they have converted to the +% internal format) to contain \TeX\ character tokens with arbitrary +% character codes, they may only contain \TeX\ character tokens which +% are unproblematic---the normal catcode should be 11 (letter) or 12 +% (other), they should not be outside visible ASCII, and they may not +% be one of the \package{makeindex} metacharacters. All other characters +% are represented using a robust command which takes the character code +% (in decimal) as the argument. This takes care of all ``moving +% argument'' type problems that may occur. +% +% An important observation about these character strings is that +% they are strings of \emph{input} characters. This means that rather +% than using the characters in some special font for typesetting +% control sequences like |\^^M| (recall that the |^^| substitutions +% take place before tokenization), one should typeset them using only +% visible ASCII characters. (After all, that's the only way they are +% written in \TeX\ code.) The default definition is to typeset +% invisible characters as precisely the |^^|-sequences that \TeX\ +% normally uses for these characters when they are written to a file. +% +% +% \subsection{Typesetting problematic characters} +% +% \begin{macro}{\PrintChar} +% \begin{macro}{\XD@threedignum} +% The |\PrintChar| command has the syntax +% \begin{quote} +% |\PrintChar|\marg{8-bit number} +% \end{quote} +% where \meta{8-bit number} is a \TeX\ number in the range 0--255. +% For arguments in the range 0--31, |\PrintChar| prints +% `\textit{\ttfamily\string^\string^@}'--`\textit{\ttfamily +% \string^\string^\string_}'. For an argument in the range 32--126, +% |\PrintChar| calls |\Print|\-|Visible|\-|Char| which by default +% simply does |\char| on that argument (but which can be redefined +% if the font set-up requires it); in particular, |\PrintChar{32}| +% should print a ``visible space'' character. |\PrintChar{127}| prints +% `\textit{\ttfamily\string^\string^?}'. For arguments in the range +% 128--255, |\PrintChar| prints +% `\textit{\ttfamily\string^\string^80}'--`\textit{\ttfamily +% \string^\string^ff}'. +% +% |\PrintChar| is robust. |\PrintChar| also has a special behaviour +% when it is written to a file (when |\protect| is |\noexpand|): it +% makes sure that the argument consists of three decimal digits, to +% ensure external sorting gets it right. +% \begin{macrocode} +\@ifundefined{PrintChar}{}{% + \PackageInfo{xdoc2}{Redefining \protect\PrintChar}% +} +\def\PrintChar{% + \ifx \protect\@typeset@protect + \expandafter\XD@PrintChar + \else\ifx \protect\noexpand + \string\PrintChar + \expandafter\expandafter \expandafter\XD@threedignum + \else + \noexpand\PrintChar + \fi\fi +} +% \end{macrocode} +% +% |\XD@threedignum| does a |\number| on its argument, possibly prepends +% a |0| or two, and wraps it all up in a ``group'' (the braces have +% category other, not beginning and end of group). +% \changes{prot2.1}{2000/11/15}{Braces inserted by +% \cs{XD@threedignum} are given catcode other. (LH)} +% \begin{macrocode} +\edef\XD@threedignum#1{% + \string{% + \noexpand\ifnum #1<100 % + \noexpand\ifnum #1<10 0\noexpand\fi + 0% + \noexpand\fi + \noexpand\number#1% + \string}% +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\XD@PrintChar} +% \begin{macro}{\InvisibleCharPrefix} +% \begin{macro}{\InvisibleCharSuffix} +% |\XD@PrintChar| manages the typesetting for |\PrintChar|. It +% distinguishes between visible characters (code 32--126) and +% invisible characters. The visible characters are typeset directly +% using |\PrintVisibleChar|, whereas the invisible characters are +% typeset as |^^|-sequences. +% +% The macros |\InvisibleCharPrefix| and |\InvisibleCharSuffix| begin +% and end a |^^|-sequence. |\InvisibleCharPrefix| should print the +% actual |^^|, but it may also for example select a new font for +% the |^^|-sequence (such font changes are restored at the end of +% |\XD@PrintChar|). +% \begin{macrocode} +\def\XD@PrintChar#1{% + \leavevmode + \begingroup + \count@=#1\relax + \ifnum \@xxxii>\count@ + \advance \count@ 64% + \InvisibleCharPrefix + \PrintVisibleChar\count@ + \InvisibleCharSuffix + \else\ifnum 127>\count@ + \PrintVisibleChar\count@ + \else + \InvisibleCharPrefix + \ifnum 127=\count@ \PrintVisibleChar{63}\else + \@tempcnta=\count@ + \divide \count@ \sixt@@n + \@tempcntb=\count@ + \multiply \count@ \sixt@@n + \advance \@tempcnta -\count@ + \advance \@tempcntb \ifnum 9<\@tempcntb 87\else 48\fi + \advance \@tempcnta \ifnum 9<\@tempcnta 87\else 48\fi + \char\@tempcntb \char\@tempcnta + \fi + \InvisibleCharSuffix + \fi\fi + \endgroup +} +% \end{macrocode} +% \begin{macrocode} +\newcommand\InvisibleCharPrefix{% + \/\em + \PrintVisibleChar{`\^}\PrintVisibleChar{`\^}% +} +\newcommand\InvisibleCharSuffix{\/} +% \end{macrocode} +% There are some alternative methods for making hexadecimal numbers +% which should perhaps be mentioned. The \LaTeX\ kernel contains a +% macro |\hexnumber@| which uses |\ifcase| to produce one hexadecimal +% digit, but that uses upper case letters, and things like `8E' look +% extremely silly if the upper case letters doesn't line with the +% digits. Applying |\meaning| to a \meta{chardef token} or +% \meta{mathchardef token} expands to |\char"|\meta{hex} and +% |\mathchar"|\meta{hex} respectively, where \meta{hex} is the +% corresponding number in hexadecimal, but that too has upper case A--F +% and leading zeros are removed. +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\PrintVisibleChar} +% \changes{prot2.1}{2000/12/18}{Made it possible to select the +% alternative defintion of \cs{PrintVisibleChar} through an +% \package{xdoc} package option. (LH)} +% The |\PrintVisibleChar| command should print the visible ASCII +% character whose character code is given in the argument. There are +% currently two definitions of this command: one which uses the \TeX\ +% primitive |\char| and one which goes via the ``\LaTeX\ internal +% character representation'' for the character. By default +% \package{xdoc} uses the former definition, but if \package{xdoc} +% is passed the +% \SortIndex{notrawchar}{\texttt{notrawchar} option\encapchar usage} +% \texttt{notrawchar} option then it will use the latter. +% +% The reason there are two definitions is a deficiency in how the NFSS +% encoding attribute has been assigned to fonts; even though the +% encodings of Computer Modern Roman and Computer Modern Typewriter +% are quite different, \LaTeXe\ uses the \texttt{OT1} encoding for +% both. As a result of this, the \LaTeX\ internal representation will +% in some important cases use characters from non-typewriter fonts +% despite the fact that typewriter forms are immediately available. +% Since the cases in which the |\char| primitive produces results as +% least as good as those made through the \LaTeX\ internal +% character representation includes those that the current font is +% \texttt{T1}-encoded or an \texttt{OT1}-encoded nonitalic typewriter +% font, the shorter |\char| primitive defintion has been made the +% default. +% +% For compability with prototype version~2.0 of \package{xdoc}, the +% replacement text for |\Print|\-|Visible|\-|Char| that uses \LaTeX\ +% internal character representation can alternatively be extracted by +% \package{docstrip}ping \texttt{xdoc2.dtx} with the option +% \Module{internals}. +% \begin{macrocode} +\@ifpackagewith{xdoc2}{notrawchar}{% + \newcommand\PrintVisibleChar[1]{% +%</pkg> +%<*pkg|internals> + \ifcase #1% + \or\or\or\or\or\or\or\or \or\or\or\or\or\or\or\or + \or\or\or\or\or\or\or\or \or\or\or\or\or\or\or\or + % "20 + \textvisiblespace \or!\or\textquotedbl \or\#\or\textdollar + \or\%\or\&\or\textquoteright\or(\or)\or*\or+\or,\or-\or.\or/% + \or % "30 + 0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or:\or;\or + \textless\or=\or\textgreater\or?% + \or % "40 + @\or A\or B\or C\or D\or E\or F\or G\or + H\or I\or J\or K\or L\or M\or N\or O% + \or % "50 + P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\or [\or + \textbackslash \or]\or\textasciicircum \or\textunderscore + \or % "60 + \textquoteleft \or a\or b\or c\or d\or e\or f\or g\or h\or + i\or j\or k\or l\or m\or n\or o% + \or % "70 + p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\or + \textbraceleft \or\textbar \or\textbraceright \or + \textasciitilde + \fi + }% +%</pkg|internals> +%<*pkg> +}{% + \newcommand\PrintVisibleChar[1]{\char #1\relax}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\Bslash} +% It turns out that it is very common to say |\PrintChar{92}| +% (backslash), so a macro which expands to that reduces typing. +% \begin{macrocode} +\newcommand\Bslash{\PrintChar{92}} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Rendering character strings harmless} +% +% Replacing all problematic characters with |\PrintChar| calls certainly +% makes the strings easier to manage, but actually making those +% replacements is a rather complicated task. Therefore this subsection +% contains the macros necessary for doing these replacements. +% +% The first problem is how to efficiently recognise the problematic +% characters. A first solution which gets rather far is to mainly look +% in the |\catcode| register for that character and keep the character +% as it is if the category found there is 11 or 12, but replace it with +% a |\PrintChar| command if the category is anything else. Two extra +% tests can be performed to take care of invisible ASCII, and the +% \package{makeindex} metacharacters can be cared for by locally +% changing their catcodes for when the string is processed. +% Unfortunately this doesn't work inside \texttt{macrocode} +% environments (where one would like to use it for the macro +% cross-referencing) since that environment changes the catcodes of +% several characters from being problematic to being unproblematic and +% vice versa.\footnote{As the entire \texttt{macrocode} environment is +% tokenized by the expansion of \cs{xmacro@code} one could alternatively +% solve this problem by reimplementing the \texttt{macrocode} +% environment so that normal catcodes are in force when the contents are +% being typeset.} As furthermore harmless character strings should be +% possible to move to completely different parts of the document, the +% test used for determining whether a character is problematic should +% yield the same result throughout the document. +% +% Because of this, I have chosen a brute strength solution: build a +% table (indexed by character code) that gives the harmless form of +% every character. This table is stored in the +% \describecsfamily{XD@harmless@\meta{code}}^^A +% |\XD@harmless@|\meta{code} family of control sequences, where the +% \meta{code} is in the range |0|--|255|. Assignments to this table are +% global. In principle, the table should not change after the preamble, +% but there is a command |\SetHarmState| which can be used at any time +% for setting a single table entry. This could be useful for documents +% which, like for example~\cite{fontinst}, have nonstandard settings of +% |\catcode|s. +% +% \begin{macro}{\SetHarmState} +% The |\SetHarmState| command takes three arguments: +% \begin{quote} +% |\SetHarmState|\marg{type}\marg{char}\marg{harm} +% \end{quote} +% \meta{char} is the character whose entry should be set. \meta{type} +% is a flag which specifies what format \meta{char} is given in. If +% \meta{type} is |\BooleanTrue| then \meta{char} is the \TeX\ +% \meta{number} of the table entry to set, and if \meta{type} is +% |\BooleanFalse| then \meta{char} is something which expands to a +% single character token whose entry should be set. The expansion is +% carried out by an |\edef|, so it needs not be only one level. +% \meta{harm} is |\BooleanTrue| if the character is problematic and +% |\BooleanFalse| if it is not. +% +% The \meta{type} and \meta{harm} arguments are currently not subject +% to any expansion. In the future they probably should be, but I +% don't want to make assumptions about the actual definitions of +% |\BooleanTrue| and |\BooleanFalse| at this point. +% \begin{macrocode} +\begingroup + \catcode\z@=12 + \@ifdefinable\SetHarmState{ + \gdef\SetHarmState#1#2#3{% + \begingroup + \ifx #1\BooleanTrue + \count@=#2\relax + \else + \protected@edef\@tempa{#2}% + \count@=\expandafter`\@tempa\relax + \fi + \ifx #3\BooleanTrue + \edef\@tempa{\noexpand\PrintChar{\the\count@}}% + \else + \uccode\z@=\count@ + \uppercase{\def\@tempa{^^@}}% + \fi + \global\expandafter\let + \csname XD@harmless@\the\count@ \endcsname \@tempa + \endgroup + }% + } +\endgroup +% \end{macrocode} +% \end{macro} +% +% \begin{trivlist}\item[]\leavevmode ^^A Just for the look of it +% \GenericDescribePrint{\small\cs{XD@harmless@}\meta{code}}^^A +% ^^A There should have been a "main" index entry here as well, +% ^^A but generating that with \package{doc} commands is more than I +% ^^A bother to do right now. +% Initializing the |\XD@harmless@|\meta{code} table is a +% straightforward exercise of |\loop| \dots\ |\repeat|. +% \begin{macrocode} +%<*!economical> +\count@=\z@ +\loop + \expandafter\xdef \csname XD@harmless@\the\count@ \endcsname + {\noexpand\PrintChar{\the\count@}}% + \advance \count@ \@ne +\ifnum 33>\count@ \repeat +%</!economical> +%<economical>\count@=\@xxxii +\begingroup + \catcode\z@=12\relax + \@firstofone{% +\endgroup + \loop + \if \ifnum 11=\catcode\count@ 1\else \ifnum 12=\catcode\count@ + 1\else 0\fi\fi 1% + \uccode\z@=\count@ + \uppercase{\def\@tempa{^^@}}% + \else + \edef\@tempa{\noexpand\PrintChar{\the\count@}}% + \fi + \global\expandafter\let + \csname XD@harmless@\the\count@ \endcsname \@tempa + \advance \count@ \@ne + \ifnum 127>\count@ \repeat +} +%<*!economical> +\loop + \expandafter\xdef \csname XD@harmless@\the\count@ \endcsname + {\noexpand\PrintChar{\the\count@}}% +\ifnum \@cclv>\count@ + \advance \count@ \@ne +\repeat +%</!economical> +% \end{macrocode} +% Marking the \package{makeindex} metacharacters as harmful is +% deferred until |\begin|\nolinebreak[2]|{document}|, since it is not +% unreasonable that these are changed in the preamble. +% \begin{macrocode} +\AtBeginDocument{% + \SetHarmState\BooleanFalse\actualchar\BooleanTrue + \SetHarmState\BooleanFalse\encapchar\BooleanTrue + \SetHarmState\BooleanFalse\levelchar\BooleanTrue + \SetHarmState\BooleanFalse\quotechar\BooleanTrue +} +% \end{macrocode} +% \package{doc}'s |\verbatimchar| is not harmful, since it isn't used +% at all in \package{xdoc}. +% \end{trivlist} +% +% +% \begin{macro}{\MakeHarmless} +% To render a character string harmless, you do +% \begin{quote} +% |\MakeHarmless|\marg{macro}\marg{string} +% \end{quote} +% This locally assigns to \meta{macro} the harmless character string +% which corresponds to \meta{string}. During the conversion the converted +% part of the string is stored in |\toks@|, but that is local to +% |\MakeHarmless|. +% \begin{macrocode} +\def\MakeHarmless#1#2{% + \begingroup + \toks@={}% + \escapechar=`\\% + \XD@harmless@#2\XD@harmless@ + \expandafter\endgroup \expandafter\def \expandafter#1% + \expandafter{\the\toks@}% +} +% \end{macrocode} +% +% \begin{macro}{\XD@harmless@iii} +% \begin{macro}{\XD@harmless@iv} +% \begin{macro}{\XD@harmless@v} +% \changes{prot2}{2000/07/27}{Moved code for adding to \cs{toks@} here +% and changed it to append the contents of \cs{XD@harmless@32}, not +% necessarily a \cs{PrintChar}. (LH)} +% \begin{macro}{\XD@harmless@vi} +% What one has to be most careful about when rendering strings +% harmless are the space tokens, since many of \TeX's primitives gladly +% snatches an extra space (or more) where you don't want them to in +% this case. Macro parameters can be particularly dangerous, as \TeX\ +% will skip any number of spaces while looking for the replacement +% text for an undelimited macro argument. Therefore the algorithm for +% rendering a character token harmless begins +% (|\XD@|\B|harmless@iii|) with |\string|ing the next token in the +% string---this preserves the character code and sets the category to +% 12 for all characters except the ASCII space, which gets category 10 +% (space)---and then |\futurelet| is used to peek at the next token. If +% it is a space token (|\XD@|\B|harmless@iv|) then the character code +% is 32 and the actual space can be gobbled (|\XD@|\B|harmless@v|), and +% if it isn't then the next token can be grabbed in an undelimited macro +% argument (|\XD@|\B|harmless@vi|). In either case, the harmless form +% is given by the |\XD@|\B|harmless@|\meta{code} table entry +% (in |\XD@|\B|harmless@v| or |\XD@|\B|harmless@vi|). +% \begin{macrocode} +\def\XD@harmless@iii{% + \expandafter\futurelet \expandafter\@let@token + \expandafter\XD@harmless@iv \string +} +% \end{macrocode} +% \begin{macrocode} +\def\XD@harmless@iv{% + \ifx \@let@token\@sptoken + \expandafter\XD@harmless@v + \else + \expandafter\XD@harmless@vi + \fi +} +% \end{macrocode} +% ^^A Hack: +% \begingroup +% \expandafter\def \expandafter\MakePrivateLetters \expandafter{^^A +% \MakePrivateLetters +% \catcode`3=11 +% \catcode`2=11 +% } +% \begin{macrocode} +\begingroup + \catcode`3=\catcode`a + \catcode`2=\catcode`a + \@firstofone{\gdef\XD@harmless@v} {% + \toks@=\expandafter{\the \expandafter\toks@ \XD@harmless@32}% + \XD@harmless@ + } +\endgroup +% \end{macrocode} +% \endgroup +% In the \Module{economical} (with hash table space) variant +% implementation the |\XD@harmless@|\meta{code} table has entries only +% for the characters in visible ASCII. Thus the harmless forms of +% characters outside visible ASCII must be constructed on the fly. +% \begin{macrocode} +\def\XD@harmless@vi#1{% +%<*economical> + \if \ifnum `#1<\@xxxii 1\else \ifnum `#1>126 1\else 0\fi\fi 1% + \toks@=\expandafter{\the\expandafter\toks@ + \expandafter\PrintChar \expandafter{\number`#1}% + }% + \else +%</economical> + \toks@=\expandafter{\the\expandafter\expandafter\expandafter\toks@ + \csname XD@harmless@\number`#1\endcsname}% +%<economical> \fi + \XD@harmless@ +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\XD@harmless@} +% \begin{macro}{\XD@harmless@i} +% \begin{macro}{\XD@harmless@ii} +% But that is not all |\MakeHarmless| can do. In some cases (as for +% example when one is describing a family of control sequences) one +% might want to include things in the string that are not simply +% characters, but more complex items---such as for example |\meta| +% constructions like \meta{code}. To accommodate for this, +% |\XD@harmless@| (which is the first step in converting a token) +% always begins by checking whether the next token to render harmless +% is a control sequence. If it is then it is checked (in +% |\XD@harmless@ii|) whether the control sequence +% \describecsfamily{XD@harmless\Bslash\meta{cs-name}}^^A +% |\XD@harmless\|\meta{cs-name}, where \meta{cs-name} is the name +% without |\| of the control sequence encountered, is defined. If it +% isn't then the encountered control sequence is |\string|ed and +% conversion continues as above, but if it is defined then the +% encountered control sequence begins such a more complex item. +% \begin{macrocode} +\def\XD@harmless@{\futurelet\@let@token \XD@harmless@i} +% \end{macrocode} +% \begin{macrocode} +\def\XD@harmless@i{% + \ifcat \noexpand\@let@token \noexpand\XD@harmless@ + \expandafter\XD@harmless@ii + \else + \expandafter\XD@harmless@iii + \fi +} +% \end{macrocode} +% \begin{macrocode} +\def\XD@harmless@ii#1{% + \@ifundefined{XD@harmless\string#1}{% + \expandafter\XD@harmless@vi \string#1% + }{\csname XD@harmless\string#1\endcsname}% +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\XD@harmless\XD@harmless@} +% A control sequence |\XD@harmless\|\meta{cs-name} is responsible for +% interpreting the string item that begins with the control sequence +% |\|\meta{cs-name} and appending a harmless representation of it to +% |\toks@|. Harmless representations should only contain robust +% control sequences and they must not rely on changing any catcodes. +% Normal |\XD@harmless\|\meta{cs-name} control sequences must also +% end by inserting |\XD@harmless@| in front of what remains of the +% string after the complex string item has been removed. This sees to +% that the rest of the string is also rendered harmless. The only such +% control sequence which does not insert |\XD@harmless@| is +% |\XD@harmless\XD@harmless@|, but that is as it should be since +% |\MakeHarmless| itself appends a |\XD@harmless@| to every character +% string it should convert to mark the end of it. +% \begin{macrocode} +\expandafter\let + \csname XD@harmless\string\XD@harmless@\endcsname \@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\XD@harmless\PrintChar} +% It is occasionally convenient to use a |\PrintChar| command as part +% of a string that is to be rendered harmless instead of using the raw +% character. The definition is very similar to that of +% |\XD@harmless@vi|. +% \begin{macrocode} +\@namedef{XD@harmless\string\PrintChar}#1{% +%<*economical> + \if \ifnum #1<\@xxxii 1\else \ifnum #1>126 1\else 0\fi\fi 1% + \toks@=\expandafter{\the\expandafter\toks@ + \expandafter\PrintChar \expandafter{\number#1}% + }% + \else +%</economical> + \toks@=\expandafter{\the\expandafter\expandafter\expandafter\toks@ + \csname XD@harmless@\number#1\endcsname}% +%<economical> \fi + \XD@harmless@ +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Interaction with mechanisms that make characters +% problematic} +% +% If additional visible characters are made problematic after the +% initial |\XD@harmless@|\meta{code} table is formed then problems may +% indeed arise, because some character which is expected to be +% unproblematic when read from (for example) an \texttt{.ind} file will +% actually not be. In fortunate cases this will only lead to that +% characters will print strangely or not at all, but it can quite +% conceivably lead to errors that prevent further typesetting and it +% should therefore be prevented if possible. +% +% Right now, I can think of two mechanisms that make characters +% problematic, and both do that by making them active. One is the +% shorthand mechanism of \package{babel}, but I think I'll delay +% implementing any interaction with that until some later prototype; I +% don't know it well enough and anyway I don't think it is that likely +% to cause any problems. The other mechanism is the short verb mechanism +% of \package{doc} itself, and this should be taken care of right away. +% +% The main difficulty is that the |\XD@harmless@|\meta{code} table should +% be the same throughout the document body (otherwise you may get more +% than one index entry for the same thing, with index references +% arbitrarily distributed between the two) whereas short verb characters +% can be made and deleted at any time. It would actually be wrong to +% always have the |\XD@harmless@|\meta{code} table entry mirroring the +% current state of the character! Instead a character will be considered +% as problematic even if it is only made problematic temporarily (with +% the exception for characters that are made problematic in +% \texttt{verbatim} environments and the like---the index file isn't +% being read in while those catcodes are active). Since it is impossible +% to know in the beginning of a document whether a character will be made +% a short verb character at some later point, the modifications to the +% |\XD@harmless@|\meta{code} table that will be made because of short verb +% characters will (at least partially) be based on which characters were +% made short verbs on the previous run. +% +% \begin{macro}{\SetCharProblematic} +% \changes{prot2}{2000/07/26}{Command added. (LH)} +% The |\SetCharProblematic| command should be called by commands which +% make a character problematic (e.g.\ makes it active) in the general +% context (commands which make some character problematic only in some +% very special context, such as the \texttt{verbatim} environment, +% need not call |\Set|\-|Char|\-|Problematic|). The syntax is +% \begin{quote} +% |\SetCharProblematic|\marg{code} +% \end{quote} +% and it sets the ``harm state'' of the character whose code is +% \meta{code} to problematic. +% +% When |\SetCharProblematic| is called in the preamble, it sets the +% harm state on the current run. When it is called in the document +% body however, it sets the harm state on the next run by writing a +% |\SetHarmState| command to the \texttt{.aux} file. This is done to +% ensure that the contents of the |\XD@harmless@|\meta{code} table +% doesn't change during the body of a document. +% \begin{macrocode} +\newcommand\SetCharProblematic[1]{% + \SetHarmState\BooleanTrue{#1}\BooleanTrue +} +\AtBeginDocument{% + \gdef\SetCharProblematic#1{% + \if@filesw + \immediate\write\@auxout{\string\SetHarmState + \string\BooleanTrue {\number#1}\string\BooleanTrue}% + \fi + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\add@specials} +% \changes{prot2}{2000/07/26}{Redefinition added. (LH)} +% |\MakeShortVerb|'s call to |\SetCharProblematic| is put in the +% |\add@|\B|specials| macro, which anyway already adds the character +% to the |\dospecials| and |\@sanitize| lists. Only familiar +% definitions of |\add@special| are changed. +% \begin{macrocode} +\def\@tempa#1{% + \rem@special{#1}% + \expandafter\gdef\expandafter\dospecials\expandafter + {\dospecials \do #1}% + \expandafter\gdef\expandafter\@sanitize\expandafter + {\@sanitize \@makeother #1}} +\ifx \@tempa\add@special + \def\add@special#1{% + \rem@special{#1}% + \expandafter\gdef\expandafter\dospecials\expandafter + {\dospecials \do #1}% + \expandafter\gdef\expandafter\@sanitize\expandafter + {\@sanitize \@makeother #1}% + \SetCharProblematic{`#1}% + } +\else + \PackageWarningNoLine{xdoc2}{Unfamiliar definition of + \protect\add@special;\MessageBreak the macro was not patched} +\fi +% \end{macrocode} +% \end{macro} +% +% +% +% \section{Indexing} +% \label{Sec:Indexing} +% +% Each type of index entry \package{doc} produces is implemented through +% a different indexing command.\footnote{Sometimes there are +% even more than one command per entry type---the \cs{SpecialIndex}, +% \cs{LeftBraceIndex}, \cs{RightBraceIndex}, and \cs{PercentIndex} +% commands all generate entries of the same type.} This might be +% manageable when there are only \texttt{macro}s and +% \texttt{environment}s to distinguish between, but it soon gets +% unmanageable if more environments of this type are added. Therefore +% all \package{xdoc} index entries are made with a single +% command---|\IndexEntry|. +% +% +% \subsection{New basic indexing commands} +% \label{Ssec:IndexEntry} +% +% \begin{macro}{\IndexEntry} +% \begin{macro}{\LevelSame} +% \changes{prot2.1}{2000/11/18}{New name for \cs{levelsame}. (LH)} +% \begin{macro}{\LevelSorted} +% \changes{prot2.1}{2000/11/18}{New name for \cs{levelsorted}. (LH)} +% \begin{macro}{\XD@if@index} +% The |\IndexEntry| command writes one index entry to the \texttt{.idx} +% file. It takes three arguments: +% \begin{quote} +% |\IndexEntry|\marg{entry text}\marg{encap}\marg{thenumber} +% \end{quote} +% The \meta{entry text} contains the text for the entry. It is a +% nonempty sequence of commands in which each item is one of +% \begin{quote} +% |\LevelSame|\marg{text}\\ +% |\LevelSorted|\marg{sort key}\marg{text} +% \end{quote} +% Each such item specifies one level of the entry that is to be +% written. In the case of |\LevelSorted|, the \meta{text} is what will +% be written in the sorted index at that level and \meta{sort key} is +% a key which the index-sorting program should use for sorting that +% entry at that level. In the case of |\LevelSame|, the \meta{text} is +% used both as sort key and contents of entry in the sorted index. +% The first item is for the topmost level and each subsequent item is +% for the next sublevel. The \meta{entry text} will be fully expanded +% by the |\IndexEntry| command. +% +% \meta{thenumber} is the number (if any) that the index entry refers +% to. It can consist of explicit characters, but it can also be a +% |\the|\meta{counter} control sequence or a macro containing such +% control sequences. \meta{thenumber} is fully expanded by the +% |\IndexEntry| command, with the exception for occurrences of +% |\thepage|---expansion of |\thepage| will instead be delayed until +% the page is shipped out, so that the page numbers will be right. +% \textbf{Note:} \meta{thenumber} must not contain any formatting that +% will upset the index-sorting program. \package{doc}'s default +% definition of |\theCodelineNo| contains such formatting, so one +% must instead use |\thecodelineno| as \meta{thenumber} in that case. +% +% \meta{encap} is the name of the encapsulation scheme that should be +% applied to \meta{thenumber}. All encapsulation schemes that have been +% implemented instruct the index sorting program to wrap up +% \meta{thenumber} in some code that gives it special formatting when +% the sorted index is written, but one could also use the \meta{encap} +% to specify `beginning of range' and `end of range' index entries. +% Use \GenericDescribePrint{\small\texttt{none}}^^A +% \SortIndex{none}{\texttt{none}\encapchar usage}\texttt{none} as +% \meta{encap} if you don't want any special formatting. +% +% \textbf{Note:} |\IndexEntry| uses |\@tempa| internally, so you +% cannot use that in argument \#2 or \#3. Using it in argument \#1 +% presents no problems, though. +% \begin{macrocode} +\newcommand\IndexEntry[3]{% + \@bsphack + \begingroup + \def\LevelSame##1{\levelchar##1}% + \def\LevelSorted##1##2{\levelchar##1\actualchar##2}% + \protected@edef\@tempa{#1}% + \protected@edef\@tempa{\expandafter\@gobble\@tempa\@empty}% + \@ifundefined{XD@idxencap@#2}{% + \PackageError{xdoc2}{Index entry encap `#2' unknown}\@eha + }{% + \XD@if@index{% + \csname XD@idxencap@#2\endcsname\@tempa{#3}% + }{}% + }% + \endgroup + \@esphack +} +% \end{macrocode} +% |\IndexEntry| does (like |\index|) not contribute any material to the +% current list if indices aren't being made. +% +% |\XD@if@index| is |\@firstoftwo| if index entries are being written +% and |\@second|\-|of|\-|two| if they are not. +% \begin{macrocode} +\let\XD@if@index=\@secondoftwo +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% In \LaTeXplus, the \cs{IndexEntry} command should probably be +% implemented using templates, e.g. the \meta{encap}s could be names of +% instances. +% +% \begin{macro}{\levelsame} +% \begin{macro}{\levelsorted} +% These names were used for |\LevelSame| and |\LevelSorted| +% respectively in prototype version~2.0, but the macros should belong +% to the same capitalization class as |\IndexEntry| so their names +% were changed in prototype version~2.1. The old names |\levelsame| +% and |\levelsorted| will continue to work in \package{xdoc2}, though. +% \begin{macrocode} +%<*xdoc2> +\newcommand*\levelsame{\LevelSame} +\newcommand*\levelsorted{\LevelSorted} +%</xdoc2> +% \end{macrocode} +% \end{macro}\end{macro} +% +% \describecsfamily{XD@idxencap@\meta{encap}}^^A +% Macros in the family |\XD@idxencap@|\meta{encap} takes two +% arguments as follows +% \begin{quote} +% |\XD@idxencap@|\meta{encap}\,\marg{entry}\,\marg{thenumber} +% \end{quote} +% They should write an entry with the \meta{encap} encapsulation of the +% \meta{thenumber} to the index file. They need not check whether index +% generation is on or not, but they must be subject to the \LaTeX\ kernel +% \texttt{@filesw} switch. They must expand both arguments fully at the +% time of the command, with the exception for the control sequence +% |\thepage|, which should not be expanded until the page on which the +% write appears is output. Both these conditions are met if the macro +% is implemented using |\protected@write|. +% +% \begin{macro}{\XD@idxencap@none} +% \begin{macro}{\XD@idxencap@main} +% \begin{macro}{\XD@idxencap@usage} +% These macros implement the encapsulation schemes that are used in +% \package{doc}. +% \begin{macrocode} +\def\XD@idxencap@none#1#2{% + \protected@write\@indexfile{}{\XD@index@keyword{#1}{#2}}% +} +% \end{macrocode} +% \begin{macrocode} +\def\XD@idxencap@main#1#2{% + \protected@write\@indexfile{}% + {\XD@index@keyword{#1\encapchar main}{#2}}% +} +% \end{macrocode} +% \begin{macrocode} +\def\XD@idxencap@usage#1#2{% + \protected@write\@indexfile{}% + {\XD@index@keyword{#1\encapchar usage}{#2}}% +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\XD@index@keyword} +% \changes{prot2.2}{2001/02/13}{Macro added and \meta{encap} macros +% changed to use it. (LH)} +% The |\XD@index@keyword| is a hook for changing the index entry +% keyword (the text that is put in front of every index entry in the +% \texttt{.idx} file). It is changed by e.g.\ the \package{docindex} +% package~\cite{docindex}. +% \begin{macrocode} +\@ifundefined{XD@index@keyword}{% + \edef\XD@index@keyword{\@backslashchar indexentry}% +}{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\CodelineIndex} +% \changes{prot2.1}{2000/10/08}{Using \cs{thecodelineno}. (LH)} +% \begin{macro}{\PageIndex} +% \begin{macro}{\TheXDIndexNumber} +% The |\CodelineIndex| and |\PageIndex| commands do the same things as +% in \package{doc}, but work with the \package{xdoc} internals instead +% of the \package{doc} ones. |\TheXDIndexNumber| is used as +% \meta{thenumber} argument to |\IndexEntry| by all indexing commands +% that would have used |\special@index| in \package{doc}. +% \begin{macrocode} +\renewcommand\CodelineIndex{% + \makeindex + \let\XD@if@index=\@firstoftwo + \codeline@indextrue + \def\TheXDIndexNumber{\thecodelineno}% +} +% \end{macrocode} +% \begin{macrocode} +\renewcommand\PageIndex{% + \makeindex + \let\XD@if@index=\@firstoftwo + \codeline@indexfalse + \def\TheXDIndexNumber{\thepage}% +} +% \end{macrocode} +% \begin{macrocode} +\def\TheXDIndexNumber{??} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% \subsection{Making good sort keys} +% +% \changes{prot2.1}{2000/11/15}{Sort key making commands added. (LH)} +% A common nuisance in \package{doc} indices is that many macros are +% sorted by parts of the name that do not carry any interesting +% information. In the \LaTeX\ kernel many macro names begin with a +% silent |@|, whereas the names of private macros in many packages +% (including this one) begin with some fixed abbreviation of the +% package name. Since such prefixes usually are harder to remember than +% the rest of the macro name, it is not uncommon that the index position +% one thinks of first isn't the one where the macro actually is put. +% Hence a mechanism for removing such annoying prefixes from the macro +% names might be useful, and that is presicely what is defined below. +% +% The actual mechanism is based on having a set of macros called +% \emph{operators} which operate on the harmless character string that +% is to become the sort key. Each operator has a specific prefix string +% which it tries to match against the beginning of the to-be sort key, +% and if they match then the prefix is moved to the end of the sort key. +% Automatically constructed operators (see below) have names of the form +% \describecsfamily{XD@operatorA@\meta{prefix}}|\XD@operatorA@|^^A +% \meta{prefix}, but operators can be given arbitrary names. +% +% \begin{macro}{\XD@operators@list} +% The |\XD@operators@list| macro contains the list of all currently +% active operators. +% \begin{macrocode} +\let\XD@operators@list\@empty +% \end{macrocode} +% \end{macro} +% +% The operators do all their work at expand-time. When an operator +% macro is expanded, it is in the context +% \begin{quote} +% \meta{operator} \meta{subsequent operators} |\@firstofone| +% \meta{sort key text} |\@empty| +% \end{quote} +% There may not be any |\@empty|s or |\@firstofone|s amongst the +% \meta{subsequent operators} or in the \meta{sort key text}. This should +% expand to +% \begin{quote} +% \meta{subsequent operators} |\@firstofone| \meta{operated-on sort +% key text} |\@empty| +% \end{quote} +% The purpose of the |\@firstofone| after the \meta{subsequent +% operators} is to remove any spaces that some operator might have put +% in front of the sort key. This happens if the entire sort key text has +% been ignored by some operator. +% +% \begin{macro}{\MakeSortKey} +% The |\MakeSortKey| command is called to make the acutal sort key. +% The syntax of this command is +% \begin{quote} +% |\MakeSortKey|\marg{macro}\marg{text}\marg{extras} +% \end{quote} +% This locally defines \meta{macro} to be the sort key that the +% currently active operators manufacture from \meta{text}. The +% \meta{extras} argument can contain additional assignments needed for +% handling macros with special harmless forms, such as |\meta|. +% \begin{macrocode} +\newcommand\MakeSortKey[3]{% + \begingroup + \def\PrintChar{\string\PrintChar\XD@threedignum}% + #3% + \unrestored@protected@xdef\@gtempa{#2}% + \endgroup + \protected@edef#1{% + \expandafter\XD@operators@list \expandafter\@firstofone + \@gtempa\@empty + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\XD@make@operator} +% The |\XD@make@operator| macro takes a harmless character sequence as +% argument, constructs the corresponding operator, and returns the +% operator control sequence in the |\toks@| token list register. +% +% More precisely, given a harmless character string \meta{string}, +% |\XD@make@operator| will construct a sequence of other tokens +% \meta{text} from \meta{string} by replacing all |\PrintChar| +% commands in the same way as |\MakeSortKey| does. Then it defines the +% macro |\XD@operatorA@|\meta{text} to be +% \begin{quote} +% \raggedright \spaceskip=0.16666em +% \#1\,|\@firstofone|\,\#2\,|\@empty| \ $\rightarrow$ \ % +% |\XD@operatorB@|\meta{text} |\@firstofone| \#2 +% |\@firstofone| \meta{text} |\@firstofone| |\relax| \#1 |\@empty| +% \end{quote} +% and the macro |\XD@operatorB@|\meta{text} to do +% \begin{quote} +% \raggedright +% \#1\,|\@firstofone|\,\meta{text}\,\#2\,|\@firstofone|\,\#3\,^^A +% |\relax|\,\#4\,|\@empty| $\rightarrow$ +% \#4\,\( \left\{ \begin{array}{ll} +% \mbox{\cs{@firstofone}\,\#2\,\textvisiblespace\,\meta{text}\,^^A +% \cs{@empty}}& \mbox{if \#1 is empty}\\ +% \mbox{\#1\,\cs{@empty}}& \mbox{otherwise} +% \end{array} \right.\) +% \end{quote} +% +% \begin{macrocode} +\def\XD@make@operator#1{% + \begingroup + \def\PrintChar{\string\PrintChar\XD@threedignum}% + \let\protect\@gobble + \xdef\@gtempa{#1}% + \endgroup + \expandafter\edef \csname XD@operatorA@\@gtempa\endcsname + ##1\@firstofone##2\@empty{% + \expandafter\noexpand \csname XD@operatorB@\@gtempa\endcsname + \noexpand\@firstofone ##2\noexpand\@firstofone \@gtempa + \noexpand\@firstofone \relax##1\noexpand\@empty + }% + \expandafter\edef \csname XD@operatorB@\@gtempa \expandafter\endcsname + \expandafter##\expandafter1\expandafter\@firstofone \@gtempa + ##2\@firstofone##3\relax##4\@empty{% + \noexpand\ifx $##1$% + \noexpand\expandafter \noexpand\@firstoftwo + \noexpand\else + \noexpand\expandafter \noexpand\@secondoftwo + \noexpand\fi{% + ##4\noexpand\@firstofone ##2 \@gtempa + }{##4##1}% + \noexpand\@empty + }% + \toks@=\expandafter{\csname XD@operatorA@\@gtempa\endcsname}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DoNotIndexBy} +% The |\DoNotIndexBy| command has the syntax +% \begin{quote} +% |\DoNotIndexBy|\marg{morpheme} +% \end{quote} +% It causes the \meta{morpheme} to be put \emph{last} in the index +% sort key for each macro name which begins by \meta{morpheme}. This +% can be used to ignore e.g.\ ``silent'' |@|s at the beginning of a +% macro name. +% \begin{macrocode} +\newcommand\DoNotIndexBy[1]{% + \MakeHarmless\@tempa{#1}% + \XD@make@operator\@tempa + \expandafter\def \expandafter\XD@operators@list \expandafter{% + \the\expandafter\toks@ \XD@operators@list + }% +} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \subsection{Reimplementations of \package{doc} indexing commands} +% +% The \package{doc} indexing commands aren't that interesting in +% \package{xdoc}, since they take `raw' control sequences as +% arguments rather than the harmless strings that the \package{xdoc} +% commands will want to put in the index. But it can be instructive to +% see how they would be implemented in this context. +% +% \begin{macro}{\SortIndex} +% \changes{prot2.2}{2001/02/13}{Redefinition added. (LH)} +% The |\SortIndex| takes a sort key and an entry text as argument, and +% writes a one-level index entry for that. +% \begin{macrocode} +\renewcommand*\SortIndex[2]{% + \IndexEntry{\LevelSorted{#1}{#2}}{none}{\thepage}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\SpecialIndex} +% \begin{macro}{\SpecialMainIndex} +% \begin{macro}{\SpecialUsageIndex} +% The |\SpecialIndex|, |\SpecialMainIndex|, and |\SpecialUsageIndex| +% commands take a control sequence (or more often something which looks +% like a |\string|ed control sequence) as their only argument. The +% entry text is that item verbatim, and the initial backslash is +% ignored in sorting (|\Special|\-|Index| always ignores the first +% character regardless of whether it is a backslash or not, the other +% two checks first). |\Special|\-|Index| has \texttt{none} formatting, +% |\Special|\-|Main|\-|Index| has \texttt{main} formatting, and +% |\Special|\-|Usage|\-|Index| has \texttt{usage} formatting of the +% index number. +% +% Although these definitions will (or at least are supposed to) yield +% the same typeset results as the \package{doc} definitions in the +% mainstream cases, I doubt that they will do so in all cases. At any +% rate, they shouldn't perform worse. +% \begin{macrocode} +\renewcommand\SpecialIndex[1]{% + \expandafter\MakeHarmless \expandafter\@tempa + \expandafter{\string#1}% + \IndexEntry{% + \LevelSorted{% + \expandafter\XD@unbackslash \@tempa\@empty + }{\texttt{\@tempa}}% + }{none}{\TheXDIndexNumber}% +} +% \end{macrocode} +% \begin{macrocode} +\renewcommand\SpecialMainIndex[1]{% + \expandafter\MakeHarmless \expandafter\@tempa + \expandafter{\string#1}% + \IndexEntry{% + \LevelSorted{% + \expandafter\XD@unbackslash \@tempa\@empty + }{\texttt{\@tempa}}% + }{main}{\TheXDIndexNumber}% +} +% \end{macrocode} +% \begin{macrocode} +\renewcommand\SpecialUsageIndex[1]{% + \expandafter\MakeHarmless \expandafter\@tempa + \expandafter{\string#1}% + \IndexEntry{% + \LevelSorted{% + \expandafter\XD@unbackslash \@tempa\@empty + }{\texttt{\@tempa}}% + }{usage}{\thepage}% +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\XD@unbackslash} +% \begin{macro}{\XD@unbackslash@} +% |\XD@unbackslash| is a utility macro which removes the first +% character from a harmless character string if that character is a +% backslash (i.e., if it is |\PrintChar{92}|). The \package{doc} +% commands have traditionally used |\@gobble| for doing this, but the +% \cs{@SpecialIndexHelper@} macro that was comparatively recently added +% tries to do better. +% \begin{macrocode} +\def\XD@unbackslash#1{% + \ifx \PrintChar#1% + \expandafter\XD@unbackslash@ + \else + \expandafter#1% + \fi +} +\def\XD@unbackslash@#1{\ifnum #1=92 \else \PrintChar{#1}\fi} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\SpecialMainEnvIndex} +% \begin{macro}{\SpecialEnvIndex} +% These are similar to the above, but \package{doc} thinks that the +% arguments don't need any special care, and it produces two index +% entries per command. |\Special|\-|Env|\-|Index| should really have +% been called |\Special|\-|Usage|\-|Env|\-|Index|. +% \begin{macrocode} +\renewcommand\SpecialMainEnvIndex[1]{% + \IndexEntry{\LevelSorted{#1}{\texttt{#1} (environment)}}{main}% + {\TheXDIndexNumber}% + \IndexEntry{\LevelSame{environments:}\LevelSorted{#1}{\texttt{#1}}}% + {main}{\TheXDIndexNumber}% +} +% \end{macrocode} +% \begin{macrocode} +\renewcommand\SpecialEnvIndex[1]{% + \IndexEntry{\LevelSorted{#1}{\texttt{#1} (environment)}}{usage}% + {\thepage}% + \IndexEntry{\LevelSame{environments:}\LevelSorted{#1}{\texttt{#1}}}% + {usage}{\thepage}% +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\it@is@a} +% \begin{macro}{\XD@special@index} +% The |\it@is@a| macro is a specialized version of |\SpecialIndex|, +% but the format of its argument is quite different. After full +% expansion the argument will become a single category 12 token +% (\meta{t}, say), and the control sequence for which an entry should +% be made is |\|\meta{t}. \package{doc} uses |\it@is@a| for control +% sequences with one-character names. Note: The following +% definition should really have special code for the \Module{economical} +% \package{docstrip} module, but I don't think that is necessary +% since the \package{doc} macros which used |\it@is@a| will be +% redefined so that they don't. +% +% |\XD@special@index| does the same thing as |\SpecialIndex|, but it +% does it with \package{xdoc} datatypes---the argument must be a +% harmless character string that does not include the initial escape +% (backslash). +% \changes{prot2.1}{2000/11/15}{Using \cs{MakeSortKey} to make the +% sort key. (LH)} +% \begin{macrocode} +\def\it@is@a#1{% + \edef\@tempa{#1}% + \XD@special@index{\csname XD@harmless@\number + \expandafter`\@tempa\endcsname}% +} +% \end{macrocode} +% \begin{macrocode} +\def\XD@special@index#1{% + \MakeSortKey\@tempa{#1}{}% + \IndexEntry{\LevelSorted{\@tempa}{\texttt{\Bslash#1}}}{none}% + {\TheXDIndexNumber}% +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\LeftBraceIndex} +% \begin{macro}{\RightBraceIndex} +% \begin{macro}{\PercentIndex} +% \begin{macro}{\OldMakeIndex} +% More specialised forms of |\SpecialIndex|. The |\OldMakeIndex| +% command can safely be made a no-op. +% \begin{macrocode} +\renewcommand\LeftBraceIndex{\XD@special@index{\PrintChar{123}}} +\renewcommand\RightBraceIndex{\XD@special@index{\PrintChar{125}}} +\renewcommand\PercentIndex{\XD@special@index{\PrintChar{37}}} +\let\OldMakeIndex\relax +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\@wrindex} +% \changes{prot2.2}{2001/02/13}{Redefinition added. (LH)} +% Finally, while we're at redefining indexing commands, let's redefine +% |\@wrindex| as well to ensure that the index entry keyword is the +% same for all indexing commands. +% \begin{macrocode} +\def\@wrindex#1{% + \protected@write\@indexfile{}{\XD@index@keyword{#1}{\thepage}}% + \endgroup + \@esphack +} +% \end{macrocode} +% \end{macro} +% +% +% \section{Cross-referencing} +% +% \subsection{Scanning \texttt{macrocode} for \TeX\ control sequences} +% \label{Ssec:Scanning macrocode} +% +% The cross-referencing mechanism in \package{doc} isn't problematic in +% the same way as the indexing mechanism is, so one could pretty much +% leave it as it is, but there are things that are better done +% differently when the basic indexing commands are based on harmless +% character strings. Rather than storing control sequence names (without +% escape character) as sequences of category 11 tokens, they will be +% stored as the equivalent harmless character strings. +% +% \begin{macro}{\macro@switch} +% As in \package{doc}, |\macro@switch| determines whether the control +% sequence name that follows consists of letters (call |\macro@name|) +% or a single non-letter (call |\short@macro|). Unlike \package{doc}, +% \package{xdoc} accumulates the characters from a multiple-letter +% control sequence name in a token register (|\@toks|), which is why +% that is cleared here. +% \begin{macrocode} +\def\macro@switch{% + \ifcat\noexpand\next a% + \toks@={}% + \expandafter\macro@name + \else + \expandafter\short@macro + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\scan@macro} +% Since |\macro@namepart| isn't used as in \package{doc}, I might as +% well remove the command that cleared it from |\scan@macro|. +% \begin{macrocode} +\def\scan@macro{% + \special@escape@char + \step@checksum + \ifscan@allowed + \def\next{\futurelet\next\macro@switch}% + \else \let\next\@empty \fi + \next} +% \end{macrocode} +% \end{macro} +% +% +% +% \begin{macro}{\short@macro} +% This macro will be invoked (with a single character as parameter) +% when a single-character macro name has been spotted whilst +% scanning within the \texttt{macrocode} environment. It will produce +% an index entry for that macro, unless that macro has been excluded +% from indexing, and it will also typeset the character that +% constitutes the name of the macro. +% \begin{macrocode} +\def\short@macro#1{% + \protected@edef\macro@namepart{% +%<*economical> + \ifnum `#1<\@xxxii + \noexpand\PrintChar{\number`#1}% + \else\ifnum `#1>126 + \noexpand\PrintChar{\number`#1}% + \else +%</economical> + \csname XD@harmless@\number`#1\endcsname +%<economical> \fi\fi + }% + \ifnot@excluded \XD@special@index{\macro@namepart}\fi +% \end{macrocode} +% The cross-referencing mechanism is disabled for when the actual +% character is printed, as it could be the escape character. The index +% entry must be generated before the character is printed to ensure +% that no page break intervenes (recall that a |^^M| will start a new +% line). +% \begin{macrocode} + \scan@allowedfalse #1\scan@allowedtrue +} +% \end{macrocode} +% \end{macro} +% +% There is one mechanism in |\TeX|'s control sequence tokenization that +% |\short@|\B|macro| doesn't cover, and that is the |^^| sequence +% substitution---|\^^M| is (with default catcodes) seen as the three +% tokens |\^|, |^|, and |M|, not as the single control +% sequence token that \TeX\ will make out of it. But this is the way it +% is done in \package{doc}. +% +% +% \begin{macro}{\macro@name} +% \begin{macro}{\more@macroname} +% \begin{macro}{\macro@finish} +% Then there's the macros for assembling a control sequence name which +% consists of one or more letters (category 11 tokens). (This includes +% both the characters which are normally letters in the document and +% those that are made letters by |\MakePrivateLetters|.) They're +% pretty straightforward. +% \begin{macrocode} +\def\macro@name#1{% +%<*economical> + \if \ifnum `#1<\@xxxii 1\else \ifnum `#1>126 1\else 0\fi\fi 1% + \toks@=\expandafter{\the\expandafter\toks@ + \expandafter\PrintChar \expandafter{\number`#1}% + }% + \else +%</economical> + \toks@=\expandafter{\the\expandafter\expandafter\expandafter\toks@ + \csname XD@harmless@\number`#1\endcsname}% +%<economical> \fi + \futurelet\next\more@macroname} +% \end{macrocode} +% \begin{macrocode} +\def\more@macroname{% + \ifcat\noexpand\next a% + \expandafter\macro@name + \else + \macro@finish + \fi +} +% \end{macrocode} +% \begin{macrocode} +\def\macro@finish{% + \edef\macro@namepart{\the\toks@}% + \ifnot@excluded \XD@special@index{\macro@namepart}\fi + \macro@namepart +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% +% \subsection{The index exclude list} +% \label{Ssec:Index-exclude} +% +% The index exclude list mechanisms are not quite as simple to convert +% for use with harmless character strings as the construction of macro +% names are. This is because the trick used for searching the exclude +% list for a certain string doesn't work if the string one is looking +% for contains tokens with category 1 or 2 (beginning and end of group), +% as the \meta{parameter text} of a |\def| cannot contain such tokens. +% On the other hand the only groups that can appear in the harmless +% character strings one will be looking for are the ones around the +% argument of some |\PrintChar|, and these can easily be converted to +% something else. Therefore an item in the index exclude list of +% \package{xdoc} will have the format +% \begin{quote} +% |\do|\,\meta{string} +% \end{quote} +% where the \meta{string} is different from a harmless character string +% only in that all |\PrintChar|\marg{num} have been replaced by +% |\PrintChar|\parg{num}. The \meta{string} does not include an escape +% character. The |\do| serves only to separate the item from the one +% before, but it could in principle be used for other purposes as well +% (such as in typesetting the entire exclude list). +% +% \begin{macro}{\XD@paren@PrintChar} +% |\XD@paren@PrintChar| is a definition of |\PrintChar| which, when it +% is used in an |\edef|, merely replaces the group around the argument +% by a parenthesis and normalizes the number in the argument. +% \changes{prot2.1}{2000/09/16}{\cs{number} added. (LH)} +% \begin{macrocode} +\def\XD@paren@PrintChar#1{\noexpand\PrintChar(\number#1)} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DoNotIndex} +% \changes{prot2.1}{2000/09/16}{Also changing catcode of \%. (LH)} +% \begin{macro}{\do@not@index} +% \begin{macro}{\XD@do@not@index} +% These are the macros which add elements to the index exclude list. +% |\DoNotIndex| is pretty much as in \package{doc}, but I have added +% resetting of the catcodes of `|,|' (since |\XD@do@not@index| relies +% on it) and `|#|' (since it can otherwise mess things up for the +% |\def\@tempa| in |\do@not@index|). +% \begin{macrocode} +\renewcommand\DoNotIndex{% + \begingroup + \MakePrivateLetters + \catcode`\#=12\catcode`\\=12\catcode`,=12\catcode`\%=12 + \expandafter\endgroup \do@not@index +} +% \end{macrocode} +% +% |\do@not@index|, on the other hand, is quite different, as it more +% or less has to convert the argument from the format used in +% \package{doc} to that of \package{xdoc}. The bulk of the work is +% done by |\XD@do@not@index|, which grabs one of the elements in the +% argument of |\do@not@index| and converts it (minus the initial +% backslash) to a harmless character string. That harmless character +% string is then converted by |\XD@paren@PrintChar|, so that the +% string can be searched for using |\expanded@notin|. +% +% The reason for using a special loop structure here, as opposed to +% using for example |\@for|, is that one cannot use either of |\| +% or |,| alone as item separators, as they may both be part of control +% sequence names (consider for example |\DoNotIndex{\a,\\,\b,\,,\c}|), +% but they should be sufficient when combined. +% +% The reason for storing new elements in |\toks@| until the end of +% the loop and only then inserting them into the index exclude list +% is speed; the index exclude list can get rather large, so you don't +% want to expand it more often than you have to. I don't know if the +% difference is noticeable, though. +% \begin{macrocode} +\begingroup + \catcode`\|=0 + \catcode`\,=12 + \catcode`\\=12 +% \end{macrocode} +% \SpecialEscapechar{\|} +% \begin{macrocode} + |gdef|do@not@index#1{% + |def|@tempa{#1}% + |ifx |@empty|@tempa |else + |toks@={}% + |expandafter|XD@do@not@index |@gobble #1,\|XD@do@not@index,\% + |fi + } + |gdef|XD@do@not@index#1,\{% + |ifx |XD@do@not@index#1% + |index@excludelist=|expandafter{% + |the|expandafter|index@excludelist |the|toks@ + }% + |expandafter|@gobble + |else + |MakeHarmless|@tempa{#1}% + |begingroup + |let|PrintChar|XD@paren@PrintChar + |unrestored@protected@xdef|@gtempa{|noexpand|do|@tempa}% + |endgroup + |toks@=|expandafter{|the|expandafter|toks@ |@gtempa}% + |fi + |XD@do@not@index + } +|endgroup +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\DoNotIndexHarmless} +% The |\DoNotIndexHarmless| command takes a harmless character string +% as argument and locally adds the control sequence whose name is that +% character string to the index exclude list. +% \begin{macrocode} +\newcommand\DoNotIndexHarmless[1]{% + \begingroup + \let\PrintChar\XD@paren@PrintChar + \unrestored@protected@xdef\@gtempa{\noexpand\do#1}% + \endgroup + \index@excludelist=\expandafter{% + \the\expandafter\index@excludelist \@gtempa + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\index@excludelist} +% In case the index exclude list is not empty, its contents are +% converted to \package{xdoc} format. +% \begin{macrocode} +\edef\@tempa{\the\index@excludelist} +\index@excludelist{} +\ifx \@tempa\@empty \else + \def\@tempb#1,\@nil{\do@not@index{#1}} + \expandafter\@tempb \@tempa \@nil + \let\@tempa\@empty + \let\@tempb\@empty +\fi +% \end{macrocode} +% The fact that the |\XD@|\B|harmless@|\B\meta{code} table has not +% yet reached its final form means that some of these control sequences +% listed in the exclude list might get a different form here than they +% actually should, but there isn't much that can be done about that. It +% is furthermore unusual that control sequence are given such names +% that they would be affected by this. +% \end{macro} +% +% \begin{macro}{\ifnot@excluded} +% The |\ifnot@excluded| macro ultimately boils down to an +% \texttt{if}, which evaluates to true if and only if the string in +% |\macro@namepart| is not one of the items in the index exclude +% list. Before |\expanded@notin| gets to carry out the actual test, +% the |\PrintChar| calls in |\macro@namepart| are converted by +% |\XD@paren@PrintChar| (it's OK to use an unprotected |\edef| for +% this, since |\PrintChar| is the only control sequence that can +% appear in |\macro@namepart|) so that |\expanded@notin| can be used +% to test for its presence. +% \begin{macrocode} +\def\ifnot@excluded{% + \begingroup + \let\PrintChar\XD@paren@PrintChar + \edef\@tempa{\macro@namepart}% + \expandafter\endgroup \expandafter\expanded@notin + \expandafter{\expandafter\do \@tempa\do}% + {\the\index@excludelist}% +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{External cross-referencing} +% \label{Ssec:XXR} +% +% (This subsection is a bit speculatory, but I think the structures it +% describes may come in handy.) +% +% \changes{prot2}{2000/07/31}{I finally decided that it would be better +% to make the XXR-commands look like comments to \TeX. (LH)} +% +% It's rather easy to write macros for scanning \TeX\ code for the names +% of control sequences---just look for the escape (category 0) +% character, and whatever follows is the name of a control sequence. +% Doing the same thing for other languages may lay anywhere between +% ``a~tricky exercise in advanced \TeX\ programming'' and ``possible in +% theory'',\footnote{I.e., you know it can be implemented as a computer +% program (in some language), you know that any computer program can be +% translated to a Turing machine (or if you prefer that, expressed in +% lambda calculus), and you know that a Turing machine can be emulated +% by \TeX, but that's the closest thing to a solution you've managed to +% come up with.} but in most cases the available solutions turn out to be +% too complicated and\slash or slow to be of practical use. When that +% happens, one might instead want to use some external piece of software +% for doing the cross-referencing. +% +% The commands in this subsection implement basic support for such an +% external cross-referencing program (or XXR,\footnote{Maybe not the +% most logical name, but it looks much cooler than ECR.} for short). The +% idea is that an XXR should communicate with \LaTeX\ like \BibTeX\ +% does---scan the \texttt{.aux} file (or files, if we're |\include|ing +% things) for certain ``commands'' and use them to locate the files to +% cross-reference, get parameter settings (like for example entries for +% the index exclude list), and so on. It should then cross-reference the +% file(s) and write the index entries in a suitable format to some file +% (appending them to the \texttt{.idx} file is probably the easiest +% solution). This way, it is (almost) as simple to use as the built-in +% cross-referencing and the extra work for supporting it is (in +% comparison to not supporting it) negligible. +% +% \begin{xrefcmd}{ExternalXRefMsg} +% \begin{macro}{\SendExternalXRefMsg} +% \changes{prot2}{2000/07/28}{Added \cs{if@filesw} test. (LH)} +% It's hardly possible to predict all kinds of information that one +% might want to give to an XXR, and neither can one assume that +% there is only one XXR program that will read the \texttt{.aux} +% file. A complicated project might involve code in several languages, +% and each language might have its own XXR. +% Therefore the general XXR-command (text in an \texttt{.aux} file which +% is used for communicating information to an XXR) simply has the syntax +% \begin{quote} +% \verb*|%%ExternalXRefMsg |\marg{who}\verb*| |\marg{what} +% \end{quote} +% \meta{who} identifies the XXR this message is meant for. It must be +% balanced text to \TeX\ and may not contain any whitespace, but can +% otherwise be rather arbitrary. \meta{what} is the actual message. It +% too must be balanced text to \TeX\ and it may not contain any +% newlines, but it is otherwise arbitrary. +% \index{whitespace restrictions}^^A +% The reason for these restrictions on the contents of \meta{who} and +% \meta{what} is that many (maybe even most) scripting languages +% (which is what at least the \texttt{.aux}-scanning part of an +% XXR will probably be written in) are much better at recognising +% words on a line than they are at recognising a brace-delimited group. +% By accepting these restrictions, one can make sure that all XXRs can +% correctly determine whether a message is for them, even if they see +% the \texttt{.aux} file as a sequence of lines composed of +% whitespace-delimited words. +% +% |\SendExternalXRefMsg| is the basic command for writing +% |ExternalXRefMsg|s to the \texttt{.aux} file, but it might be +% recommendable that XXR writers provide users with a set of commands +% that have more specific purposes. The syntax of the +% |\Send|\-|External|\-|XRef|\-|Msg| command is (hardly surprising) +% \begin{quote} +% |\SendExternalXRefMsg|\marg{who}\marg{what} +% \end{quote} +% |\SendExternalXRefMsg| does a protected full expansion (like +% |\protected@edef|) of its arguments at the time it is called. +% \begin{macrocode} +\newcommand\SendExternalXRefMsg[2]{% + \begingroup + \if@filesw + \let\protect\@unexpandable@protect + \immediate\write\@auxout{\@percentchar\@percentchar + ExternalXRefMsg {#1} {#2}}% + \fi + \endgroup +} +% \end{macrocode} +% \end{macro}\end{xrefcmd} +% +% The remaining commands in this subsection address complications that +% exist because of how \texttt{.dtx} files are generally written, and +% thus constitutes difficulties that all XXRs will have to face. +% +% \begin{xrefcmd}{ExternalXRefFile} +% The usual way to write \texttt{.dtx} files is to include a +% driver---a~short piece of uncommented \LaTeX\ code which contains +% the necessary preamble material and a document body which mainly +% contains a |\DocInput| for the \texttt{.dtx} file itself---but it +% is also usually understood that this driver may be copied to another +% file if necessary and larger projects usually have a completely +% separate driver file. Therefore an XXR cannot be expected to be +% able to find the file(s) to cross-reference simply by changing +% suffix on the name of the \texttt{.aux} file it reads its commands +% from. A more intricate method must be used. +% +% To tell the XXR that ``here I input the file \dots'', one includes +% an |External|\-|XRef|\-|File| XXR-command in the \texttt{.aux} file. +% Its syntax is +% \begin{quote} +% \verb*|%%ExternalXRefFile |\marg{cmd}\verb*| |\marg{file}^^A +% \verb*| |\marg{what} +% \end{quote} +% \meta{file} is the name (as given to |\input| or the like) of the +% file to input. \meta{cmd} is either \texttt{begin} (begin of +% \meta{file}) or \texttt{end} (end of \meta{file}). \meta{what} is a +% declaration of what is in the file; XXRs should use it to determine +% whether they should process this file or not. \meta{what} is empty +% if all XXRs should process the file, but for example |\IndexInput| +% will put \texttt{TeX} here to declare that the contents of this file +% are \TeX\ code and only XXRs that cross-reference \TeX\ code need to +% process this file. +% +% In connection to this, it should be mentioned that XXRs must also look +% for (and act on) |\@input|\penalty\hyphenpenalty\marg{auxfile} commands +% that |\include| or |\DocInclude| has written to the \texttt{.aux} file, +% since these \meta{auxfile}s can also contain commands for the XXR +% that should result in output to the same \texttt{.idx} file. In +% particular, the |ExternalXRefFile| XXR-commands that are written +% because of a |\DocInclude| will be written to such an \meta{auxfile}. +% \end{xrefcmd} +% +% \begin{xrefcmd}{ExternalXRefSync} +% Most XXRs will probably find it an unreasonable task to keep exact +% track of all codelines in all documents, i.e., they will sometimes +% think that a piece of code contains more or fewer numbered +% codelines than it actually does. If for example a document contains +% code such as\iffalse +%<*example> +% \fi +%\begin{verbatim} +%% \iffalse +%% \begin{macrocode} +%Etaoin Shrldu +%% \end{macrocode} +%% \fi +%\end{verbatim}\iffalse +%</example> +%\fi +% then all reasonable XXRs will probably be fooled into thinking that +% the \texttt{Etaoin Shrldu} line is a numbered codeline. This would +% of course be very bad if an XXR thought it should cross-reference +% the contents of this line, but that shouldn't usually be a problem +% since the specifications\footnote{I imagine these specifications +% will consist of a list of \package{docstrip} options (modules), +% possibly used in combination with restrictions on the names of +% surrounding environments.} of what code should be cross-referenced +% will probably make it clear that the above line should not be +% cross-referenced. Code such as the above will still be problematic +% however, as it will cause the XXR to believe that the +% \texttt{codelineno} counter has another value on any following +% line that is indexed than it actually has in the typeset +% document. This will cause index entries to refer to another line +% than it actually should. +% +% To overcome this, the |ExternalXRefSync| XXR-command can be used to +% tell the XXR what the corresponding values of |\inputlineno| and +% \texttt{codelineno} are. Its syntax is +% \begin{quote} +% \verb*|%%ExternalXRefSync |\marg{inputlineno}\verb*| |^^A +% \marg{codelineno} +% \end{quote} +% where \meta{inputlineno} is the expansion of |\the\inputlineno| and +% \meta{codelineno} is the expansion of |\thecodelineno|, both +% expanded at the same point in the program. Note here that the first +% line of a file is line number 1, that line number 0 is used to +% denote ``just before the first line'', and that \texttt{codelineno} +% gets increased immediately before the number is typeset (i.e., +% \texttt{codelineno} contains the number of the last numbered +% codeline). +% \end{xrefcmd} +% +% This doesn't support external cross-referencing by pages, since doing +% that requires that the document outputs a lot more information to the +% \texttt{.aux} file. In principle, one could put a |\mark|\penalty0 +% |{\thecodelineno}| in |\PrintCodelineNo| and a |\write| in the page +% header which outputs to the \texttt{.aux} file which range of +% codelines correspond to a given page, but the \LaTeXe\ sectioning +% commands' use of marks tends to interfere with this. The \LaTeXplus\ +% package \package{xmarks} will probably solve that problem, though. +% +% \begin{macro}{\syncexternalxref} +% \changes{prot2}{2000/07/28}{New name for \cs{SendExternalXRefSync}. +% Also added \cs{if@filesw} test. (LH)} +% ^^A Johann Sebastian Bach: 1685/03/21--1750/07/28 +% The |\syncexternalxref| command writes an |ExternalXRefSync| +% XXR-command for the current line number and value of the +% \texttt{codelineno} counter to \texttt{.aux} file. It is used for +% synchronizing the numbered codeline counter that an XXR maintains with +% the \texttt{codelineno} counter that is used for numbering codelines +% in the typeset document after a piece of code in the document that +% some XXR is likely to misinterpret. |\sync|\-|external|\-|xref| +% shouldn't be used inside \texttt{macrocode} environments (or the +% like) as they tend to read ahead in the file---instead it is best +% placed shortly after such an environment. |\sync|\-|external|\-|xref| +% has no arguments. +% \begin{macrocode} +\newcommand\syncexternalxref{% + \if@filesw + \immediate\write\@auxout{\@percentchar\@percentchar + ExternalXRefSync {\the\inputlineno} {\thecodelineno}% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{xrefcmd}{ExternalXRefWrap} +% The |\DocInclude| command complicates matters for XXRs by redefining +% things so that the \texttt{codelineno} counter only makes up a part +% of the line numbers appearing in the index. The purpose of the +% |External|\-|XRef|\-|Wrap| XXR-command is to inform XXRs about such +% changes. The command +% \begin{quote} +% \verb*|%%ExternalXRefWrap {|\meta{prefix}\verb*|} {|^^A +% \meta{suffix}|}| +% \end{quote} +% means that codeline numbers written to the index should have the form +% \begin{quote} +% \meta{prefix}\meta{codelineno}\meta{suffix} +% \end{quote} +% This setting takes effect from the next |External|\-|XRef|\-|Sync| +% and stays in effect until the end of the document or until another +% |External|\-|XRef|\-|Wrap| overrides it. The state at the beginning +% of the document is to have both \meta{prefix} and \meta{suffix} +% empty. +% \end{xrefcmd} +% +% +% \begin{macro}{\XD@input} +% The |\XD@input| command is a version of |\input| which takes care +% to inform XXRs that another file is being |\input|ted. Its syntax is +% \begin{quote} +% |\XD@input|\marg{file}\marg{what} +% \end{quote} +% where \meta{file} is the name of the file to |\input| and \meta{what} +% is the contents of the file, as specified in +% |External|\-|XRef|\-|File| commands. +% \begin{macrocode} +\def\XD@input#1#2{% + \if@filesw + \immediate\write\@auxout{\@percentchar\@percentchar + ExternalXRefFile {begin} {#1} {#2}% + }% + \immediate\write\@auxout{\@percentchar\@percentchar + ExternalXRefSync {0} {\thecodelineno}% + }% + \fi + \input{#1}% + \if@filesw + \immediate\write\@auxout{\@percentchar\@percentchar + ExternalXRefFile {end} {#1} {#2}% + }% + \immediate\write\@auxout{\@percentchar\@percentchar + ExternalXRefSync {\the\inputlineno} {\thecodelineno}% + }% + \fi +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DocInput} +% The |\DocInput| command is redefined so that it writes +% |External|\-|XRef|\-|File| and |External|\-|XRef|\-|Sync| XXR-commands +% to the \texttt{.aux} file. Furthermore, with \package{xdoc} one +% should always use the |\DocInput| command (or some command based on +% it, like |\DocInclude|) for inputting a file where percent is an +% `ignore' character---even when one such file inputs another. (Doing +% that didn't work with the \package{doc} definition, as it always +% called |\MakePercentComment| upon return, but the \package{xdoc} +% definition contains code for dealing with that.) +% \begin{macrocode} +\renewcommand\DocInput[1]{% + \relax + \ifnum \catcode`\%=14 + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi{% + \MakePercentIgnore\XD@input{#1}{}\MakePercentComment + }{\XD@input{#1}{}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IndexInput} +% The |\IndexInput| command also needs to be redefined to write +% XXR-commands to the \texttt{.aux} file. It would +% probably be enough here to write an |External|\-|XRef|\-|Sync| +% after the file has been |\input| since no external +% cross-referencing of |\IndexInput|ted files is needed, but I do the +% more verbose variant here just to exemplify how these things would +% look for other languages. +% \begin{macrocode} +\renewcommand\IndexInput[1]{% + \begingroup + \macro@code + \frenchspacing + \@vobeyspaces + \XD@input{#1}{TeX}% + \endmacrocode + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% +% +% \section{Two-sided printing} +% \label{Sec:Twoside} +% +% The main problem one faces when reimplementing \package{doc} so that +% the marginal material always appears in the outer margin in two-sided +% documents is that the justification of \package{doc}'s marginal +% material is asymmetric; it always extends outwards. This means that +% the justification to use when typesetting the marginal material must +% depend on whether it is to be put on a left or a right +% page---something which cannot be determined for sure when the +% material is typeset! This is a minor difficulty if the marginal material +% is put in place using \LaTeX's |\marginpar| command, as that allows the +% user to supply different versions of the marginal paragraph for left and +% right margin placements. It is however a major difficulty if the +% marginal material is displaced out into the margin from within the main +% galley (like the \texttt{macro} environment of \package{doc} does), +% since the output routine is never involved. +% +% Even though this difficulty provides arguments for using a |\marginpar| +% mechanism for all text that is put in the margin, that will not be +% done in \package{xdoc} (but maybe it will in some successor). +% Instead \package{xdoc} contains a general mechanism which uses data +% written to the \texttt{.aux} file for determining whether a piece of +% text was put on an odd or even numbered page the \emph{last} time the +% document was typeset. By the usual convergence of page breaks in a +% \LaTeX\ document, this will eventually produce a typeset document +% with the marginal material consistently in the outer margin. +% +% The mechanism works as follows. The places in the document (the +% document source) at which it is necessary to determine whether +% something is going to appear on an even (left) or an odd (right) page +% are called ``page situations''\footnote{I know it's not a particularly +% good name. Suggestions for better names are gracefully accepted.} or +% just ``situations''. In each situation, a relatively simple test (is +% the \texttt{page} counter currently even or odd?) which is right more +% often than not is used as a first guess, and both the guess, the +% placement actually used, and the correct answer (determined from the +% value of \texttt{page} when the piece of text is shipped out) are +% recorded in the \texttt{.aux} file. If the guess (for the current +% situation) coincided with the correct answer the last time the +% document was typeset then the guess determined now is used, otherwise +% the opposite of the guess determined now is used. Finally, when at +% |\end{document}| the \texttt{.aux} file is inputted to check for +% changed labels, the placements used are also checked and the user is +% given a suitable warning if there was an incorrect one. +% +% \begin{macro}{\IfOddPageSituation} +% The |\IfOddPageSituation| macro is the user level test for whether +% the current page situation appears on an odd or an even page. It +% has the syntax +% \begin{quote} +% |\IfOddPageSituation|\marg{odd}\marg{even} +% \end{quote} +% and this will expand to \meta{odd} if the current situation is +% expected to end up on an odd page (based on how correct it was to +% look at the value of \texttt{page} last time) and to \meta{even} +% otherwise. In single-sided mode, it always expands to \meta{even}. +% In two-sided mode, |\IfOddPageSituation| is redefined for the new +% situation each time |\StepPageSituation| is called. +% \begin{macrocode} +\let\IfOddPageSituation=\@secondoftwo +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\StepPageSituation} +% \changes{prot2.1}{2000/12/19}{Now also setting +% \cs{IfOddPageSituation}, instead of having that macro performing +% the test each time it is used. This fixes a rarely occuring bug +% which occurs when a page is shipped out between +% \cs{StepPageSituation} and a corresponding +% \cs{IfOddPageSituation}. (LH)} +% \begin{macro}{\macro@cnt} +% \begin{macro}{\XD@next@wrong} +% \begin{macro}{\XD@wrongs@list} +% The |\StepPageSituation| command is called to inform the page +% situation mechanism that a new situation has begun. The rule for +% when you need to use |\Step|\-|Page|\-|Situation| is simple: if you +% use |\IfOdd|\-|Page|\-|Situation| in two places which may end up on +% different pages, then there must be a |\Step|\-|Page|\-|Situation| +% between them. There is no code which automatically calls +% |\Step|\-|Page|\-|Situation|---not even |\clearpage| or other +% macros which force page breaks do this---hence macros which use +% the page situation mechanism must always call |\Step|\-|Page|\-^^A +% |Situation| explicitly when a new situation begins. +% +% Since the |\macro@cnt| count register isn't used for stacking +% marginal headings (``macro'' names) anymore (see below), it is +% employed for enumerating page situation. |\XD@next@wrong| is a macro +% which contains the number of the next situation in which the guess +% was wrong last time. Unless |\XD@next@wrong|${}={}$|\macro@cnt|, the +% guess was right last time. All assignments to |\macro@cnt| and +% |\XD@next@wrong| are global. +% +% |\XD@wrongs@list| is a list of all the wrong guesses. It has the +% syntax +% \begin{quote} +% |\@elt|\marg{guess no.}|\@elt|\marg{guess no.}\dots +% |\@elt|\marg{guess no.} +% \end{quote} +% where the \meta{guess no.}s are the numbers of the wrong guesses, in +% increasing order. The contents of |\XD@wrongs@list| are collected +% when the \texttt{.aux} file is inputted at |\begin|\B|{document}|, +% and they are removed again as \TeX\ passes the situation in the +% document that they apply to. All assignments to |\XD@wrong@list| are +% global. +% +% Calling |\StepPageSituation| increases |\macro@cnt| by one, +% updates |\XD@|\B|next@|\B|wrong| and |\XD@|\B|wrong@|\B|list| +% appropriately, and sets |\IfOdd|\B|Page|\B|Situation| to +% |\@firstoftwo| or |\@secondoftwo| (whichever is correct for this +% situation). |\@next| is a list management macro from the \LaTeX\ +% kernel. +% \begin{macrocode} +\if@twoside + \def\StepPageSituation{% + \global\advance \macro@cnt \@ne + \ifnum \XD@next@wrong<\macro@cnt + \global\@next\XD@next@wrong\XD@wrongs@list{}{% + \let\XD@next@wrong\maxdimen + }% + \fi + \ifnum \ifodd\c@page -\fi \@ne=% + \ifnum \XD@next@wrong=\macro@cnt -\fi \@ne + \global\let\IfOddPageSituation\@secondoftwo + \else + \global\let\IfOddPageSituation\@firstoftwo + \fi + } + \def\XD@next@wrong{-\maxdimen} + \let\XD@wrongs@list\@empty +\else + \let\StepPageSituation=\relax +\fi +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% +% \begin{macro}{\RecordPageSituation} +% The |\RecordPageSituation| command generates a |\write| whatsit node +% which records the outcome of the current page situation. It is the +% location of this whatsit node that determines on which page a +% certain situation is considered to occur. If you don't execute this +% macro for a certain page situation, the first guess will always be +% used for that situation and no warnings will be given if that guess +% is incorrect. In single-sided mode, this is a no-op (thus you should +% better place it somewhere where it doesn't affect spacing). +% Furthermore you must make sure that \TeX\ does not change the value +% of the \texttt{page} counter between a |\StepPageSituation| and its +% corresponding |\RecordPageSituation|, since the |\ifodd| test must +% yield the same result in both cases. +% +% \begin{macrocode} +\if@twoside + \def\RecordPageSituation{% + \if@filesw + \edef\@tempa{% + \string\XD@situation{\the\macro@cnt}{% + \ifodd\c@page 1\else 0\fi + }{\IfOddPageSituation{1}{0}}% + }% + \write\@auxout\expandafter{\@tempa{\ifodd\c@page 1\else 0\fi}}% + \fi + }% +\else + \let\RecordPageSituation=\relax +\fi +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\XD@situation} +% \changes{prot2}{2000/07/13}{Changed to allow multiple +% \cs{XD@situation} commands for the same situation. This is +% necessary for coping with documents which \cs{include} files. (LH)} +% \changes{prot2}{2000/07/26}{Made redefinition at begin document +% global. (LH)} +% \begin{macro}{\XD@check@situation} +% |\XD@situation| is the command that will be written to the +% \texttt{.aux} file with the data about how the situation turned out. +% Its syntax is +% \begin{quote} +% |\XD@situation|\marg{number}\marg{guess}\marg{did}\marg{correct} +% \end{quote} +% where \meta{number} is the number of the situation, and +% \meta{guess}, \meta{did}, and \meta{correct} describe what the +% guess, the actual action done, and what the correct action to do +% respectively was. \meta{guess}, \meta{did}, and \meta{correct} are +% either |0| (denoting even page) or |1| (denoting odd page). +% +% The definition for |\XD@situation| set here is the one which will +% be in force when the \texttt{.aux} file is inputted at |\begin|\B +% |{document}|; its purpose is to build the |\XD@wrongs@list|. +% |\XD@check@situation| is the definition for |\XD@situation| which +% will be in force when the \texttt{.aux} file is inputted at +% |\end|\B|{document}|; its purpose is to check if anything was +% incorrectly placed. +% +% The main problem |\XD@situation| has to face is that text in the +% \texttt{.dvi} file needs not appear in exactly the same order as it +% was typeset, and it is therefore possible that |\XD@situation|s in +% the \texttt{.aux} file do not appear in increasing \meta{number} +% order. Because of this, |\XD@situation| must sort the +% |\XD@wrongs@list| while constructing it. The only reasonable +% algorithm for this seems to be insertion sort, but as the items to +% insert are almost surely almost sorted, a special check is done in +% the beginning to see if that is the case. |\XD@next@wrong| is used +% in this to store the number of the last item so far inserted into +% the |\XD@wrongs@list|. By only assigning |\XD@next@wrong| locally +% here, one is relieved of having to reset it in |\AtBeginDocument| +% code. +% +% When sorting is actually applied, a new item |\@elt|\marg{insert} +% is inserted through expanding the list. When doing that, the |\@elt| +% macro has the syntax +% \begin{quote} +% |\@elt|\,\meta{flag}\,\marg{number}\,\meta{next} +% \end{quote} +% where \meta{flag} is |\BooleanTrue| or |\BooleanFalse|, \meta{number} +% is the item that the |\@elt| belong to, and \meta{next} is either the +% next |\@elt| or |\@gobble| (if this is the last). The \meta{flag} +% specifies whether the item has been inserted; |\Boolean|\B|True| means +% that it has. The above |\@elt|-sequence will expand to +% \begin{quote} +% |\noexpand|\,|\@elt|\,\marg{number}\,\meta{next}\,|\BooleanTrue| +% \end{quote} +% if \meta{flag} is |\BooleanTrue|, or \meta{flag} is |\BooleanFalse| +% and \meta{number} is equal to \meta{insert}. It will expand to +% \begin{quote} +% |\noexpand|\,|\@elt|\,\marg{number}\,\meta{next}\,|\BooleanFalse| +% \end{quote} +% if \meta{flag} is |\BooleanFalse| and \meta{number} is less than +% \meta{insert}. It expands to +% \begin{quote} +% |\noexpand|\,|\@elt|\,\marg{insert}\,|\noexpand|\,|\@elt|^^A +% \,\marg{number}\\ +% \meta{next}\,|\BooleanTrue| +% \end{quote} +% if \meta{flag} is |\BooleanFalse| and \meta{number} is greater than +% \meta{insert}. +% +% \begin{macrocode} +\if@twoside + \def\XD@situation#1#2#3#4{% + \if #2#4\else + \ifnum #1<\XD@next@wrong + \begingroup + \def\@elt##1##2##3{% + \noexpand\@elt + \ifcase + \ifx ##1\BooleanTrue 0% + \else\ifnum ##2<#1 1% + \else\ifnum ##2>#1 2% + \else 0% + \fi\fi\fi + \space + {##2}\expandafter\@secondoftwo + \or + {##2}\expandafter\@firstoftwo + \else + {#1}\noexpand\@elt{##2}\expandafter\@secondoftwo + \fi{##3\BooleanFalse}{##3\BooleanTrue}% + }% + \xdef\XD@wrongs@list{% + \expandafter\expandafter \expandafter\@elt + \expandafter\@firstoftwo \expandafter\BooleanFalse + \XD@wrongs@list \@gobble + }% + \endgroup + \else\ifnum #1>\XD@next@wrong + \def\XD@next@wrong{#1}% + \expandafter\gdef \expandafter\XD@wrongs@list + \expandafter{\XD@wrongs@list \@elt{#1}}% + \fi\fi + \fi + } + \def\XD@check@situation#1#2#3#4{% + \if #3#4\else + \PackageWarningNoLine{xdoc2}{Page breaks may have changed.% + \MessageBreak Rerun to get marginal material right}% + \let\XD@situation\@gobblefour + \fi + } + \AtBeginDocument{\global\let\XD@situation\XD@check@situation} +\else + \let\XD@situation\@gobblefour +\fi +% \end{macrocode} +% \end{macro}\end{macro} +% +% +% \begin{macro}{\XD@set@situation} +% \begin{macro}{\XD@write@situation@ckpt} +% \begin{macro}{\cl@@ckpt} +% The page situation counter |\macro@cnt| is closely related to the +% \texttt{page} counter and it needs to be among the counters whose +% values are recorded in |\include| checkpoints, since the enumeration +% of situations will otherwise change when files are added to or +% removed from the |\@partlist|. It is not sufficient to simply set +% the value of |\macro@cnt| however; one must also advance to the +% correct position in the |\XD@wrongs@list| list and set +% |\XD@next@wrong| accordingly. The |\XD@set@situation| command has +% the syntax +% \begin{quote} +% |\XD@set@situation|\marg{number} +% \end{quote} +% It sets |\macro@cnt| to \meta{number} and updates |\XD@wrongs@list| +% and |\XD@|\B|next@|\B|wrong| accordingly. +% \begin{macrocode} +\if@twoside + \def\XD@set@situation#1{% + \global\macro@cnt=#1\relax + \loop \ifnum \XD@next@wrong<\macro@cnt + \global\@next\XD@next@wrong\XD@wrongs@list{}{% + \let\XD@next@wrong\maxdimen + }% + \repeat + } +\else \let\XD@set@situation=\@gobble \fi +% \end{macrocode} +% +% The |\XD@write@situation@ckpt| macro writes an |\XD@set@situation| +% command to the \texttt{.aux} file in the way that |\@wckptelt| +% writes |\setcounter| commands for normal counters. A problem for +% |\XD@write@situation@ckpt| is that it will have to appear in a +% macro which is regularly subjected to the |\xdef| in |\@cons|. For +% that reason, it will simply expand to itself whenever |\@elt| isn't +% |\@wckptelt|. +% \begin{macrocode} +\if@twoside + \def\XD@write@situation@ckpt{% + \ifx \@elt\@wckptelt + \immediate\write\@partaux{% + \string\XD@set@situation{\the\macro@cnt}% + }% + \else + \noexpand\XD@write@situation@ckpt + \fi + } + \expandafter\def \expandafter\cl@@ckpt + \expandafter{\cl@@ckpt \XD@write@situation@ckpt} +\fi +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% +% \section{The list of changes} +% \label{Sec:Changes} +% +% Reimplementations elsewhere have required a few modifications related +% to the |\changes| command. There are a lot of other things that could +% and perhaps should be done with these mechanisms, though. +% +% \begin{macro}{\saved@macroname} +% The contents of the |\saved@macroname| macro now have the syntax +% \begin{quote} +% \marg{sort key}\marg{text} +% \end{quote} +% i.e., exactly like the argument sequence of |\LevelSorted|. It's not +% fed to that macro right now, but it is not unlikely that it will in +% the future. The default definition corresponds to the default +% definition in \package{doc}. +% \begin{macrocode} +\def\saved@macroname{{ }{\generalname}} +% \end{macrocode} +% Unlike the case in \package{doc}, the formatting of the text in +% |\saved@macroname| must be included. +% \end{macro} +% +% \begin{macro}{\if@version@key@} +% The |@version@key@| switch is used for supporting intelligent +% sorting of version numbers. It is normally false, but at times +% where the version number argument of |\changes| is being expanded +% because it will be used as a sort key then it is true. This is used +% by the |\uintver| macro. Assignments to this switch are as a rule +% global, since it is never true for any longer time. +% \changes{prot2.4}{2002/11/01}{Switch added. (LH)} +% \begin{macrocode} +\newif\if@version@key@ +\@version@key@false +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\uintver} +% The |\uintver| command can be used in the \meta{version} argument +% of |\changes| to ensure that (unsigned) integers are sorted in +% mathematical rather than ASCII order by \package{makeindex}. Thus +% if for example version |1.10| is later than version |1.9| then one +% should write this as +% \begin{quote} +% |\changes{1.\uintver{10}}{|\dots +% \end{quote} +% The general syntax is +% \begin{quote} +% |\uintver|\marg{number} +% \end{quote} +% and this expands completely in \TeX's mouth. +% \changes{prot2.4}{2002/11/01}{Command added. (LH)} +% +% The idea is that 0--9 are compared as 0--9, whereas 10--99 are +% compared as A10--A99, 100--999 are compared as B100-B999, and so on. +% The comparisons are correct up to 99999, but it could easily be +% extended further. +% \begin{macrocode} +\newcommand*\uintver[1]{% + \if@version@key@ + \ifnum #1>9 + \ifnum #1<100 + A% + \else\ifnum #1<\@m + B% + \else\ifnum #1<\@M + C% + \else + D% + \fi\fi\fi + \fi + \fi + \expandafter\@firstofone \expandafter{\number#1}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\changes@} +% This |\changes@| is a simple redefinition of the \package{doc} +% macro with the same name. The main difference is that all +% formatting of the second entry level has been taken out---it is +% supposed to be provided in |\saved@macroname|---but in addition to +% that the date is being used as a third level sort key and |\uintver| +% may be used in the version number to correct the data. +% \changes{prot2.4}{2002/11/01}{Added support for \cs{uintver}. (LH)} +% +% The former makes more sense for projects where the date is +% increased faster than the version number and it doesn't change +% anything relevant in the remaining cases. The latter is necessary +% if version numbers are assigned for example by CVS. +% \begin{macrocode} +\def\changes@#1#2#3{% + \global\@version@key@true + \protected@edef\@tempa{#1}% + \global\@version@key@false + \protected@edef\@tempa{% + \noexpand\glossary{% + \@tempa\actualchar#1\levelchar + \expandafter\@firstoftwo\saved@macroname\actualchar + \expandafter\@secondoftwo\saved@macroname:\levelchar + #2\actualchar#3% + }% + }% + \@tempa + \endgroup + \@esphack +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@wrglossary} +% \changes{prot2.2}{2001/02/13}{Redefinition added. (LH)} +% \begin{macro}{\XD@glossary@keyword} +% \changes{prot2.2}{2001/02/13}{Macro added. (LH)} +% The |\@wrglossary| macro is the one which actually writes entries +% to the \texttt{.glo} file. It is redefined by \package{xdoc} to put +% the contents of |\XD@glossary@keyword|, rather than a hardwired +% |\glossaryentry|, in front of the glossary entry. +% |\XD@glossary@keyword| is redefined by the \package{docindex} +% package~\cite{docindex}. +% \begin{macrocode} +\def\@wrglossary#1{% + \protected@write\@glossaryfile{}% + {\XD@glossary@keyword{#1}{\thepage}}% + \endgroup + \@esphack +} +\@ifundefined{XD@glossary@keyword}{% + \edef\XD@glossary@keyword{\@backslashchar glossaryentry}% +}{} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\definechange} +% \begin{macro}{\XD@definechange} +% The |\definechange| command has the syntax +% \begin{quote} +% |\definechange|\marg{name}\marg{version}\marg{date}\marg{text} +% \end{quote} +% The three last arguments are precisely like the arguments of +% |\changes|, but |\definechange| doesn't write the change to the +% \texttt{.glo} file; instead it stores them away as the ``named +% change'' \meta{name}, for later use in the |\usechange| command. +% \begin{macrocode} +\newcommand\definechange{% + \begingroup\@sanitize + \catcode`\\\z@ \catcode`\ 10 \MakePercentIgnore + \expandafter\endgroup \XD@definechange +} +\def\XD@definechange#1#2#3#4{\@namedef{XD@ch-#1}{{#2}{#3}{#4}}} +% \end{macrocode} +% \end{macro}\end{macro} +% +% The named changes are stored in the +% \describecsfamily{XD@ch-\meta{name}}|\XD@ch-|\meta{name} family of +% control sequences. These are parameterless macros with replacement +% texts of the form +% \begin{quote} +% \marg{version}\marg{date}\marg{text} +% \end{quote} +% +% \begin{macro}{\usechange} +% \begin{macro}{\XD@usechange} +% \changes{prot2.4}{2002/11/01}{Added support for \cs{uintver}. (LH)} +% To use a named change defined earlier, one of course uses the +% command |\usechange|, which has the syntax +% \begin{quote} +% |\usechange|\marg{name} +% \end{quote} +% The effect of this is similar to that of a general |\changes| +% (i.e., it appears outside all \texttt{macro}-like environments) with +% the arguments specified in the |\definechange|, but this also +% includes the macro (or whatever) name with the page number, using +% the encapsulation mechanism in \package{makeindex}. +% \begin{macrocode} +\newcommand*\usechange[1]{% + \@ifundefined{XD@ch-#1}{% + \PackageError{xdoc2}{Named change `#1' undefined}\@eha + }{% + \expandafter\expandafter \expandafter\XD@usechange + \csname XD@ch-#1\endcsname + }% +} +\def\XD@usechange#1#2#3{% + \def\@tempa{{ }{\generalname}}% + \ifx \@tempa\saved@macroname + \let\@tempa\@empty + \else + \protected@edef\@tempa{% + \encapchar labelednumber% + {\expandafter\@secondoftwo\saved@macroname}% + } + \fi + \global\@version@key@true + \protected@edef\@tempb{#1}% + \global\@version@key@false + \glossary{% + \@tempb\actualchar #1\levelchar + \space\actualchar\generalname:\levelchar + #2\actualchar#3\@tempa + }% +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\labelednumber} +% The |\labelednumber| macro belongs to the same category as the +% |\main| and |\usage| macros, but it takes an extra argument. The +% syntax is +% \begin{quote} +% |\labelednumber|\marg{extra}\marg{number} +% \end{quote} +% which typesets as +% \begin{quote} +% \meta{number} (\meta{extra}) +% \end{quote} +% \begin{macrocode} +\newcommand*\labelednumber[2]{#2\nolinebreak[2] (#1)} +% \end{macrocode} +% \end{macro} +% +% +% +% \section{\texttt{macro}-like environments} +% \label{Sec:Macro-environments} +% +% There are several reasons one might want to improve the \texttt{macro} +% and \texttt{environment} environments. +% \begin{itemize} +% \item +% The code in them cannot be reused if you want to define other +% things than \TeX\ macros or \LaTeX\ environments. (During the +% last year or so, I have defined \texttt{macro}-like environments +% for over a dozen different things.) +% \item +% They always put the macro\slash environment name to the left of +% the current column. This is inappropriate for two-sided printing, +% as there should be a symmetry over an entire spread in that case. +% \item +% The vertical extent of a macro\slash environment name must not +% exceed that of the |\strut|, since they will otherwise overprint +% each other when stacked. In particular this makes it impossible to +% make line breaks in macro names---something which would otherwise +% be of interest in projects (such as for example \cite{fontinst}) +% where some names are very long and obvious breakpoints are +% available. +% \end{itemize} +% (I'm quite sure there are more things that have annoyed me, but I can't +% remember which they are right now.) The redefinitions below take care +% of the all these problems. +% +% +% \subsection{Grabbing arguments} +% +% A special feature of the \texttt{macro}-like environments is that (at +% least some) of their arguments must be given rather special treatment. +% This special treatment usually consists of making temporary |\catcode| +% changes for the time these arguments are tokenized---since the standard +% |\catcode|s for some important characters tend to be unsatisfactory in +% these cases---but there are other possibilities as well. For that +% reason, the \package{xdoc} package employs a mechanism that is very +% similar to that used in the Mittelbach--Rowley--Carlisle +% \package{xparse} package~\cite{xparse}, although it does not share +% any code with that. I call this mechanism the argument grabber. +% +% The heart of the argument grabber is the macro |\XD@grab@arguments|, +% which has the following syntax: +% \begin{quote} +% |\XD@grab@arguments|\marg{call}\marg{grabber sequence}^^A +% \meta{arguments to grab} +% \end{quote} +% \meta{call} is something which will eventually be placed in front of +% all the arguments grabbed. It can simply be a single macro, but it +% can also contain some arguments for that macro. \meta{grabber sequence} +% is a sequence of grabbers. A \emph{grabber} is typically a macro which +% grabs the next argument and stores it in a token list together with the +% arguments that were grabbed before. A grabber could however be some +% more complex piece of code that performs a similar action. +% +% \begin{table} +% \begin{minipage}{\columnwidth} +% \begin{center}\small +% \begin{tabular}{lll>{\raggedright}p{0.3\linewidth}} +% \textbf{Grabber}& \textbf{Arg.\ type}& +% \textbf{Catcodes\footnote[1]{Catcode settings key: +% --- = no change, PL = changes made by \cs{MakePrivateLetters}, +% OB = set the catcode of backslash to ordinary.}}& +% \textbf{Post-processing}\tabularnewline +% |\XD@grab@marg|& Mandatory& ---& None\tabularnewline +% |\XD@grab@oarg|& Optional& ---& None\tabularnewline +% |\XD@grab@sarg|\marg{char}& 1-char optional& +% ---& Returns |\BooleanTrue| if the character was present +% and |\BooleanFalse| otherwise.\tabularnewline +% |\XD@grab@withprivate|& Mandatory& PL& None\tabularnewline +% |\XD@grab@asmacro|\footnote[2]{This grabber is probably obsolete; +% it is included because it grabs the argument in precisely the +% way that the \texttt{macro} environment of \package{doc} does.}& +% Mandatory& OB+PL& None\tabularnewline +% |\XD@grab@harmless|\meta{proc}& Mandatory& ---& +% |\MakeHarmless| followed by \meta{proc}\tabularnewline +% |\XD@grab@harmless@oarg|& Optional& ---& +% |\MakeHarmless|\tabularnewline +% \multicolumn{3}{l}{\cs{XD@grab@harmless@asmacro}}\tabularnewline +% & Mandatory& OB+PL& +% |\MakeHarmless| followed by |\XD@unbackslash|\tabularnewline +% |\XD@grab@harmless@cs|& Mandatory\footnote[3]{The argument is +% normally precisely one control sequence.}& PL& +% |\string| whilst |\escapechar| is set to \textminus1, +% followed by |\MakeHarmless|\tabularnewline +% \multicolumn{3}{l}{^^A +% \cs{XD@grab@harmless@withprivate}\marg{proc}}\\ +% & Mandatory& PL& |\MakeHarmless| followed by \meta{proc} +% \end{tabular} +% \end{center} +% \end{minipage} +% +% \caption{Grabbers currently defined by \package{xdoc}} +% \label{Tab:Grabbers} +% \end{table} +% +% When arguments are being grabbed, the \meta{call} is stored in |\toks@| +% and the arguments are appended to |\toks@| as they are grabbed. For +% that reason, a grabber may not itself call |\XD@grab@arguments|, nor +% may it use a command defined through \package{xparse}'s +% |\Declare|\-|Document|\-|Command| or anything else which uses this +% token register in a bad way. +% +% When a grabber is expanded, it is in the context +% \begin{quote} +% \meta{grabber}\,\meta{following grabbers}\,|\XD@endgrab|\penalty0 +% \thinspace\meta{ungrabbed arguments} +% \end{quote} +% After it has grabbed its argument, everything of the above should be +% put back except for the \meta{grabber} and the argument it grabbed. +% The argument itself should be wrapped in a group and appended to +% |\toks@|. +% +% \textbf{Note:} In prototype~2 the format in which the argument grabber +% returns the grabbed arguments was changed so that it can now be +% unified with argument grabbing mechanisms of \package{xparse}. I +% think this should be done some time in the future, but for the moment +% it seems best not to rely on \LaTeXplus\ packages like \package{xparse}. +% +% \begin{macro}{\XD@grab@arguments} +% \begin{macro}{\XD@endgrab} +% \changes{prot2}{2000/07/13}{The grabbed arguments are no longer +% returned wrapped up in a group. There is no longer a need for +% storing the base call separately in \cs{toks}\,\texttt{2}. (LH)} +% The |\XD@grab@arguments| and |\XD@endgrab| macros set up and finish +% off argument grabbing. +% \begin{macrocode} +\def\XD@grab@arguments#1#2{% + \toks@={#1}% + #2\XD@endgrab +} +% \end{macrocode} +% \begin{macrocode} +\def\XD@endgrab{\the\toks@} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\XD@grab@marg} +% A grabber for ordinary arguments, like the \texttt{m} arguments of +% \package{xparse}. +% \begin{macrocode} +\long\def\XD@grab@marg#1\XD@endgrab#2{% + \addto@hook\toks@{{#2}}% + #1\XD@endgrab +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\XD@grab@oarg} +% \begin{macro}{\XD@grab@oarg@} +% A grabber for optional arguments (\texttt{o} arguments in +% \package{xparse}). It looks ahead for an optional argument and +% grabs that argument if there was one. If it doesn't find anything +% which looks like an optional argument (i.e., if the next character +% isn't a |[|), then the grabber will not grab anything (although it +% may have tokenized the next argument), but it will still append +% |\NoValue| to |\toks@|. +% +% \begin{macrocode} +\def\XD@grab@oarg#1\XD@endgrab{% + \@ifnextchar[{\XD@grab@oarg@{#1}}{% + \addto@hook\toks@\NoValue + #1\XD@endgrab + }% +} +% \end{macrocode} +% |\XD@grab@oarg@| is a helper to remove the brackets around the +% optional argument. +% \begin{macrocode} +\long\def\XD@grab@oarg@#1[#2]{% + \addto@hook\toks@{{#2}}% + #1\XD@endgrab +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\XD@grab@sarg} +% A grabber for `star'-type arguments (\texttt{s} arguments in +% \package{xparse}). The syntax is +% \begin{quote} +% |\XD@grab@sarg|\marg{char} +% \end{quote} +% It looks ahead to see if the next character is the \meta{char}. In +% that case it gobbles it and adds a |\BooleanTrue| to the grabbed +% arguments, otherwise it adds a |\BooleanFalse| to the grabbed +% arguments. +% \changes{prot2.3}{2001/11/03}{Macro added. (LH)} +% \begin{macrocode} +\def\XD@grab@sarg#1#2\XD@endgrab{% + \@ifnextchar#1{% + \addto@hook\toks@\BooleanTrue + \@firstoftwo{#2\XD@endgrab}% + }{% + \addto@hook\toks@\BooleanFalse + #2\XD@endgrab + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\XD@grab@withprivate} +% |\XD@grab@withprivate| is like |\XD@grab@marg| but grabs the +% argument when the catcodes are as set by |\MakePrivateLetters|. +% \begin{macrocode} +\def\XD@grab@withprivate{% + \begingroup\MakePrivateLetters\relax\expandafter\endgroup + \XD@grab@marg +} +% \end{macrocode} +% To think about: Perhaps things like |\XD@grab@withprivate| should +% rather be considered a modifier for a grabber? Instead of having +% |\XD@grab@withprivate| be the entire grabber, one could let the +% grabber be something like +% \begin{quote} +% |\XD@grab@withprivate\XD@grab@marg| +% \end{quote} +% where the |\XD@grab@withprivate| should only expand to +% \begin{quote} +% |\begingroup\MakePrivateLetters\relax\expandafter\endgroup| +% \end{quote} +% \end{macro} +% +% \begin{macro}{\XD@grab@asmacro} +% |\XD@grab@asmacro| is very similar to |\XD@grab@withprivate|, but it +% sees to that the catcode settings are exactly those used by +% \package{doc}'s \texttt{macro} environment. +% \begin{macrocode} +\def\XD@grab@asmacro{% + \begingroup + \catcode`\\=12 \MakePrivateLetters\relax + \expandafter\endgroup + \XD@grab@marg +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\XD@grab@harmless} +% \begin{macro}{\XD@grab@harmless@oarg} +% \changes{prot2.1}{2000/09/30}{Macro added. (LH)} +% \begin{macro}{\XD@grab@harmless@oarg@} +% \changes{prot2.1}{2000/09/30}{Macro added. (LH)} +% The |\XD@grab@harmless| grabber grabs one mandatory argument and +% converts it to a harmless character string, which it contributes to +% the list of arguments. The syntax is +% \begin{quote} +% |\XD@grab@harmless|\marg{post-processing} +% \end{quote} +% where \meta{post-processing} are commands that will be performed +% after the grabbed argument has been made harmless, but before it is +% contributed to the list of arguments. Thus the +% \meta{post-processing} can modify the argument some more, but +% \meta{post-processing} can just as well be empty. +% \begin{macrocode} +\def\XD@grab@harmless#1#2\XD@endgrab#3{% + \MakeHarmless\@tempa{#3}% + #1% + \toks@=\expandafter{\the\expandafter\toks@ \expandafter{\@tempa}}% + #2\XD@endgrab +} +% \end{macrocode} +% +% The |\XD@grab@harmless@oarg| grabber grabs one optional argument and +% converts it to a harmless character string. This string is +% contributed to the list of arguments if the optional argument, or +% else the token |\NoValue| is contributed instead. +% \begin{macrocode} +\def\XD@grab@harmless@oarg#1\XD@endgrab{% + \@ifnextchar[{\XD@grab@harmless@oarg@{#1}}{% + \addto@hook\toks@\NoValue + #1\XD@endgrab + }% +} +% \end{macrocode} +% |\XD@grab@harmless@oarg@| is a helper to remove the brackets around +% the optional argument. +% \begin{macrocode} +\long\def\XD@grab@harmless@oarg@#1[#2]{% + \MakeHarmless\@tempa{#2}% + \toks@=\expandafter{\the\expandafter\toks@ \expandafter{\@tempa}}% + #1\XD@endgrab +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\XD@grab@harmless@asmacro} +% \begin{macro}{\XD@grab@harmless@cs} +% \begin{macro}{\XD@grab@harmless@cs@} +% The |\XD@grab@harmless@asmacro| grabber combines the features of +% |\XD@grab@|\B|asmacro| and |\XD@grab@harmless|, since when the +% argument to grab is tokenized the catcode of |\| is set to 12 and +% the catcode assignments in |\MakePrivateLetters| are made. Then the +% grabbed argument is converted to a harmless character sequence, and +% finally the first character is removed if it is a backslash. +% \begin{macrocode} +\def\XD@grab@harmless@asmacro{% + \begingroup + \catcode`\\=12 \MakePrivateLetters\relax + \expandafter\endgroup + \XD@grab@harmless{% + \protected@edef\@tempa{% + \expandafter\XD@unbackslash\@tempa\@empty + }% + }% +} +% \end{macrocode} +% +% The |\XD@grab@harmless@cs| grabber is for use with commands like +% \package{doc}'s |\Describe|\-|Macro|, which take an actual control +% sequence as the argument. It grabs one argument while having +% catcodes changed as indicated by |\Make|\-|Private|\-|Letters|, +% |\string|s the argument while |\escapechar| is |-1| (so that there +% is no escape character inserted), and continues as +% |\XD@grab@harmless|. +% \begin{macrocode} +\def\XD@grab@harmless@cs{% + \begingroup + \MakePrivateLetters\relax + \expandafter\endgroup \XD@grab@harmless@cs@ +} +% \end{macrocode} +% \begin{macrocode} +\long\def\XD@grab@harmless@cs@#1\XD@endgrab#2{% + \begingroup + \escapechar=\m@ne + \expandafter\endgroup + \expandafter\MakeHarmless \expandafter\@tempa + \expandafter{\string#2}% + \toks@=\expandafter{\the\expandafter\toks@ \expandafter{\@tempa}}% + #1\XD@endgrab +} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\XD@grab@harmless@withprivate} +% |\XD@grab@harmless@withprivate| is like |\XD@grab@harmless| but +% grabs the argument when the catcodes are as set by +% |\Make|\-|Private|\-|Letters|. +% Like |\XD@|\B|grab@|\B|harmless|, |\XD@grab@|\B|harmless@|\B +% |withprivate| takes an argument which can contain code that +% modifies the harmless character string after it has been formed. +% \begin{macrocode} +\def\XD@grab@harmless@withprivate{% + \begingroup\MakePrivateLetters\relax\expandafter\endgroup + \XD@grab@harmless +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{The \cs{XD@m@cro} and \cs{NewMacroEnvironment} commands} +% +% In \package{doc} the macro that contains most of the code for the +% \texttt{macro} and \texttt{environment} environments is called +% |\m@cro@|. In \package{xdoc} the corresponding macro is |\XD@m@cro|. +% +% At this point, it is helpful to recall what |\m@cro@| actually does. +% It can be summarized in the following four points: +% \begin{itemize} +% \item It starts a |\trivlist|.\footnote{Seriously, can someone +% explain to me why it seems just about every non-math \LaTeX\ +% environment that doesn't start a \cs{list} starts a \cs{trivlist}? +% What good does all these \cs{trivlist}s do? Is it (a)~that people +% just like the basic design, (b)~that there's some deep technical +% reason, or (c)~that people in general doesn't have a clue but all +% other environments do that so it's best to include it just in +% case?} +% \item It prints the name of the macro\slash environment that is +% about to be defined in the margin. +% \item It writes an index entry (and inhibits cross-referencing of +% the macro inside the environment). +% \item It sets |\saved@macroname| to the name of the macro\slash +% environment (for use by |\changes|). +% \end{itemize} +% +% The first and fourth points are simple, and commands for the third +% were defined in Section~\ref{Sec:Indexing}, but the second point +% needs a few helper macros. +% +% +% \begin{macro}{\XDStackItemLabels} +% \changes{prot2}{2000/07/28}{Made it work like a \cs{vtop} (but hide +% the height) if \cs{XD@macro@dimen} is \texttt{-}\cs{maxdimen}. +% (LH)} +% \begin{macro}{\XD@macro@dimen} +% The |\XDStackItemLabels| macro is a definition of |\makelabel| which +% is used in the \texttt{macro}-like environments for stacking the +% names printed by subsequent environments under each other. It makes +% a box which has zero height and depth (it should have zero width as +% well, but that is left as a restriction on the argument) and the +% printed names will be stacked if the reference points of the +% subsequent boxes generated by |\XD|\-|Stack|\-|Item|\-|Labels| +% coincide. +% +% |\XD@macro@dimen| (always assigned globally) stores the vertical +% distance from the reference point of the box that +% |\XD|\-|Stack|\-|Item|\-|Labels| makes to the (bottommost) baseline +% of the previous printed name. |\XD@macro@dimen| is updated by each +% new |\XD|\-|Stack|\-|Item|\-|Labels|. The baseline of the next printed +% name will be put one |\baselineskip| lower than that of the previous +% printed name, except for when |\XD@macro@dimen| is |-\maxdimen| (see +% below). To avoid that printed names clash into each other, this +% additional |\baselineskip| is generated as normal interline glue +% where the upper box has the same depth as a strut and the new value +% of |\XD@macro@dimen| is measured in such a way that the printed +% name's depth below the nominal baseline will not exceed the depth of +% a strut (that's what the |\boxmaxdepth| assignment is for). +% When |\XD@macro@dimen| is |-\maxdimen| the (topmost) baseline of the +% printed name will instead go through the reference point of the box. +% This case is intended for the first item label in a stack. +% +% The reason |\everypar| is cleared is that that is where the list +% environments put the commands which actually insert the item label +% into the paragraph. If that code gets executed inside |\makelabel|, +% the list environments get seriously confused with not at all nice +% consequences. +% \begin{macrocode} +\def\XDStackItemLabels#1{% + \setbox\z@=\vbox{% + \ifdim \XD@macro@dimen=-\maxdimen + \setbox\z@=\vtop{% + \color@begingroup + \everypar={}% + #1% + \color@endgroup + }% + \kern-\ht\z@ + \unvbox\z@ + \else + \color@begingroup + \everypar={}% + \kern\XD@macro@dimen + \setbox\z@=\copy\strutbox \ht\z@=\z@ \box\z@ + #1% + \color@endgroup + \fi + \boxmaxdepth=\dp\strutbox + }% + \global\XD@macro@dimen=\ht\z@ + \vtop to\z@{\unvbox\z@ \vss}% +} +% \end{macrocode} +% \begin{macrocode} +\newdimen\XD@macro@dimen +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\XDToMargin} +% \changes{prot2.1}{2000/11/26}{New name for \cs{XD@to@margin}. (LH)} +% The |\XDToMargin| macro takes one argument, which is assumed to be +% some horizontal material, and puts that material in a |\hbox| of +% width zero, horizontally shifted out into the the outer margin, in +% such a way that longer arguments extend further out. |\marginparsep| +% is used as the distance between the argument and the main galley. All +% these placements assume that the |\hbox| will be put |\labelsep| to +% the left of the beginning of a nonindented paragraph, since that is +% where it will be put by the |\item| of a |\trivlist|. +% +% A question is where the margin should be considered to start if the +% |\@total|\-|left|\-|margin| isn't zero. The corresponding +% \package{doc} action would be to consider the margin as everything +% outside the |\linewidth| width, but I don't think that would be +% appropriate here (especially not since \package{doc} always puts the +% codeline numbers at the edge of the |\textwidth| width). +% \begin{macrocode} +\newcommand\XDToMargin[1]{% + \hb@xt@\z@{% + \IfOddPageSituation{% + \dimen@=-\@totalleftmargin + \advance \dimen@ \labelsep + \advance \dimen@ \textwidth + \advance \dimen@ \marginparsep + \kern\dimen@ + }\hss + #1% + \IfOddPageSituation\hss{% + \dimen@=\@totalleftmargin + \advance \dimen@ -\labelsep + \advance \dimen@ \marginparsep + \kern\dimen@ + }% + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\XDParToMargin} +% The |\XDParToMargin| command is in syntax and use similar to the +% |\XDToMargin| command, but it will try to linebreak an argument +% that is too long rather than letting it extend outside the paper. +% +% The implementation first tries to break the argument without +% considering justification or positioning, but with a rather high +% |\linepenalty|. If the result of that try is a single line paragraph +% then |\XDToMargin| will be called to actually typeset the argument. +% Otherwise the argument is typeset as a paragraph which gets +% displaced out into the outer margin by giving |\leftskip| and +% |\rightskip| nonzero natural widths. The practical line width in +% the paragraph is the |\marginparwidth|, but the hboxes containing +% the individual lines will have width zero. The first line of the +% paragraph will be set flush outwards, the last line of the paragraph +% will be set flush inwards, and the remaining lines will be centered. +% +% \changes{prot2.1}{2000/11/26}{Command added. (LH)} +% \begin{macrocode} +\newcommand\XDParToMargin[1]{% + \parindent=\z@ + \setbox\z@=\vbox{% + \leftskip=\z@skip + \rightskip=\z@\@plus 1fil% + \parfillskip=\z@skip + \hsize=\marginparwidth + \linepenalty=1000% + \color@begingroup + \noindent\ignorespaces #1\@@par + \color@endgroup + \expandafter}% + \expandafter\ifnum \the\prevgraf<\tw@ + \XDToMargin{#1}% + \else + \hsize=\z@ + \leftskip=\z@ \@plus \marginparwidth + \rightskip=\leftskip + \IfOddPageSituation{% + \dimen@=-\@totalleftmargin + \advance \dimen@ \labelsep + \advance \dimen@ \textwidth + \advance \dimen@ \marginparsep + \advance \leftskip \dimen@ + \advance \rightskip -\dimen@ \@minus \p@ + \advance \rightskip -\marginparwidth + \parfillskip=\z@ \@plus 1fil% + }{% + \dimen@=\@totalleftmargin + \advance \dimen@ -\labelsep + \advance \dimen@ \marginparsep + \advance \leftskip -\dimen@ \@minus \p@ + \advance \leftskip -\marginparwidth + \advance \rightskip \dimen@ + \parfillskip=\z@ \@plus -\marginparwidth% + } + \noindent\nobreak\hskip\parfillskip + \ignorespaces #1\@@par + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% In the following I exploit the implementation of the |\item| command +% in a slightly hackish way. Instead of starting a new paragraph with +% the item label (which is what one at first would believe |\item| +% does), |\item| actually puts the label in the box |\@labels| register, +% and stores code in |\everypar| that inserts that box into the new +% paragraph. Therefore I can make sure that various |\write| whatsits +% that need to be as the same page as an |\item| label will be there by +% adding them to the contents of the |\@labels| box. This seems more +% reliable to me than putting them on the vertical list followed by a +% |\nobreak| as \package{doc} does, but that would probably work as +% well. +% +% [A funny thing in that which confused me a while was the question of +% whether the |\box| command that inserts the box into the paragraph and +% simultaneously clears the register acted globally or locally. It turns +% out that the question was ill-posed, as the distinction between local +% and global assignments is determined by what restore items they put +% on \TeX's save stack. The |\box| command doesn't put anything there, +% so the assignment it makes will essentially appear at the same +% grouping level as the |\setbox| command that set the contents of the +% box register. As all |\setbox|es for the |\@labels| box register are +% global, the box register will be globally void after |\box\@labels|.] +% +% +% \begin{macro}{\XD@m@cro} +% \changes{prot2}{2000/07/24}{Put the \meta{changes} argument before +% the \meta{assign} argument. Executing the \meta{assign} code +% after the \meta{changes} \cs{edef}. Changed the descriptions of +% these arguments a little. (LH)} +% \changes{prot2.1}{2000/11/26}{Removed \cs{XDToMargin} from the +% argument of \cs{item}. It should now be included in \#1 +% instead. (LH)} +% This is the workhorse of all the \texttt{macro}-like environments. +% It calls |\trivlist| and sets related parameters, prints the +% ``macro'' name in the proper place, updates the representation of +% the ``macro'' name that |\changes| will use, and writes appropriate +% index entries (possibly making temporary changes in +% cross-referencing). Exactly what these tasks consist of can vary +% quite a lot between different \texttt{macro}-like environments, and +% therefore the |\XD@m@cro| macro has the following syntax: +% \begin{quote} +% |\XD@m@cro|\marg{print}\marg{index}\marg{changes}\marg{assign} +% \end{quote} +% \meta{print}, \meta{index}, and \meta{assign} are simply the +% commands for printing the ``macro'' name as it should appear in the +% margin, generating the index entries for this \texttt{macro}-like +% environment, and making whatever additional local assignments that +% are needed for this environment (usually a couple of +% |\Do|\-|Not|\-|Index|\-|Harmless| commands, if anything at all) +% respectively. At the time \meta{index} is executed, +% \texttt{codelineno} holds the number of the \emph{next} codeline. +% \meta{changes}, finally, is code that will be put in the context +% \begin{quote} +% |\protected@edef\saved@macroname{|\meta{changes}|}| +% \end{quote} +% to set the |\saved@macroname| macro (for |\changes|). +% \begin{macrocode} +\def\XD@m@cro#1#2#3#4{% + \topsep\MacroTopsep + \trivlist + \global\setbox\@labels=\hbox{% + \unhbox\@labels + \if@inlabel \else + \global\XD@macro@dimen=-\maxdimen + \StepPageSituation + \RecordPageSituation + \fi + \advance \c@codelineno \@ne + #2% + }% + \let\makelabel\XDStackItemLabels + \item[#1]% + \protected@edef\saved@macroname{#3}% + #4% + \ignorespaces +} +% \end{macrocode} +% \end{macro} +% +% In the first \package{xdoc} prototype, the \texttt{macro}-like +% environments were implemented so that each new environment only used +% two control sequences (|\|\meta{env} and |\end|\meta{env}), which is +% the absolute minimum. This implementation worked fine for +% single argument environments, but the number of helper macros that +% would have to be introduced to deal with multiple argument +% environments exceeded what could be considered reasonable. Therefore +% the second prototype claims a third control sequence for the +% implementation of a \texttt{macro}-like environment \meta{env}, namely +% |\\|\meta{env}, which is also used by normal \LaTeXe\ environments +% which take an optional argument. +% +% It should also be mentioned that the implementation in the first +% prototype required that most of the code in |\|\meta{env} had to be +% written in a very special way. Instead of using the |#|\meta{digit} +% notation for the arguments and write straightforward \LaTeX\ code, one +% had to express everything using macros which operate on arguments ``up +% ahead'' (immediately after the code you can specify). This curious +% coding model made it out of the question to create a class designer +% interface for defining new \texttt{macro}-like environments, but in +% the second \package{xdoc} prototype it is quite simple to do something +% of that sort: the command name is |\New|\-|Macro|\-|Environment|. +% +% \begin{macro}{\NewMacroEnvironment} +% \changes{prot2}{2000/07/13}{Command added. (LH)} +% \changes{prot2}{2000/07/24}{Changed syntax in conformity with the +% syntax change in \cs{XD@m@cro}. (LH)} +% \changes{prot2.1}{2000/11/26}{Introduced star form with different +% semanics for the \meta{print} argument. This uses the helper +% macros \cs{XD@NewMacroEnvironment} and +% \cs{XD@NewMacroEnvironment@}. (LH)} +% \begin{macro}{\XD@NewMacroEnvironment} +% \begin{macro}{\XD@NewMacroEnvironment@} +% The |\NewMacroEnvironment| command is used for defining new +% \texttt{macro}-like environments. It has the syntaxes +% \begin{quote} +% |\NewMacroEnvironment|\marg{name}\marg{grabbers}\marg{numargs}\\ +% \vadjust{}\hfill\marg{unjust-print}\marg{index}\marg{changes}^^A +% \marg{assign}\\ +% |\NewMacroEnvironment*|\marg{name}\marg{grabbers}\marg{numargs}\\ +% \vadjust{}\hfill\marg{print}\marg{index}\marg{changes}\marg{assign} +% \end{quote} +% where \meta{name} is the name of the environment to define, +% \meta{grabbers} is a sequence of argument grabbers, \meta{numargs} +% is the number of arguments that the grabbers will grab, and +% \meta{print}, \meta{index}, \meta{changes}, and \meta{assign} are +% code that will be put in the respective arguments of |\XD@m@cro|. +% In the four last arguments, argument specifiers |#1| to +% |#|\meta{numargs} inclusive can be used do mean the arguments that +% were grabbed by the sequence of grabbers. +% +% The argument grabbers that are currently made available by the +% \package{xdoc} package are listed in Table~\ref{Tab:Grabbers} on +% page~\pageref{Tab:Grabbers}. +% +% The \meta{print} code will be executed while \TeX\ is in internal +% vertical mode and it should put one or several hboxes of width zero +% onto the vertical list. The contents of these boxes should be some +% amount of text which will appear displaced out into the outer margin +% on the page when the reference point of the box appears |\labelsep| +% to the left of the left edge of the line. The easiest way of +% achieveing this is to use a \meta{print} of the form +% \begin{quote} +% |\XDToMargin|\marg{unjust-print} +% \end{quote} +% and this is exactly what the non-star form of |\NewMacroEnvironment| +% does by default. +% +% \begin{macrocode} +\newcommand\NewMacroEnvironment{% + \@ifstar\XD@NewMacroEnvironment\XD@NewMacroEnvironment@ +} +\def\XD@NewMacroEnvironment@#1#2#3#4{% + \XD@NewMacroEnvironment{#1}{#2}{#3}{\XDToMargin{#4}}% +} +\def\XD@NewMacroEnvironment#1#2#3#4#5#6#7{% + \expandafter\@ifdefinable\csname#1\endcsname{% + \expandafter\def \csname#1\expandafter\endcsname + \expandafter{\expandafter\XD@grab@arguments + \csname\@backslashchar#1\endcsname{#2}}% + \let\l@ngrel@x\relax + \expandafter\@yargdef \csname\@backslashchar#1\endcsname \@ne + {#3}{\XD@m@cro{#4}{#5}{#6}{#7}}% + \expandafter\let \csname end#1\endcsname \endtrivlist + }% +} +% \end{macrocode} +% The \meta{grabbers} argument---in which one specifies a list of +% internal macros---is not how the interface should really look, but I +% think it will have to do for now. The final interface will probably +% use something like the argument specifications of +% |\Declare|\-|Document|\-|Command|, but there is little point in +% implementing that before \package{xparse} has gotten its final form. +% \end{macro}\end{macro}\end{macro} +% +% The macro |\@yargdef| used above should perhaps be checked so that its +% syntax hasn't changed, but since |\@yargdef| quite recently +% (\texttt{ltdefn.dtx} v\,1.3c, 1999/01/18) was completely reimplemented +% without any change in the syntax (despite the fact that the syntax is +% afterwards rather peculiar), I think it can be assumed that the syntax +% will not change in \LaTeXe. +% +% +% +% \subsection{Reimplementing \texttt{macro} and \texttt{environment}} +% \label{Ssec:Macro&environment} +% +% Well, then how does one reimplement the \texttt{macro} and +% \texttt{environment} environments using |\XD@m@cro|? We shall soon +% see, but first it is convenient to define a utility macro. +% +% \changes{prot2}{2000/07/14}{Lots of utility macros were removed: +% \cs{XDWrapText}, \cs{XDAltWrapText}, \cs{XDSortAndText}, +% \cs{MultipleApply}, \cs{ApplicableUsageIndex}, and +% \cs{XD@index@family}. (LH)} +% +% \begin{macro}{\XDMainIndex} +% \changes{prot2}{2000/07/14}{New name and syntax for +% \cs{ApplicableMainIndex}. (LH)} +% The |\XDMainIndex| macro is an abbreviation to save a couple of +% tokens in a very frequent call to |\IndexEntry|. It has the syntax +% \begin{quote} +% |\XDMainIndex|\marg{argument} +% \end{quote} +% and that expands to +% \begin{quote} +% |\IndexEntry|\marg{argument}|{main}{\TheXDIndexNumber}| +% \end{quote} +% \begin{macrocode} +\newcommand\XDMainIndex[1]{\IndexEntry{#1}{main}{\TheXDIndexNumber}} +% \end{macrocode} +% \end{macro} +% +% \begin{environment}{macro} +% \changes{prot2.1}{2000/11/15}{Using \cs{MakeSortKey} to make index +% entry. (LH)} +% \begin{environment}{environment} +% It is very easy to implement \texttt{macro} and \texttt{environment} +% environments which behave pretty much as in \package{doc} using the +% |\New|\-|Macro|\-|Environment| command. The important difference +% is that in \package{doc} everything that distinguished the two +% environments was to be found in various helper macros, but here all +% that code is in the |\\macro| and |\\environment| macros. Thus to +% define one new \texttt{macro}-like environment, one doesn't have to +% define six or so new macros---everything can be handled in one +% definition. +% +% The reason for the |\let| commands below is of course that +% \texttt{macro} and \texttt{environment} are already defined, and +% there is no |\Renew|\-|Macro|\-|Environment| command. It could +% perhaps have been better if |\New|\-|Macro|\-|Environment| had +% behaved like |\Declare|\-|Robust|\-|Command|, but I don't think that +% is an important problem for the moment. +% \begin{macrocode} +\let\macro=\relax +\let\endmacro=\relax +\NewMacroEnvironment{macro}{\XD@grab@harmless@asmacro}{1} + {\MacroFont\Bslash#1} + {\MakeSortKey\@tempa{#1}{}% + \XDMainIndex{\LevelSorted{\@tempa}{\texttt{\Bslash#1}}}} + {{#1}{\texttt{\Bslash#1}}} + {\DoNotIndexHarmless{#1}} +% \end{macrocode} +% \begin{macrocode} +\let\environment=\relax +\let\endenvironment=\relax +\NewMacroEnvironment{environment}{\XD@grab@harmless@asmacro}{1} + {\MacroFont#1} + {\XDMainIndex{\LevelSorted{#1}{\texttt{#1} (environment)}}% + \XDMainIndex{% + \LevelSame{environments:}\LevelSorted{#1}{\texttt{#1}}% + }}% + {{#1}{\texttt{#1}}} + {}% +% \end{macrocode} +% \end{environment}\end{environment} +% +% +% \subsection{Further examples of \texttt{macro}-like environments} +% \label{Ssec:More macros} +% +% \begin{environment}{option} +% The \texttt{option} environment is for class\slash package options. +% IMHO, something like this environment should have been added to +% \package{doc} years ago! +% +% \begin{macrocode} +\NewMacroEnvironment{option}{\XD@grab@harmless\relax}{1} + {\MacroFont#1 \normalfont option} + {\XDMainIndex{\LevelSorted{#1}{\texttt{#1} option}}% + \XDMainIndex{% + \LevelSame{options:}\LevelSorted{#1}{\texttt{#1}}% + }}% + {{#1 option}{\texttt{#1} option}} + {}% +% \end{macrocode} +% \end{environment} +% +% \begin{environment}{switch} +% \changes{prot2.1}{2000/11/18}{Using \cs{MakeSortKey}. (LH)} +% The \texttt{switch} environment is for switches created by +% |\newif| (\PlainTeX\ style). +% \begin{macrocode} +\NewMacroEnvironment{switch}{\XD@grab@harmless\relax}{1} + {\MacroFont#1 \normalfont switch}% +% \end{macrocode} +% What makes switches different from the other \texttt{macro}-like +% environments defined here is the large number of index entries it +% makes. For a switch \meta{sw} it first makes one under the `switches:' +% heading: +% \begin{macrocode} + {% + \MakeSortKey\XD@last@key{#1}{}% + \XDMainIndex{% + \LevelSame{switches:}\LevelSorted{\XD@last@key}{\texttt{#1}}% + }% +% \end{macrocode} +% Second it makes a `\meta{sw} switch' entry: +% \begin{macrocode} + \XDMainIndex{\LevelSorted{\XD@last@key}{\texttt{#1} switch}}% +% \end{macrocode} +% Third it makes an entry for the macro |\if|\meta{sw}. The sort key +% for this entry is \emph{not} subjected to |\MakeSortKey| because +% no reasonable operator will act on the |if| prefix (an operator +% which acts on |if| could do rather strange things to e.g. |\ifnum|). +% \begin{macrocode} + \XDMainIndex{\LevelSorted{if#1}{\texttt{\Bslash if#1}}}% +% \end{macrocode} +% Fourth it makes an entry for the macro |\|\meta{sw}|false|: +% \begin{macrocode} + \MakeSortKey\@tempa{#1false}{}% + \XDMainIndex{\LevelSorted{\@tempa}{\texttt{\Bslash#1false}}}% +% \end{macrocode} +% Finally it makes an entry for the macro |\|\meta{sw}|true|: +% \begin{macrocode} + \MakeSortKey\@tempa{#1true}{}% + \XDMainIndex{\LevelSorted{\@tempa}{\texttt{\Bslash#1true}}}% + }% +% \end{macrocode} +% The |\changes| heading, on the other hand, is trivial. +% \begin{macrocode} + {{#1}{\texttt{#1} switch}} +% \end{macrocode} +% Finally, \texttt{switch} should turn off indexing of the three macros +% it makes \texttt{main} entries for, since \package{makeindex} will +% otherwise complain. +% \begin{macrocode} + {\DoNotIndexHarmless{if#1}% + \DoNotIndexHarmless{#1false}% + \DoNotIndexHarmless{#1true}}% +%</pkg> +% \end{macrocode} +% \end{environment} +% +% +% To end this section, there now follows two examples which are not +% part of the package as they are very specific, but which have been +% included here because they illustrate that \texttt{macro}-like +% environments may have several arguments. +% +% \begin{environment}{enccommand} +% \begin{environment}{enccomposite} +% The \texttt{enccommand} and \texttt{enccomposite} environments can +% be used for marking up sources for encoding definition files and the +% like. \texttt{enccommand} is for encoding-specific commands and has +% the syntax +% \begin{quote} +% |\begin{enccommand}|\marg{command}\oarg{encoding} +% \end{quote} +% where \meta{command} is the encoding-specific command and +% \meta{encoding} is the encoding that this definition is for. If the +% \meta{encoding} is omitted then the \texttt{enccommand} is assumed +% to be for the default definition of the command. +% +% \texttt{enccomposite} is for composites of encoding-specific +% commands (defined for example using |\Declare|\-|Text|\-|Composite|). +% It has the syntax +% \begin{quote} +% |\begin{enccomposite}|\marg{command}\marg{encoding}\marg{argument} +% \end{quote} +% where \meta{command} and \meta{encoding} are as for +% \texttt{enccommand} and \meta{argument} is the argument with which +% the command is being composed. +% +% The marginal headings these commands print are the actual control +% sequences in which the definitions are stored. +% \begin{macrocode} +%<*enccmds> +\NewMacroEnvironment{enccommand}{% + \XD@grab@harmless@asmacro \XD@grab@oarg +}{2}{\MacroFont\Bslash \ifx\NoValue#2?\else#2\fi \Bslash #1}{% + \XDMainIndex{% + \LevelSorted{#1}{\texttt{\Bslash#1}}% + \ifx \NoValue#2% + \LevelSame{default}% + \else + \LevelSorted{#2}{\texttt{#2} encoding}% + \fi + }% +}{{#1}{\texttt{\Bslash#1}}}{\DoNotIndexHarmless{#1}} +% \end{macrocode} +% \begin{macrocode} +\NewMacroEnvironment{enccomposite}{% + \XD@grab@harmless@asmacro \XD@grab@marg \XD@grab@harmless\relax +}{3}{\MacroFont\Bslash#2\Bslash#1-#3}{% + \XDMainIndex{% + \LevelSorted{#1}{\texttt{\Bslash#1}}% + \LevelSorted{#2}{\texttt{#2} encoding}% + \LevelSorted{\XD@unbackslash#3\@empty}{\texttt{#3} composite}% + }% +}{{#1}{\texttt{\Bslash#1}}}{\DoNotIndexHarmless{#1}} +%</enccmds> +% \end{macrocode} +% In the file \texttt{cyoutenc.dtx} the definitions of many +% encoding-specific commands are written so that the same line of +% code can work is all four files \texttt{t2aenc.def}, +% \texttt{t2benc.def}, \texttt{t2cenc.def}, and \texttt{x2enc.def}. +% Therefore the \meta{encoding} argument of the \texttt{enccommand} +% and \texttt{enccomposite} environments should perhaps rather be a +% comma-separated list of encodings than a single encoding, but that +% would make this example unnecessarily complicated. +% \end{environment}\end{environment} +% +% +% +% \section{Describing macros and the like} +% \label{Sec:Describing} +% +% \begin{macro}{\if@mparswitch} +% \begin{macro}{\if@reversemargin} +% In two-sided mode, marginal notes should appear in the outer +% margin. The following code takes care of that. +% \begin{macrocode} +%<*pkg> +\if@twoside + \@mparswitchtrue + \normalmarginpar +\fi +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\GenericDescribePrint} +% \changes{prot2}{2000/07/14}{\cs{leavevmode} and \cs{ignorespaces} +% moved to \cs{NewDescribeCommand}. (LH)} +% \changes{prot2}{2000/07/20}{Added \cs{strut}. Removed it from +% arguments passed to \cs{GenericDescribePrint}. (LH)} +% \changes{prot2.3}{2001/06/24}{Changed formatting to match that of +% \cs{XDParToMargin}. (LH)} +% The |\GenericDescribePrint| macro is a utility macro for use in +% commands like |\Describe|\-|Macro|. Its syntax is +% \begin{quote} +% |\GenericDescribePrint|\marg{text} +% \end{quote} +% and it puts \meta{text} in a marginal paragraph, giving it the +% appropriate justification for appearing in that margin. +% +% The first part simply tests whether the argument fits on a single +% line. +% \begin{macrocode} +\newcommand\GenericDescribePrint[1]{% + \setbox\z@=\vbox{% + \parindent=\z@ + \leftskip=\z@skip + \rightskip=\z@\@plus 1fil% + \parfillskip=\z@skip + \hsize=\marginparwidth + \linepenalty=\@m + \color@begingroup + \noindent\ignorespaces #1\@@par + \color@endgroup + \expandafter}% + \expandafter\ifnum \the\prevgraf<\tw@ +% \end{macrocode} +% Then comes the actual typesetting. First the single-line format. +% The braces in the optional argument are there to prevent trouble +% in case |#1| contains a right brace; they will be stripped off when +% the argument is grabbed. +% \begin{macrocode} + \if@twoside + \marginpar[{\raggedleft\strut #1}]{\raggedright\strut #1}% + \else + \marginpar{\raggedleft\strut#1}% + \fi + \else + \if@twoside + \marginpar[{% + \leftskip=\z@ \@plus \marginparwidth + \rightskip=\leftskip + \parfillskip=\z@ \@plus -\marginparwidth + \noindent\nobreak\hskip\parfillskip + \ignorespaces #1% + }]{% + \leftskip=\z@ \@plus \marginparwidth + \rightskip=\leftskip + \parfillskip=\z@ \@plus 1fil% + \noindent\nobreak\hskip\parfillskip + \ignorespaces #1% + }% + \else + \marginpar{% + \leftskip=\z@ \@plus \marginparwidth + \rightskip=\leftskip + \parfillskip=\z@ \@plus -\marginparwidth + \noindent\nobreak\hskip\parfillskip + \ignorespaces #1% + }% + \fi + \fi +} +% \end{macrocode} +% \end{macro} +% +% The \texttt{describe}-commands are supposed to be invisible---only +% leave a single space even when there are spaces both before and after +% them---but there are problems with the mechanisms for this. I get the +% impression that they have never worked perfectly, but that seems to +% be mainly due to that certain macros in the \LaTeX\ kernel never did +% either, and I suspect that the general problem has been thrashed over +% many times before. +% +% \package{doc}'s |\DescribeMacro| and |\DescribeEnv| are wrapped up in +% a |\@bsphack| \dots\ |\@esphack| ``group'' to become invisible, but +% the |\marginpar| and various index commands they are built on are +% themselves already invisible, so one would suspect that there is no +% need for additional invisibility. There are however two factors which +% create this need. One is that it doesn't do the right thing at +% beginning of lines; here it seems like what the +% \texttt{describe}-commands would need is the |\@vbsphack| macro +% (whose definition appears in \texttt{ltspace.dtx}, but which has been +% commented out) since they should start a new paragraph and leave no +% following space if they are used in vertical mode. The other factor is +% that the standard |\@bsphack|--|\@esphack| can only suppress every +% second intermediate space if several invisible commands appear in +% sequence, as is quite common for the +% \texttt{describe}-commands.\footnote{It would seem that a simple fix +% for this is to have \cs{@esphack} insert \cs{nobreak} +% \cs{hskip}\texttt{-}\cs{@savsk} \cs{hskip}\cs{@savsk} before it +% executes \cs{ignorespaces}, but since that fix hasn't been +% incorporated into the kernel or the \package{fixltx2e} package there +% probably is some problem with it.} +% +% Instead the \package{doc} implementations of |\DescribeMacro| and +% |\DescribeEnv| begin with |\leavevmode| and end with |\ignorespaces|, +% which means that they are only ``invisible'' if they appear on on the +% left of visible material, but that's how it has been for over a decade +% now. +% +% \begin{macro}{\NewDescribeCommand} +% \changes{prot2}{2000/07/14}{Command added. (LH)} +% The |\NewDescribeCommand| command is a relative to the +% |\New|\-|Macro|\-|Environment| command which defines commands +% analogous to |\Describe|\-|Macro| rather than \texttt{macro}-like +% environments. Its syntax is +% \begin{quote} +% |\NewDescribeCommand|\marg{command}\marg{grabbers}\B +% \marg{numargs}\B\marg{definition} +% \end{quote} +% \meta{command} is the control sequence to define. \meta{grabbers} +% and \meta{numargs} are as for the |\NewMacroEnvironment| command. +% \meta{definition} is the command definition. +% In addition to the definition given in the \meta{definition} +% argument and the code for grabbing the arguments, the command +% actually defined by |\New|\-|Describe|\-|Command| will contain a +% |\leavevmode| at the start and an |\ignorespaces| at the end. +% +% The |\NewDescribeCommand| command should really just be a call to +% \package{xparse}'s |\Declare|\-|Document|\-|Command|, but that will +% have to wait until \package{xdoc} becomes based on the +% \package{xparse} package. +% \begin{macrocode} +\newcommand\NewDescribeCommand[4]{% + \@ifdefinable#1{% + \expandafter\def \expandafter#1\expandafter{% + \expandafter\XD@grab@arguments \csname\string#1\endcsname{#2}% + }% + \let\l@ngrel@x\relax + \expandafter\@yargdef \csname\string#1\endcsname \@ne {#3}% + {\leavevmode#4\ignorespaces}% + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\DescribeMacro} +% \changes{prot2.1}{2000/11/18}{Using \cs{MakeSortKey}. (LH)} +% \begin{macro}{\DescribeEnv} +% The |\DescribeMacro| and |\DescribeEnv| commands are as in +% \package{doc}. The argument of |\DescribeMacro| is supposed to be +% the actual control sequence to describe (not as with the +% \texttt{macro} environment something which looks like the control +% sequence after being |\string|ed). +% \begin{macrocode} +\let\DescribeMacro=\relax +\NewDescribeCommand\DescribeMacro{\XD@grab@harmless@cs}{1}{% + \GenericDescribePrint{\MacroFont\Bslash#1}% + \MakeSortKey\@tempa{#1}{}% + \IndexEntry{% + \LevelSorted{\@tempa}{\texttt{\Bslash#1}}% + }{usage}{\thepage}% +} +% \end{macrocode} +% The argument of |\DescribeEnv|, on the other hand, is treated like +% that of the \texttt{environment} environment, but backslash isn't +% given catcode 12---only the catcode assignments in +% |\Make|\-|Private|\-|Letters| are made. +% \begin{macrocode} +\let\DescribeEnv=\relax +\NewDescribeCommand\DescribeEnv{% + \XD@grab@harmless@withprivate\relax +}{1}{% + \GenericDescribePrint{\MacroFont#1}% + \IndexEntry{% + \LevelSame{environments:}\LevelSorted{#1}{\texttt{#1}}% + }{usage}{\thepage}% + \IndexEntry{% + \LevelSorted{#1}{\texttt{#1} (environment)}% + }{usage}{\thepage}% +} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\describeoption} +% \changes{prot2}{2000/07/31}{Command added---I realised that the need +% to describe options is probably as large as that to mark out +% their definition. (LH)} +% The |\describeoption| command is the \texttt{describe}-companion to +% the \texttt{option} environment. +% \begin{macrocode} +\NewDescribeCommand\describeoption{\XD@grab@harmless\relax}{1}{% + \GenericDescribePrint{\MacroFont#1 \normalfont option}% + \IndexEntry{% + \LevelSame{options:}\LevelSorted{#1}{\texttt{#1}}% + }{usage}{\thepage}% + \IndexEntry{% + \LevelSorted{#1}{\texttt{#1} option}% + }{usage}{\thepage}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\describecsfamily} +% \changes{prot2}{2000/07/14}{Renamed \cs{DescribeCSFamily} and +% incorporated the code from \cs{XD@index@family}. (LH)} +% \changes{prot2.1}{2000/11/18}{Using \cs{MakeSortKey}. (LH)} +% The |\describecsfamily| command is for marking out sections in text +% where a particular family of control sequences is described---just +% like |\DescribeMacro| does for individual commands. To clarify what +% I mean by a control sequence family, here are a couple of examples: +% \begin{longtable}{l >{\raggedright}p{0.55\linewidth}} +% |\c@|\meta{counter}\label{Tab:CS-families}& +% countdef token for the |\count| register storing the +% \LaTeX\ counter \meta{counter}\tabularnewline +% |\ps@|\meta{pagestyle}& +% macro storing settings for the pagestyle \meta{pagestyle}^^A +% \tabularnewline +% |\|\meta{enc}|/|\meta{fam}|/|\meta{ser}|/|\meta{sh}|/|\meta{sz}& +% the fontdef token for the font which has encoding \meta{enc}, +% family \meta{fam}, series \meta{ser}, shape \meta{sh}, and +% size \meta{sz} under NFSS\tabularnewline +% |\|\meta{enc}|\|\meta{cmd}& +% the macro containing the definition for encoding \meta{enc} of +% the encoding-specific \LaTeX\ command |\|\meta{cmd}^^A +% \tabularnewline +% |\fps@|\meta{type}& +% the default placement specifier for \LaTeX\ floats of type +% \meta{type}\tabularnewline +% |\l@|\meta{name}& +% a macro which formats table of contents entries for items of +% type \meta{name} (\texttt{chapter}, \texttt{section}, etc.)^^A +% \tabularnewline +% |\l@|\meta{language}& +% the |\language| number \package{babel} has allocated for the +% language \meta{language} (\texttt{english}, \texttt{french}, +% etc.)\tabularnewline +% |\i-|\meta{int}& +% the control sequence (either a mathchardef token or a macro) +% which stores the value of the \package{fontinst} integer +% \meta{int} +% \end{longtable} +% +% The syntax for |\describecsfamily| is +% \begin{quote} +% |\describecsfamily|\marg{cs-fam specification} +% \end{quote} +% The \meta{cs-fam specification} includes only what would be put +% between |\csname| and |\endcsname|; the |\describecsfamily| command +% will add a backslash when printing the name. No special catcodes +% will be in force in the argument, but the |#|, |$|, |&|, |_|, |^|, +% and |~| characters present no problems even if they have their +% ordinary catcodes. All spaces are seen as ASCII space and \TeX\ is +% skipping spaces as usual. Characters with catcode 0, 1, 2, 5, 9, 14, +% or 15 may however be problematic. +% If you need to specify such a problematic character then you can do +% so by writing |\PrintChar|\marg{code}, where \meta{code} is the +% ASCII code for the character, as a valid \TeX\ number in the range +% 0--255. In case you do not remember the ASCII code for some +% character \meta{c}, there is no harm in specifying it as +% |`\|\meta{c}, e.g. |\PrintChar{`\}}| for a right brace. It is even +% possible to write |\PrintChar| commands for characters outside +% visible ASCII (but those are typeset as |^^|-sequences). +% +% The variant parts in the control sequence names are specified as +% \begin{quote} +% |\meta|\marg{text} +% \end{quote} +% and these will be typeset exactly as in normal text. The arguments +% of |\meta|s appearing in a \meta{cs-fam specification} are moving. +% All control sequences other than |\PrintChar| and |\meta| in a +% \meta{cs-fam specification} (and which do not appear in the argument +% of a |\PrintChar| or |\meta|) are essentially treated as if they +% had been |\string|ed. +% +% Apart from the above differences in treatment of the argument, the +% |\describe|\-|cs|\-|family| command is similar to +% |\DescribeMacro|---it prints the control sequence name in the margin +% and makes a \texttt{usage} index entry. +% \begin{macrocode} +\NewDescribeCommand\describecsfamily{\XD@grab@harmless{}}{1}{% + \GenericDescribePrint{% + \MetaNormalfont\MacroFont\Bslash#1% + }% + \MakeSortKey\@tempa{#1}{\def\meta##1{(##1)}}% + \IndexEntry{% + \LevelSorted{\@tempa}{\texttt{\protect\MetaNormalfont\Bslash#1}}% + }{usage}{\thepage}% +} +%</pkg> +% \end{macrocode} +% \end{macro} +% +% +% As for |\NewMacroEnvironment|, I also give an example of an +% application of |\NewDescribeCommand| which is much too special for +% including in \package{xdoc} in general and therefore the code is +% placed in a special module. I had originally written the code as part +% of another package, but I removed it because I thought it was a bit +% too special even for that context. The commentry below is kept +% unchanged.\changes{prot2.1}{2000/09/16}{Additional +% \cs{NewDescribeCommand} code example added. (LH)} +% +% \begin{quotation} +% +% I believe this feature is primarily of interest for MacOS programs, +% but there might be sufficiently similar structures in other operating +% systems to make it useful even in other contexts. Be as it may, what +% the feature described here does is that it allows the user to put an +% entry in the index for each resource in the code. This gives an easy +% way of checking that no two resources are assigned the same id, even +% though there is no mechanism for especially warning for such +% collisions. +% +% \begin{macro}{\DescribeResource} +% The main command available is +% \begin{quote} +% |\DescribeResource|\marg{type}\marg{id}\marg{text} +% \end{quote} +% \meta{type} is a four-character string. Most special characters are +% treated as ordinary ones (very useful for |#|s), but the visible +% ASCII characters |%|, |{|, |\|, and |}| retain their usual meaning. +% To use such a troublesome character \meta{c} in a resource type, +% write it as |\PrintChar{`\|\meta{c}|}|. \meta{id} is a \TeX\ number; +% it will be used as the number of the resource. \meta{text} is normal +% text that will be put in the index entry to describe the resource; it +% seems a good idea to use the name of the resource for this. \meta{id} +% and \meta{text} are read with normal \LaTeX\ catcodes. Note that +% \meta{text} is a moving argument. +% +% |\DescribeResource| does two things---it prints the \meta{type} and +% \meta{id} of the resource in the margin, and it writes an entry +% \begin{quote} +% \meta{type} resources:\\ +% \vadjust{}\qquad\meta{id}\\ +% \vadjust{}\qquad\qquad\meta{text} +% \end{quote} +% (plus a lot of formatting not shown here) to the \texttt{.idx} file. +% The reference is for the page. +% +% The idea with advancing |\count@| like that when constructing the +% index entry is to get a sort key for which lexicographic order equals +% the wanted order. This would not be the case if the number was simply +% written down. The current code maps numbers to six-digit positive +% integers, but five-digits integers would be sufficient (a resource +% \meta{id} is a signed 16-bits integer). The construction chosen +% here furthermore puts the negative numbers after the positive ones. +% \begin{macrocode} +%<*rsrccmd> +\NewDescribeCommand\DescribeResource{% + \XD@grab@harmless\relax \XD@grab@marg \XD@grab@marg +}{3}{% + \GenericDescribePrint{#1% + \textnormal{:\ifnum#2<\z@ \textminus\number-\else\number\fi#2}% + }% + \count@=#2\relax + \advance \count@ 100000\ifnum \count@<\z@ 0\fi \relax + \protected@edef\@tempa{% + \noexpand\LevelSorted{\the\count@}{% + \ifnum #2<\z@ \string\textminus \number-\else\number\fi#2% + }% + }% + \IndexEntry{% + \LevelSorted{#1 resources:}{\texttt{#1} resources:}% + \@tempa + \LevelSame{#3}% + }{usage}{\thepage}% +} +%</rsrccmd> +% \end{macrocode} +% \end{macro} +% +% \end{quotation} +% +% +% \section{The \cs{DocInclude} command} +% \label{Sec:DocInclude} +% +% The code in this section is based on code from the \package{ltxdoc} +% document class~\cite{ltxdoc} and it implements a command called +% |\DocInclude|. Two implementations of this command are given: one +% which is essentially that of \package{ltxdoc} (preserving all its +% peculiarities), and one which is a reimplementation from scratch. The +% default is to use the latter, but passing the \texttt{olddocinclude} +% option to \package{xdoc} selects the former. +% +% +% \subsection{Old implementation} +% +% It should be observed that this is not a complete implementation of the +% |\Doc|\-|Include| command---it only redefines the \package{ltxdoc} +% macros that need to be changed if the |\Doc|\-|Include| command is to +% work with \package{xdoc} (it doesn't for example change the definition +% of |\Doc|\-|Include| itself). Furthermore it doesn't define anything if +% the \package{ltxdoc} document class hasn't been loaded, since then the +% details of the definition of |\Doc|\-|Include| (even if it would be +% defined) are unknown. +% +% \begin{macro}{\CodelineIndex} +% \changes{prot2.1}{2000/10/08}{Using \cs{thecodelineno}. (LH)} +% \begin{macro}{\filesep} +% \changes{prot2.2}{2001/02/13}{Redefined to use +% \cs{XD@page@compositor}. (LH)} +% \begin{macro}{\@docinclude} +% \package{ltxdoc} redefines |\codeline@wrindex| so that |\filesep| is +% prepended to each codeline number that is written to the index file. +% That redefinition has no effect unless the |\Codeline|\-|Index| +% command is executed afterwards however, so there is no harm in having +% |\Codeline|\-|Index| itself apply the corresponding change. +% \begin{macrocode} +%<*pkg> +\@ifpackagewith{xdoc2}{olddocinclude}{% + \@ifclassloaded{ltxdoc}{% + \renewcommand\CodelineIndex{% + \makeindex + \let\XD@if@index=\@firstoftwo + \codeline@indextrue + \def\TheXDIndexNumber{\filesep\thecodelineno}% + }% +% \end{macrocode} +% The |\filesep| macro is redefined so that the \package{docindex} +% package~\cite{docindex} can use a |page_compositor| string different +% from the default |-| simply by redefining |\XD@page@compositor|. +% This redefinition has to be put in |\docincludeaux| since that macro +% redefines |\filesep| too. +% \begin{macrocode} + \expandafter\def \expandafter\docincludeaux \expandafter{% + \docincludeaux + \gdef\filesep{\thepart\XD@page@compositor}% + } +% \end{macrocode} +% The change to |\@docinclude| merely consists of inserting code for +% writing an |External|\-|XRef|\-|Wrap| to the \texttt{.aux} file to +% record the new value of the \texttt{part} counter. +% \begin{macrocode} + \def\@docinclude#1 {% + \clearpage + \if@filesw + \immediate\write\@mainaux{\string\@input{#1.aux}}% + \fi + \@tempswatrue + \if@partsw + \@tempswafalse + \edef\@tempb{#1}% + \@for\@tempa:=\@partlist\do{% + \ifx\@tempa\@tempb\@tempswatrue\fi + }% + \fi + \if@tempswa + \let\@auxout\@partaux + \if@filesw + \immediate\openout\@partaux #1.aux + \immediate\write\@partaux{\relax}% + \fi + \part{#1.dtx}% + \if@filesw + \immediate\write\@partaux{\@percentchar\@percentchar + ExternalXRefWrap {\filesep} {}% + }% + \fi + {% + \let\ttfamily\relax + \xdef\filekey{% + \filekey, \thepart={\ttfamily\currentfile}% + }% + }% + \DocInput{#1.dtx}% + \clearpage + \@writeckpt{#1}% + \if@filesw \immediate\closeout\@partaux \fi + \else + \@nameuse{cp@#1}% + \fi + \let\@auxout\@mainaux + } + }{} +}{} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% +% \subsection{New implementation} +% \label{Ssec:New DocInclude} +% +% The default action of the second implementation is to be precisely an +% |\include| variant of |\DocInput|, but in addition to that it also +% has a (one-argument) hook called |\docincludeaux| which is executed +% before a file is actually |\DocInput|ted, but after it has been +% determined that it should be included, and this hook is only executed +% for the files which should be |\include|d. This hook is normally +% |\@gobble|, but passing the \texttt{fileispart} option to +% \package{xdoc} redefines it to start a new part and set the pagestyle. +% +% \begin{macro}{\DocInclude} +% \begin{macro}{\@docinclude} +% Most of the code for the |\DocInclude| command is put in the +% |\@docinclude| macro; |\DocInclude| simply checks that it hasn't +% been nested. The main difference to |\include| is that a nested +% |\DocInclude| becomes an error plus the corresponding |\DocInput|, +% whereas a nested |\include| simply becomes an error. The rationale +% for this is that it is probably closer to what was intended. +% +% The argument of |\@docinclude| is, oddly enough, space-delimited. +% This is inherited from the |\@include| macro in the \LaTeX\ kernel, +% where it is a hack to make sure that the part \texttt{.aux} file +% that is opened for writing really gets the suffix \texttt{.aux} (in +% the worst case, \TeX\ could start overwriting a \texttt{.tex} file +% instead). +% \begin{macrocode} +\@ifpackagewith{xdoc2}{olddocinclude}{}{% + \def\DocInclude#1{% + \ifnum\@auxout=\@partaux + \@latexerr{\string\include\space cannot be nested}{% + Your \protect\DocInclude\space will be reduced to a + \protect\DocInput.% + }% + \DocInput{#1.dtx}% + \else \@docinclude#1 \fi + }% +% \end{macrocode} +% The only things in this |\@docinclude| that are not precisely as in +% |\@include| are the |\docincludeaux| and |\DocInput| commands. +% \begin{macrocode} + \def\@docinclude#1 {% + \clearpage + \if@filesw + \immediate\write\@mainaux{\string\@input{#1.aux}}% + \fi + \@tempswatrue + \if@partsw + \@tempswafalse + \edef\@tempb{#1}% + \@for\@tempa:=\@partlist\do{% + \ifx\@tempa\@tempb \@tempswatrue \fi + }% + \fi + \if@tempswa + \let\@auxout\@partaux + \if@filesw + \immediate\openout\@partaux #1.aux + \immediate\write\@partaux{\relax}% + \fi + \docincludeaux{#1.dtx}% + \DocInput{#1.dtx}% + \clearpage + \@writeckpt{#1}% + \if@filesw \immediate\closeout\@partaux \fi + \else + \deadcycles\z@ + \@nameuse{cp@#1}% + \fi + \let\@auxout\@mainaux + }% +}{} +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{option}{fileispart} +% \begin{macro}{\docincludeaux} +% The \texttt{fileispart} option works by (re)defining a couple of +% macros, of which the |\doc|\-|include|\-|aux| macro is the most +% important. Its syntax is +% \begin{quote} +% |\docincludeaux|\marg{filename} +% \end{quote} +% where \meta{filename} is the name of a file that will be inputted. +% The \texttt{fileispart} definition of this is to set |\currentfile| +% to the harmless character string of \meta{filename}, produce a +% |\part| heading whose text is that \meta{filename}, add the +% \meta{filename} to the |\filekey| macro, set the page style to +% \texttt{docpart}, clear the |\filedate|, |\fileversion|, and +% |\fileinfo| macros, and write an |External|\-|XRef|\-|Wrap| +% XXR-command to the \texttt{.aux} file to record the new codeline +% number prefix. +% \begin{macrocode} +\@ifpackagewith{xdoc2}{olddocinclude}{\iffalse}{ + \@ifpackagewith{xdoc2}{fileispart}{\iftrue}{ + \let\docincludeaux=\@gobble + \iffalse + } +} % If fileispart and not olddocinclude then + \def\docincludeaux#1{% + \MakeHarmless\currentfile{#1}% + \part{\texttt{\currentfile}}% + \pagestyle{docpart}% + \let\filedate\@empty + \let\fileversion\@empty + \let\fileinfo\@empty + \protected@xdef\filekey{% + \filekey, \thepart=\texttt{\currentfile}% + }% + \if@filesw + \immediate\write\@partaux{\@percentchar\@percentchar + ExternalXRefWrap {\thepart\XD@page@compositor} {}% + }% + \fi + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\CodelineIndex} +% \changes{prot2.1}{2000/10/08}{Using \cs{thecodelineno}. (LH)} +% The \texttt{fileispart} option also adds the \texttt{codelineno} +% counter to the reset list for \texttt{part} and changes the format +% of codeline numbers written to the index. +% \begin{macrocode} + \@ifclassloaded{ltxdoc}{}{\@addtoreset{codelineno}{part}}% + \renewcommand\CodelineIndex{% + \makeindex + \let\XD@if@index=\@firstoftwo + \codeline@indextrue + \def\TheXDIndexNumber{\thepart\XD@page@compositor\thecodelineno}% + }% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\partname} +% \begin{macro}{\thepart} +% \begin{macro}{\IndexParms} +% Finally there are a couple of macros which are redefined for +% aesthetic rather than technical reasons. Passing the +% \texttt{fileispart} option sets |\partname| to \texttt{File}, sets +% |\thepart| to |\aalph{part}|, and adds a setting of pagestyle to +% |\IndexParms|. (The pagestyle setting is added to +% |\index@|\B|prologue| by \package{ltxdoc}, but I think +% |\Index|\-|Parms| is more appropriate.) +% \begin{macrocode} + \def\partname{File} + \def\thepart{\aalph{part}} + \expandafter\def \expandafter\IndexParms + \expandafter{\IndexParms \pagestyle{docindex}} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro} +% +% In case the index formatting is handled by the \package{docindex} +% package~\cite{docindex} (or its \LaTeXe\ incarnation +% \package{docidx2e}), the above addition to |\Index|\-|Parms| won't +% have any effect. Therefore \package{xdoc} also passes the +% \texttt{use}\-\texttt{doc}\-\texttt{index}\-\texttt{ps} option on +% to these packages. +% \begin{macrocode} + \PassOptionsToPackage{usedocindexps}{docindex} + \PassOptionsToPackage{usedocindexps}{docidx2e} +\fi +% \end{macrocode} +% \end{option} +% +% \begin{macro}{\ps@docpart} +% \begin{macro}{\setfileinfo} +% \begin{macro}{\XD@set@file@info} +% The \texttt{docpart} pagestyle is for pages made from the +% |\DocInclude|d files. The page footers contain the page number, the +% part (file) number, and the current file name. It also contains the +% file date and version if that information is available. +% +% \package{ltxdoc} uses |\GetFileInfo| to get the date and version +% information, but that's a very peculiar practice. The data one wants +% to present are about the file being typeset---typically the version +% of the package that is documented in this file---whereas the +% |\GetFileInfo| command really extracts information about +% \emph{unpacked} classes, packages, and similar files---files that +% contribute to the typesetting by defining commands, not by containing +% text. Such information may be of interest for documents which contain +% alternative code for incompatible versions of for example a package, +% but it is of no use for printing version information as above since +% the version of a package used for typesetting a \texttt{.dtx} file +% need not be the version actually contained in that \texttt{.dtx} +% file. Thus the only way to make this work is by doing as the \LaTeX\ +% kernel source and include |\ProvidesFile| commands for the +% \texttt{.dtx} file in each such file, which is a rather peculiar use +% of the |\ProvidesFile| command. +% +% The |\setfileinfo| command provides an equivalent feature in a less +% roundabout way. It has the syntax +% \begin{quote} +% |\setfileinfo[|\meta{date}\verb*+ +\meta{version}\verb*+ +^^A +% \meta{info}|]| +% \end{quote} +% and it sets |\filedate| to \meta{date}, |\fileversion| to +% \meta{version}, and |\fileinfo| to \meta{info} if the optional +% argument is present; if the optional argument is missing or contains +% fewer than three words then the missing fields are set to |?|. +% +% \begin{macrocode} +\@ifpackagewith{xdoc2}{olddocinclude}{}{% + \def\ps@docpart{% + \def\@oddfoot{% + File: \texttt{\currentfile}% + \ifx \filedate\@empty \else \ Date: \filedate\fi + \ifx \fileversion\@empty \else \ Version: \fileversion\fi + \hfill\thepage + }% + \if@twoside + \def\@evenfoot{% + \thepage\hfill + File: \texttt{\currentfile}% + \ifx \filedate\@empty \else \ Date: \filedate\fi + \ifx \fileversion\@empty \else \ Version: \fileversion\fi + }% + \else \let\@evenfoot\@oddfoot \fi + } +% \end{macrocode} +% The corresponding definition in \package{ltxdoc} (there it appears in +% |\docincludeaux|) is peculiar in that the odd page footer is set +% globally but the even page footer only locally. +% +% The definition of |\setfileinfo| follows that of |\GetFileInfo| +% except for the fact that the |\relax|es have been replaced by +% |\@empty|s. +% \begin{macrocode} + \newcommand\setfileinfo[1][]{% + \edef\@tempa{#1}% + \expandafter\XD@set@file@info \@tempa\@empty? ? \@empty\@empty + } + \def\XD@set@file@info#1 #2 #3\@empty#4\@empty{% + \def\filedate{#1}% + \def\fileversion{#2}% + \def\fileinfo{#3}% + } +}{} +% \end{macrocode} +% The reason for making the argument of |\setfileinfo| optional is +% that with the |\Provides|\-|File| practice one can (potentially) put +% all date and version information in one place through tricks like +% \iffalse +%<*example> +% \fi +%\begin{verbatim} +%% \begin{macrocode} +%\ProvidesPackage{foobar} +%% \end{macrocode} +%% \ProvidesFile{foobar.dtx} +% [2000/02/02 v1.0 Silly example package] +%% +%\end{verbatim}\iffalse +%</example> +% \fi +% By making the argument of |\setfileinfo| optional, I make sure that +% people who have used such tricks only have to replace the +% |\ProvidesFile{foobar.dtx}| by |\setfileinfo|. +% \end{macro}\end{macro}\end{macro} +% +% +% \begin{macro}{\ps@docindex} +% \begin{macro}{\filekey} +% The \texttt{docindex} pagestyle is for the index in +% \texttt{fileispart} documents. It prints a file key, which is a +% list of all the included files and their corresponding part letters, +% at the bottom of every page. The file key is stored in the macro +% |\filekey|, which should have been constructed file by file as they +% are included. To add a file to the file key, it is recommended that +% you do +% \begin{quote} +% |\protected@xdef\filekey{\filekey, |\meta{entry for new file}|}| +% \end{quote} +% The \texttt{fileispart} version of |\docincludeaux| already does +% this. The initial value of |\filekey| is |\@gobble| so that the +% comma before the first entry is removed. The |\@empty| below is +% there in case no entry has been inserted. +% \begin{macrocode} +% \@ifpackagewith{xdoc2}{olddocinclude}{}{% + \def\ps@docindex{% + \def\@oddfoot{% + \parbox{\textwidth}{% + \strut\footnotesize\raggedright + \textbf{File Key:} \filekey\@empty + }% + }% + \let\@evenfoot\@oddfoot + }% + \let\filekey\@gobble +% } +% \end{macrocode} +% \end{macro}\end{macro} +% +% It should be observed that since |\ps@docindex| only sets the page +% style locally, the page style will revert to its previous setting at +% the end of the \texttt{theindex} environment. As that previous +% setting is probably that of the \texttt{docpart} page style, you +% might have to set the page style manually. +% +% \begin{macro}{\aalph} +% \begin{macro}{\@aalph} +% |\aalph| is a variant of |\alph| which continues with the upper case +% letters for 27--52. It is defined by \package{ltxdoc}, so it is +% merely provided here. +% \begin{macrocode} +\providecommand*\aalph[1]{\@aalph{\csname c@#1\endcsname}} +\providecommand*\@aalph[1]{% + \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or + j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or + t\or u\or v\or w\or x\or y\or z\or A\or B\or C\or + D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or + N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or + X\or Y\or Z\else\@ctrerr\fi +} +% \end{macrocode} +% In \texttt{source2e.tex} one can see that \package{doc}'s standard +% \texttt{gind.ist} index style file won't sort the 35th file (part +% \texttt{I}) correctly since it causes \package{makeindex} to read an +% \texttt{I} as ``upper case Roman numeral one'', but I doubt very +% many people encounter that problem in their projects. +% \end{macro}\end{macro} +% +% \begin{macro}{\XD@page@compositor} +% \changes{prot2.2}{2001/02/13}{Macro added, other macros changed to +% use it. (LH)} +% The |\XD@page@compositor| macro contains the string which is put +% between the parts of a composite number in the index; it +% corresponds to the |page_compositor| parameter of +% \package{makeindex}. +% \begin{macrocode} +\providecommand*\XD@page@compositor{-} +% \end{macrocode} +% \end{macro} +% +% +% +% \section{Miscellanea} +% +% \subsection{Some \LaTeXplus\ stuff} +% +% \begin{macro}{\BooleanFalse} +% \begin{macro}{\BooleanTrue} +% \begin{macro}{\NoValue} +% These three macros are borrowed from the \package{xparse} +% package~\cite{xparse}, where they work as the three values +% \emph{boolean false}, \emph{boolean true}, and \emph{absence of +% value} respectively. The definitions are taken from +% \package{xparse} v\,0.17 (1999/09/10). +% \begin{macrocode} +\@ifundefined{BooleanFalse}{\def\BooleanFalse{TF}}{} +\@ifundefined{BooleanTrue}{\def\BooleanTrue{TT}}{} +\@ifundefined{NoValue}{\def\NoValue{-NoValue-}}{} +% \end{macrocode} +% By using these macros (rather than some homegrown set of macros +% or tokens) for denoting these values here I hopefully simplify a +% transition to \LaTeXplus, but I don't want to rely on \LaTeXplus\ +% since it hasn't been released yet. +% \end{macro}\end{macro}\end{macro} +% +% +% \subsection{The \cs{meta} command} +% +% A reimplementation which has already (as of v\,2.0k) found its way into +% the \package{doc} package is the one that the |\meta| command is made +% robust, but since some people might still have older +% versions of \package{doc} and since that feature is needed for +% |\describe|\-|cs|\-|family|, I apply it here too. First I check +% whether the definition of |\meta| is the old non-robust definition, +% and only apply the fix if it is. +% \begin{macrocode} +\begingroup +\obeyspaces% +\catcode`\^^M\active% +\gdef\@gtempa{\begingroup\obeyspaces\catcode`\^^M\active% +\let^^M\do@space\let \do@space% +\def\-{\egroup\discretionary{-}{}{}\hbox\bgroup\itshape}% +\m@ta}% +\endgroup +\ifx \meta\@gtempa +% \end{macrocode} +% +% \begin{macro}{\l@nohyphenation} +% The new implementation needs a |\language| without any hyphenation +% patterns. By switching to that language, one can inhibit +% hyphenation in a piece of text regardless of what line-breaking +% parameter settings are in force when the paragraph is actually +% broken. This new language will be called \texttt{nohyphenation} and +% it is only allocated if it isn't already known (since some +% \package{babel} settings files already defines this |\language|). +% \begin{macrocode} + \@ifundefined{l@nohyphenation}{\newlanguage\l@nohyphenation}{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\meta} +% \begin{macro}{\meta@font@select} +% This is the definition of |\meta| from \package{doc} v\,2.0m. For +% an explanation of the implementation, se a \texttt{doc.dtx} at least +% that new or entry \texttt{latex/3170} in the \LaTeX\ bugs database. +% \begin{macrocode} + \DeclareRobustCommand\meta[1]{% + \ensuremath\langle + \ifmmode \expandafter \nfss@text \fi + {% + \meta@font@select + \edef\meta@hyphen@restore + {\hyphenchar\the\font\the\hyphenchar\font}% + \hyphenchar\font\m@ne + \language\l@nohyphenation + #1\/% + \meta@hyphen@restore + }\ensuremath\rangle + } +% \end{macrocode} +% \begin{macrocode} + \let\meta@font@select=\itshape +\fi +% \end{macrocode} +% \end{macro}\end{macro} +% +% \begin{macro}{\MetaNormalfont} +% \changes{prot2}{2000/07/24}{Removed robustness; protected it +% explicitly wherever needed instead. (LH)} +% The |\MetaNormalfont| command redefines |\meta@font@select| to do a +% |\normal|\-|font| before the |\itshape|. It is useful if |\meta| is +% going to be used to make |\rmfamily| interjections in |\ttfamily| +% text. +% \begin{macrocode} +\newcommand\MetaNormalfont{\def\meta@font@select{\normalfont\itshape}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\XD@harmless\meta} +% This macro is needed for making |\meta| behave as described in the +% argument of |\describe|\-|cs|\-|family|, i.e., in text which is +% going to be converted into a harmless character string. +% \begin{macrocode} +\@namedef{XD@harmless\string\meta}#1{% + \toks@=\expandafter{\the\toks@ \meta{#1}}% + \XD@harmless@ +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{The checksum feature} +% +% The checksum mechanism in \package{doc} is a remnant from the times +% when file truncation was a common problem and a mechanism for +% detecting this was a great help.\footnote{Even though I suspect that +% the recommended use of it---to put the checking \cs{Finale} at the +% end of the \texttt{.dtx} file---may have reduced its usefulness +% dramatically, as that \cs{Finale} would have been the one thing that +% surely disappears if the file is truncated.} Today its main usefulness +% seems to lie in that it distinguishes versions of a file that are +% ``being worked on'' (where the checksum probably doesn't match) from +% versions of a file that are ``polished and ready for upload'' +% (someone has bothered to fix the checksum), and as it exists it might +% as well stay. There is a problem however with files which do not +% contain \TeX\ code, as simply counting backslashes quite probably +% isn't a good (or even reasonable) way of forming a checksum for these +% files (if the checksum turns out to be zero, \package{doc} will +% complain no matter what you do). +% +% \begin{macro}{\check@checksum} +% \changes{prot2.1}{2000/10/02}{Redefinition added. (LH)} +% For that reason, the |\check@checksum| macro is redefined to only +% write the ``no checksum'' warning to the log file if the checksum +% hasn't been set. +% \begin{macrocode} +\renewcommand\check@checksum{% + \relax + \ifnum \check@sum=\z@ + \PackageInfo{doc}{This macro file has no checksum!\MessageBreak + The checksum should be \the\bslash@cnt}% + \else\ifnum \check@sum=\bslash@cnt + \typeout{*******************}% + \typeout{* Checksum passed *}% + \typeout{*******************}% + \else + \PackageError{doc}{Checksum not passed (\the\check@sum + <>\the\bslash@cnt)}{The file currently documented seems + to be wrong.\MessageBreak Try to get a correct version.}% + \fi\fi + \global\check@sum\z@ +} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{The \cs{theCodelineNo} situation} +% \label{Ssec:CodelineNo} +% +% \changes{prot2.1}{2000/10/08}{\cs{theCodelineNo} situation cleared +% up. (LH)} +% \package{doc} incorporates formatting of the value of the +% \texttt{CodelineNo} counter in the |\theCodelineNo| macro, which is a +% bit awkward since it prevents using this macro in making e.g.\ index +% entries. To get around this, \package{xdoc} introduces the alternative +% name \texttt{codelineno} for this counter so that |\thecodelineno| can +% produce the value representation without formatting. +% +% \begin{macro}{\c@codelineno} +% \begin{macro}{\cl@codelineno} +% \begin{macro}{\p@codelineno} +% \begin{macro}{\thecodelineno} +% The control sequences connected to the \texttt{codelineno} counter +% are |\let| so that they refer to the same |\count| register as the +% \texttt{CodelineNo} counter. Note that \texttt{CodelineNo} isn't a +% proper \LaTeX\ counter, so the macros |\cl@CodelineNo| and +% |\p@CodelineNo| are undefined. |\thecodelineno| is set to the default +% value for a new counter. +% \begin{macrocode} +\@ifundefined{c@codelineno}{}{% + \PackageInfo{xdoc2}{Overwriting codelineno counter}% +} +\let\c@codelineno=\c@CodelineNo +\let\cl@codelineno=\@empty +\let\p@codelineno=\@empty +\def\thecodelineno{\@arabic\c@codelineno} +% \end{macrocode} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{macro}{\PrintCodelineNo} +% The |\PrintCodelineNo| command is the new recommended command for +% printing the formatted form of the codeline number counter. People +% who write their own \texttt{macrocode}-like environments should use +% |\PrintCodelineNo| instead of \package{doc}'s |\theCodelineNo|. +% \begin{macrocode} +\newcommand\PrintCodelineNo{\reset@font\scriptsize\thecodelineno} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\theCodelineNo} +% Finally |\theCodelineNo| is redefined to reference +% |\PrintCodelineNo|. This is done for the sake of backwards +% compability; I didn't feel like redefining |\macro@code| just for +% the sake of changing the |\theCodelineNo| into a |\PrintCodelineNo|). +% \begin{macrocode} +\def\theCodelineNo{\PrintCodelineNo} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</pkg> +% \end{macrocode} +% +% +% \section{Problems and things to do} +% +% This section lists some problems that exist with the current +% implementations of commands in \package{xdoc}. The list is rather +% unstable---items are added as I realize there is a problem and removed +% when I find a solution---an in parts it is rather esoteric since most +% of the problems have only been found theoretically. +% +% \medskip +% +% One of the less well-known features of the |\verb| command is that +% it automatically inhibits the known syntactic ligatures. There is +% no such mechanism implemented for the harmless character strings, +% so some (in \TeX\ \texttt{macrocode} uncommon) character sequences +% (such as |!`|) may produce unwanted results. The quick hack to +% circumvent this is to use the |\SetHarmState| command to mark one +% of the characters involved as problematic, as the |\PrintChar| +% command is implemented so that the character it prints will not be +% involved in ligaturing or kerning. On the other hand, \package{doc} +% does nothing to suppress syntactic ligatures in macro or environment +% names when they are printed in the margin, so for that material the +% \package{xdoc} implementation might actually improve things, although +% it could perform worse for verbatim material in the index and list of +% changes. +% +% \medskip +% +% Things to do and\slash or think about: +% \begin{itemize} +% \item +% Examine how complicated it would be to convert the +% |\PrintChar| commands for visible characters in a harmless +% character string back to explicit characters, for possible use in +% sort keys. (This could be used to ensure that visible characters +% are sorted in strict ASCII order.) +% \item +% Should those ``letters'' which are commonly used as word +% separators---in \LaTeX\ code mainly |@|---be ignored when sort +% keys are being formed (just like the backslash is)? (This would +% require a change in the implementation of the \texttt{macro} +% environment.) +% +% A mechanism for doing this is included as of prototype version~2.1. +% \item +% Examine how much more efficient it would be to put temporary +% additions to the index exclude list in a separate list instead of +% the main list. This could be advantageous for deeply nested +% \texttt{macro} environments, as \TeX\ will otherwise store as many +% (almost identical and often rather long) copies of the exclude list +% as there are nested environments. +% +% When asked about it, Frank Mittelbach didn't think there was +% any gains worth mentioning in this. On the other hand it might be +% worth investigating reimplementations that avoid calling |\trivlist| +% at the beginning of each \texttt{macro}-like environment when they +% are nested, since |\trivlist| does quite a lot of assignments. +% +% \item +% In an automatically generated index one often faces the problem +% that the entries at the innermost level are best formatted in one +% way when there is only one, but in a completely different way when +% there are several of them. To get optimal formatting in both cases, +% one would like to let the |\item|, |\subitem|, |\subsubitem| or +% corresponding macros detect the situation in this respect and +% choose the optimal formatting at each case. +% +% A mechanism for this is implemented by the \package{docindex} +% package. +% \end{itemize} +% +% +% \begin{thebibliography}{9} +% \bibitem{ltxdoc} +% David Carlisle: +% \textit{The file \texttt{ltxdoc.dtx} for use with \LaTeXe}, +% The \LaTeX3 Project; ^^A , 1993~ff. +% \textsc{ctan}:\discretionary{}{}{\thinspace}\texttt{macros}\slash +% \texttt{latex}\slash \texttt{base}\slash \texttt{ltxdoc.dtx}. +% \bibitem{docindex} +% Lars Hellstr\"om: +% \textit{The \package{docindex} package}, 2001, +% \textsc{ctan}:\discretionary{}{}{\thinspace}\texttt{macros}\slash +% \texttt{latex}\slash \texttt{exptl}\slash \texttt{xdoc}\slash +% \texttt{docindex.dtx}. +% \bibitem{fontinst} +% Alan Jeffrey, Sebastian Rahtz, Ulrik Vieth (and as of v\,1.9 Lars +% Hellstr\"om): \textit{The \package{fontinst} utility}, v\,1.8~ff., +% documented source code, +% \textsc{ctan}:\discretionary{}{}{\thinspace}^^A +% \texttt{fonts}\slash \texttt{utilities}\slash +% \texttt{fontinst}\slash \texttt{source}/ +% \bibitem{clsguide} +% The \LaTeX3 Project: +% \textit{\LaTeXe~for class and package writers}, +% The \LaTeX3 Project; ^^A , 1995~ff. +% \textsc{ctan}:\discretionary{}{}{\thinspace}\texttt{macros}\slash +% \texttt{latex}\slash \texttt{base}\slash \texttt{clsguide.tex}. +% \bibitem{doc} +% Frank Mittelbach, B.~Hamilton Kelly, Andrew Mills, Dave Love, and +% Joachim \mbox{Schrod}: \textit{The \package{doc} and +% \package{shortvrb} Packages}, The \LaTeX3 Project; ^^A , 1993~ff. +% \textsc{ctan}:\discretionary{}{}{\thinspace}\texttt{macros}\slash +% \texttt{latex}\slash \texttt{base}\slash \texttt{doc.dtx}. +% \bibitem{xparse} +% Frank Mittelbach, Chris Rowley, and David Carlisle: \textit{The +% \package{xparse} package}, The \LaTeX3 Project, 1999. Currently +% not available by anonymous FTP, but available by HTTP from +% \texttt{www.latex-project.org} (look for ``experimental code''). +% \end{thebibliography} +% +% \Finale +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/source/fontinst/base/xdoc/xdoc2.ins b/Master/texmf-dist/source/fontinst/base/xdoc/xdoc2.ins new file mode 100644 index 00000000000..ff4eb64bc5a --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/xdoc/xdoc2.ins @@ -0,0 +1,37 @@ +% This file is the docstrip installation script for the xdoc2 package. +% +% It may be distributed under the conditions of the LaTeX +% Project Public License, either version 1.2 of this license or +% (at your option) any later version. The latest version of this +% license is in +% http://www.latex-project.org/lppl.txt +% and version 1.2 or later is part of all distributions of LaTeX +% version 1999/12/01 or later. +% +% Copyright 2000 2001 Lars Hellstr\"om + +\input docstrip + +\keepsilent + +\preamble + +This file may be distributed and/or modified under the conditions +of the LaTeX Project Public License, either version 1.2 of this +license or (at your option) any later version. The latest version +of this license is in + http://www.latex-project.org/lppl.txt +and version 1.2 or later is part of all distributions of LaTeX +version 1999/12/01 or later. + +This file may only be distributed together with a copy of the source +file from which it was generated. You may distribute that source file +without this generated file. + +\endpreamble + +\usedir{tex/latex/misc} +\generate{\file{xdoc2.sty}{\from{xdoc2.dtx}{pkg,xdoc2}}} + +\endbatchfile +\end diff --git a/Master/texmf-dist/source/fontinst/base/xdoc/xdoc2.pdf b/Master/texmf-dist/source/fontinst/base/xdoc/xdoc2.pdf Binary files differnew file mode 100644 index 00000000000..c71ef7aac30 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/xdoc/xdoc2.pdf diff --git a/Master/texmf-dist/source/fontinst/base/xdoc/xdocdemo.pdf b/Master/texmf-dist/source/fontinst/base/xdoc/xdocdemo.pdf Binary files differnew file mode 100644 index 00000000000..a368decfbc3 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/xdoc/xdocdemo.pdf diff --git a/Master/texmf-dist/source/fontinst/base/xdoc/xdocdemo.tex b/Master/texmf-dist/source/fontinst/base/xdoc/xdocdemo.tex new file mode 100644 index 00000000000..026afcb9fb8 --- /dev/null +++ b/Master/texmf-dist/source/fontinst/base/xdoc/xdocdemo.tex @@ -0,0 +1,2599 @@ +%% +%% This file may be distributed and/or modified under the conditions +%% of the LaTeX Project Public License, either version 1.2 of this +%% license or (at your option) any later version. The latest version +%% of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% Copyright 2000 2003 Lars Hellstr\"om +%% +\documentclass[twoside]{ltxdoc} +\usepackage[dolayout]{xdoc2} + +\DeclareRobustCommand\package[1]{\textsf{#1}} + +% I redefine theindex environment so that I can use floats normally +% inside it. Inside the multicolumn environment the float mechanism +% performs worse. This is the non-multicol definition from doc: +\makeatletter +\renewenvironment{theindex}{% + \@restonecoltrue + \if@twocolumn\@restonecolfalse\fi + \columnseprule \z@ + \columnsep 35\p@ + \twocolumn[\index@prologue]% + \IndexParms + \let\item\@idxitem + \ignorespaces +}{\if@restonecol\onecolumn\else\clearpage\fi} +\makeatother + +\begin{document} + +\begin{abstract} + This document contains some demonstrations of features in the + \package{xdoc} package. It's not particularly organised, though. +\end{abstract} + +\section{Describing control sequence families} + +The following piece of code is from the source for \package{fontinst}: +\begin{verbatim} + The kerning information is kept in the macros + \describecsfamily{l-\meta{name}}|\l-|\meta{name} and + \describecsfamily{r-\meta{name}}|\r-|\meta{name}, containing + information about how \meta{name} kerns on the left and on the right, + respectively. The |\l-|\meta{name} macro should expand out to a + series of + \begin{quote} + \DescribeMacro{\k}|\k|\,|\r-|\meta{name}\,|\|\meta{amount} + \end{quote} + control sequences, and vice versa. Examples of + \describecsfamily{\meta{amount}} |\|\meta{amount} + control sequences are: |\0|, |\1|, |\1000|, |\-50|, |\33|; these + corresponds to the kern amounts $0$, $1$, $1000$ (which would be + a very large kern), $-50$, and $33$ respectively. +\end{verbatim} +Now I'm going to write that it typesets as what follows below, but it +looks better if this paragraph is a couple of lines long, since that +enables one to see where the right margin actually begins. But that +seems to be long enough. Thus: +It typesets as +\begin{quote} + The kerning information is kept in the macros + \describecsfamily{l-\meta{name}}|\l-|\meta{name} and + \describecsfamily{r-\meta{name}}|\r-|\meta{name}, containing + information about how \meta{name} kerns on the left and on the right, + respectively. The |\l-|\meta{name} macro should expand out to a + series of + \begin{quote} + \DescribeMacro{\k}|\k|\,|\r-|\meta{name}\,|\|\meta{amount} + \end{quote} + control sequences, and vice versa. Examples of + \describecsfamily{\meta{amount}} |\|\meta{amount} + control sequences are: |\0|, |\1|, |\1000|, |\-50|, |\33|; these + corresponds to the kern amounts $0$, $1$, $1000$ (which would be + a very large kern), $-50$, and $33$ respectively. +\end{quote} + + +\section{Defining new \texttt{macro}-like environments} + +Another example from \package{fontinst}---the \package{fisource} +package (v\,2.02) contains the command +\begin{verbatim} +\NewMacroEnvironment{fistring}{\XD@grab@harmless\relax}{1}% + {\MacroFont#1 \normalfont string}% + {\XDMainIndex{\levelsorted{#1 I}{\texttt{#1} (string)}}% + \XDMainIndex{\levelsame{strings:}\levelsorted{#1}{\texttt{#1}}}}% + {{#1}{\texttt{#1} string}}% + {} +\end{verbatim} +which defines a new \texttt{macro}-like environment called +\texttt{fistring} (for \package{fontinst} string variable). The fourth +argument above specifies how the marginal heading should be formatted, +the fifth argument specifies which index entries should be made on +account of this environment, and the sixth argument gives the list of +changes heading (and its sorting) that should be used inside this +\texttt{macro}-like environment. + +\makeatletter +\NewMacroEnvironment{fistring}{\XD@grab@harmless\relax}{1}% + {\MacroFont#1 \normalfont string}% + {\XDMainIndex{\levelsorted{#1 I}{\texttt{#1} (string)}}% + \XDMainIndex{\levelsame{strings:}\levelsorted{#1}{\texttt{#1}}}}% + {{#1}{\texttt{#1} string}}% + {} +\makeatother + +\MakePercentIgnore +% With the command defined, the code +%\begin{verbatim} +%% \begin{macro}{\make_pltotf} +%% \begin{fistring}{TFMfileprefix} +%% |\make_pltotf| writes a \package{PLtoTF} command for converting the +%% current font's PL file to a TFM file. If set, the string +%% \texttt{TFMfileprefix} will be prepended to the TFM file name---this +%% could be used for putting the TFMs in some directory other than the +%% current. +%% \begin{macrocode} +%\def\make_pltotf{ +% \pout_line\output_pltotf{pltotf~\TeX_font_name.pl~ +% \ifisstr{TFMfileprefix}\then \str{TFMfileprefix}\fi +% \TeX_font_name.tfm +% } +%} +%% \end{macrocode} +%% \end{fistring}\end{macro} +%\end{verbatim} +% will print as +% +% \begin{macro}{\make_pltotf} +% \begin{fistring}{TFMfileprefix} +% |\make_pltotf| writes a \package{PLtoTF} command for converting the +% current font's PL file to a TFM file. If set, the string +% \texttt{TFMfileprefix} will be prepended to the TFM file name---this +% could be used for putting the TFMs in some directory other than the +% current. +% \begin{macrocode} +\def\make_pltotf{ + \pout_line\output_pltotf{pltotf~\TeX_font_name.pl~ + \ifisstr{TFMfileprefix}\then \str{TFMfileprefix}\fi + \TeX_font_name.tfm + } +} +% \end{macrocode} +% \end{fistring}\end{macro} +% +\MakePercentComment + +\clearpage + +\section{Two-sided printing} + +As you may have noticed, marginal material has so far consistently +been put in the \emph{outer} margin, but the examples so far given of +such material that appears in the right margin have been restricted +to marginal material made via the |\marginpar| command (in various +disguises), and that isn't so hard to achieve. It's much harder to +achieve it for marginal material produced as list item labels, so here +are a few examples to illustrate that it works for these as well. (The +filling up text is taken from the \package{fontsmpl} package in the +Tools bundle.) + +\vspace*{0.5\textheight} + +(A bit of space to put the text near the page break.) + +% Hacks to ensure that some marginal text is positioned before the +% previous page is output. +\begingroup +\interlinepenalty=500 +\setlength\MacroTopsep{1\MacroTopsep plus 3\MacroTopsep} + +\begin{environment}{Stanford} + On November 14, 1885, Senator \& Mrs.~Leland Stanford called + together at their San Francisco mansion the 24~prominent men who + had been chosen as the first trustees of The Leland Stanford + Junior University. +\end{environment} + +\begin{environment}{charter} + They handed to the board the Founding Grant + of the University, which they had executed three days before. + This document---with various amendments, legislative acts, and + court decrees---remains as the University's charter. +\end{environment} + +\begin{environment}{objectives} + In bold, sweeping language it stipulates that the objectives of the + University are ``to qualify students for personal success and + direct usefulness in life; +\end{environment} + +\begin{environment}{continuation} + and to promote the publick welfare by + exercising an influence in behalf of humanity and civilization, + teaching the blessings of liberty regulated by law, and + inculcating love and reverence for the great principles of + government as derived from the inalienable rights of man to life, + liberty, and the pursuit of happiness.'' +\end{environment} + +\begin{environment}{CAPITALS} + (!`THE DAZED BROWN FOX QUICKLY GAVE 12345--67890 JUMPS!)' +\end{environment} + +\begin{environment}{accents-and-such} + ?`But aren't Kafka's Schlo\ss\ + and \AE sop's \OE uvres often na\"\i ve vis-\`a-vis the + d\ae monic ph\oe nix's official r\^ole in fluffy s\t ouffl\'es? +\end{environment} + +\endgroup + +As you might have noticed, the first marginal heading on this page was +put on the wrong side the first time the document was typeset. This is +however corrected the next time the document is typeset, and the +\package{xdoc} package gave a warning about it at the end of the run. + + +\section{An enriched index} + +The following index was automatically generated for copies of the +files \texttt{ltoutenc.dtx} and \texttt{cyoutenc.dtx} to which had +been added some extra markup. Most of that extra markup consisted of +\texttt{enccommand} and \texttt{enccomposite} environments (the +definitions of which can be found in Subsection~8.4 of +\texttt{xdoc2.dtx}), but I also added a couple of |\Describe|\-|Macro| +and |\describe|\-|cs|\-|family| commands where it seemed suitable. + + +\let\listenvironmentitem=\item + + + \begin{theindex} + \makeatletter\scan@allowedfalse +{\bfseries\hfil Symbols\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}"}\pfill a-371, a-475, a-666 + \subitem default\pfill \main{a-176} + \subitem \texttt {OT1} encoding\pfill \main{a-335} + \subitem \texttt {OT4} encoding\pfill \main{a-623} + \subitem \texttt {T1} encoding\pfill \main{a-407} + \subsubitem \texttt {A} composite\pfill \main{a-541} + \subsubitem \texttt {a} composite\pfill \main{a-567} + \subsubitem \texttt {E} composite\pfill \main{a-547} + \subsubitem \texttt {e} composite\pfill \main{a-573} + \subsubitem \texttt {I} composite\pfill \main{a-551} + \subsubitem \texttt {i} composite\pfill \main{a-580} + \subsubitem \texttt {\PrintChar{092}i} composite\pfill + \main{a-581} + \subsubitem \texttt {O} composite\pfill \main{a-557} + \subsubitem \texttt {o} composite\pfill \main{a-587} + \subsubitem \texttt {U} composite\pfill \main{a-561} + \subsubitem \texttt {u} composite\pfill \main{a-591} + \subsubitem \texttt {Y} composite\pfill \main{a-506} + \subsubitem \texttt {y} composite\pfill \main{a-533} + \subitem \texttt {T2A} encoding\pfill \main{b-17} + \subsubitem \texttt {\PrintChar{092}CYRE} composite\pfill + \main{b-441} + \subsubitem \texttt {\PrintChar{092}cyre} composite\pfill + \main{b-442} + \subsubitem \texttt {\PrintChar{092}CYRII} composite\pfill + \main{b-445} + \subsubitem \texttt {\PrintChar{092}cyrii} composite\pfill + \main{b-447} + \subitem \texttt {T2B} encoding\pfill \main{b-17} + \subsubitem \texttt {\PrintChar{092}CYRE} composite\pfill + \main{b-441} + \subsubitem \texttt {\PrintChar{092}cyre} composite\pfill + \main{b-442} + \subitem \texttt {T2C} encoding\pfill \main{b-17} + \subsubitem \texttt {\PrintChar{092}CYRE} composite\pfill + \main{b-441} + \subsubitem \texttt {\PrintChar{092}cyre} composite\pfill + \main{b-442} + \subitem \texttt {X2} encoding\pfill \main{b-17} + \subsubitem \texttt {\PrintChar{092}CYRE} composite\pfill + \main{b-441} + \subsubitem \texttt {\PrintChar{092}cyre} composite\pfill + \main{b-442} + \subsubitem \texttt {\PrintChar{092}CYRII} composite\pfill + \main{b-445} + \subsubitem \texttt {\PrintChar{092}cyrii} composite\pfill + \main{b-447} + \item \texttt {\PrintChar{092}'}\pfill a-373, a-477, a-668 + \subitem default\pfill \main{a-177} + \subitem \texttt {OT1} encoding\pfill \main{a-336} + \subitem \texttt {OT4} encoding\pfill \main{a-624} + \subsubitem \texttt {C} composite\pfill \main{a-687} + \subsubitem \texttt {c} composite\pfill \main{a-694} + \subsubitem \texttt {N} composite\pfill \main{a-689} + \subsubitem \texttt {n} composite\pfill \main{a-696} + \subsubitem \texttt {O} composite\pfill \main{a-700} + \subsubitem \texttt {o} composite\pfill \main{a-701} + \subsubitem \texttt {S} composite\pfill \main{a-690} + \subsubitem \texttt {s} composite\pfill \main{a-697} + \subsubitem \texttt {Z} composite\pfill \main{a-691} + \subsubitem \texttt {z} composite\pfill \main{a-698} + \subitem \texttt {T1} encoding\pfill \main{a-404} + \subsubitem \texttt {A} composite\pfill \main{a-538} + \subsubitem \texttt {a} composite\pfill \main{a-564} + \subsubitem \texttt {C} composite\pfill \main{a-486} + \subsubitem \texttt {c} composite\pfill \main{a-513} + \subsubitem \texttt {E} composite\pfill \main{a-545} + \subsubitem \texttt {e} composite\pfill \main{a-571} + \subsubitem \texttt {I} composite\pfill \main{a-549} + \subsubitem \texttt {i} composite\pfill \main{a-576} + \subsubitem \texttt {\PrintChar{092}i} composite\pfill + \main{a-577} + \subsubitem \texttt {L} composite\pfill \main{a-492} + \subsubitem \texttt {l} composite\pfill \main{a-519} + \subsubitem \texttt {N} composite\pfill \main{a-494} + \subsubitem \texttt {n} composite\pfill \main{a-521} + \subsubitem \texttt {O} composite\pfill \main{a-554} + \subsubitem \texttt {o} composite\pfill \main{a-584} + \subsubitem \texttt {R} composite\pfill \main{a-497} + \subsubitem \texttt {r} composite\pfill \main{a-524} + \subsubitem \texttt {S} composite\pfill \main{a-499} + \subsubitem \texttt {s} composite\pfill \main{a-526} + \subsubitem \texttt {U} composite\pfill \main{a-559} + \subsubitem \texttt {u} composite\pfill \main{a-589} + \subsubitem \texttt {Y} composite\pfill \main{a-562} + \subsubitem \texttt {y} composite\pfill \main{a-592} + \subsubitem \texttt {Z} composite\pfill \main{a-507} + \subsubitem \texttt {z} composite\pfill \main{a-534} + \subitem \texttt {T2A} encoding\pfill \main{b-14} + \subitem \texttt {T2B} encoding\pfill \main{b-14} + \subitem \texttt {T2C} encoding\pfill \main{b-14} + \subitem \texttt {X2} encoding\pfill \main{b-14} + \item \texttt {\MetaNormalfont \PrintChar{092}\meta {encoding}-cmd}\pfill + \usage{6} + \item \texttt {\MetaNormalfont \PrintChar{092}\meta {encoding}\PrintChar{092}\meta {command}}\pfill + \usage{6} + \item \texttt {\PrintChar{092}-}\pfill a-367, a-368, a-470, + a-662, a-663 + \item \texttt {\PrintChar{092}.}\efill + \subitem default\pfill \main{a-178} + \subitem \texttt {OT1} encoding\pfill \main{a-337} + \subitem \texttt {OT4} encoding\pfill \main{a-625} + \subsubitem \texttt {Z} composite\pfill \main{a-692} + \subsubitem \texttt {z} composite\pfill \main{a-699} + \subitem \texttt {T1} encoding\pfill \main{a-413} + \subsubitem \texttt {I} composite\pfill \main{a-510} + \subsubitem \texttt {i} composite\pfill \main{a-483} + \subsubitem \texttt {Z} composite\pfill \main{a-509} + \subsubitem \texttt {z} composite\pfill \main{a-536} + \subitem \texttt {T2A} encoding\pfill \main{b-23} + \subsubitem \texttt {i} composite\pfill \main{b-75} + \subitem \texttt {T2B} encoding\pfill \main{b-23} + \subsubitem \texttt {i} composite\pfill \main{b-75} + \subitem \texttt {T2C} encoding\pfill \main{b-23} + \subsubitem \texttt {i} composite\pfill \main{b-75} + \subitem \texttt {X2} encoding\pfill \main{b-23} + \subsubitem \texttt {i} composite\pfill \main{b-75} + \item \texttt {\PrintChar{092}<}\pfill a-471, a-616 + \item \texttt {\MetaNormalfont \PrintChar{092}?\PrintChar{092}\meta {command}}\pfill + \usage{6} + \item \texttt {\PrintChar{092}\PrintChar{036}}\pfill a-251, a-392, + a-399, a-464, a-678, a-685 + \item \texttt {\PrintChar{092}\PrintChar{037}}\pfill a-427, a-429, + b-39, b-41 + \item \texttt {\PrintChar{092}\PrintChar{061}}\efill + \subitem default\pfill \main{a-179} + \subitem \texttt {OT1} encoding\pfill \main{a-338} + \subitem \texttt {OT4} encoding\pfill \main{a-626} + \subitem \texttt {T1} encoding\pfill \main{a-412} + \subitem \texttt {T2A} encoding\pfill \main{b-22} + \subitem \texttt {T2B} encoding\pfill \main{b-22} + \subitem \texttt {T2C} encoding\pfill \main{b-22} + \subitem \texttt {X2} encoding\pfill \main{b-22} + \item \texttt {\PrintChar{092}\PrintChar{062}}\pfill a-468, a-617 + \item \texttt {\PrintChar{092}\PrintChar{092}}\pfill a-459 + \item \texttt {\MetaNormalfont \PrintChar{092}\PrintChar{092}\meta {enc}\PrintChar{092}\meta {cmd}-\meta {arg}}\pfill + \usage{8} + \item \texttt {\PrintChar{092}\PrintChar{094}}\pfill a-233, a-457 + \subitem default\pfill \main{a-181} + \subitem \texttt {OT1} encoding\pfill \main{a-339} + \subitem \texttt {OT4} encoding\pfill \main{a-627} + \subitem \texttt {T1} encoding\pfill \main{a-405} + \subsubitem \texttt {A} composite\pfill \main{a-539} + \subsubitem \texttt {a} composite\pfill \main{a-565} + \subsubitem \texttt {E} composite\pfill \main{a-546} + \subsubitem \texttt {e} composite\pfill \main{a-572} + \subsubitem \texttt {I} composite\pfill \main{a-550} + \subsubitem \texttt {i} composite\pfill \main{a-578} + \subsubitem \texttt {\PrintChar{092}i} composite\pfill + \main{a-579} + \subsubitem \texttt {O} composite\pfill \main{a-555} + \subsubitem \texttt {o} composite\pfill \main{a-585} + \subsubitem \texttt {U} composite\pfill \main{a-560} + \subsubitem \texttt {u} composite\pfill \main{a-590} + \subitem \texttt {T2A} encoding\pfill \main{b-15} + \subitem \texttt {T2B} encoding\pfill \main{b-15} + \subitem \texttt {T2C} encoding\pfill \main{b-15} + \subitem \texttt {X2} encoding\pfill \main{b-15} + \begin{figure*} + A verbatim extract from the index (without \textsf{docidx2e}): + + \let\item=\listenvironmentitem + \expandafter\def \expandafter\MacroFont \expandafter{% + \MacroFont\footnotesize} + \begin{list}{}{\setlength{\leftmargin}{-0.5\marginparwidth}} + \item[] +\begin{verbatim} + \item \texttt {\PrintChar{092}\PrintChar{061}}\efill + \subitem default\pfill \main{a-179} + \subitem \texttt {OT1} encoding\pfill \main{a-338} + \subitem \texttt {OT4} encoding\pfill \main{a-626} + \subitem \texttt {T1} encoding\pfill \main{a-412} + \subitem \texttt {T2A} encoding\pfill \main{b-22} + \subitem \texttt {T2B} encoding\pfill \main{b-22} + \subitem \texttt {T2C} encoding\pfill \main{b-22} + \subitem \texttt {X2} encoding\pfill \main{b-22} + \item \texttt {\PrintChar{092}\PrintChar{062}}\pfill a-468, a-617 + \item \texttt {\PrintChar{092}\PrintChar{092}}\pfill a-459 + \item \texttt {\MetaNormalfont \PrintChar{092}\PrintChar{092}\meta {enc}\PrintChar{092}\meta {cmd}-\meta {arg}}\pfill + \usage{8} + \item \texttt {\PrintChar{092}\PrintChar{094}}\pfill a-233, a-457 + \subitem default\pfill \main{a-181} + \subitem \texttt {OT1} encoding\pfill \main{a-339} + \subitem \texttt {OT4} encoding\pfill \main{a-627} + \subitem \texttt {T1} encoding\pfill \main{a-405} + \subsubitem \texttt {A} composite\pfill \main{a-539} + \subsubitem \texttt {a} composite\pfill \main{a-565} + \subsubitem \texttt {E} composite\pfill \main{a-546} + \subsubitem \texttt {e} composite\pfill \main{a-572} + \subsubitem \texttt {I} composite\pfill \main{a-550} + \subsubitem \texttt {i} composite\pfill \main{a-578} + \subsubitem \texttt {\PrintChar{092}i} composite\pfill + \main{a-579} + \subsubitem \texttt {O} composite\pfill \main{a-555} + \subsubitem \texttt {o} composite\pfill \main{a-585} + \subsubitem \texttt {U} composite\pfill \main{a-560} + \subsubitem \texttt {u} composite\pfill \main{a-590} + \subitem \texttt {T2A} encoding\pfill \main{b-15} + \subitem \texttt {T2B} encoding\pfill \main{b-15} + \subitem \texttt {T2C} encoding\pfill \main{b-15} + \subitem \texttt {X2} encoding\pfill \main{b-15} + \item \texttt {\PrintChar{092}\PrintChar{095}}\pfill a-258 + \item \texttt {\PrintChar{092}\PrintChar{123}}\pfill a-252, a-461 + \item \texttt {\PrintChar{092}\PrintChar{124}}\pfill a-460 + \item \texttt {\PrintChar{092}\PrintChar{125}}\pfill a-253, a-462 + \item \texttt {\PrintChar{092}\PrintChar{126}}\pfill a-234, a-458 + \subitem default\pfill \main{a-189} + \subitem \texttt {OT1} encoding\pfill \main{a-341} + \subitem \texttt {OT4} encoding\pfill \main{a-629} + \subitem \texttt {T1} encoding\pfill \main{a-406} + \subsubitem \texttt {A} composite\pfill \main{a-540} + \subsubitem \texttt {a} composite\pfill \main{a-566} + \subsubitem \texttt {N} composite\pfill \main{a-552} + \subsubitem \texttt {n} composite\pfill \main{a-582} + \subsubitem \texttt {O} composite\pfill \main{a-556} + \subsubitem \texttt {o} composite\pfill \main{a-586} + \subitem \texttt {T2A} encoding\pfill \main{b-16} + \subitem \texttt {T2B} encoding\pfill \main{b-16} + \subitem \texttt {T2C} encoding\pfill \main{b-16} + \subitem \texttt {X2} encoding\pfill \main{b-16} +\end{verbatim} + \end{list} + \end{figure*} + \begin{figure*} + A verbatim extract from the index (with \textsf{docidx2e}): + + \let\item=\listenvironmentitem + \expandafter\def \csname macro@font\expandafter\endcsname + \expandafter{\MacroFont\footnotesize} + \csname codeline@indexfalse\endcsname + \begin{list}{}{% + \setlength{\leftmargin}{-0.5\marginparwidth}% + \setlength{\topsep}{0pt}% + } + \item[] +\begin{macrocode} +\indexitem{1}{\texttt {\PrintChar{092}\PrintChar{095}}}{9}{a\+258}{1} +\indexitem{1}{\texttt {\PrintChar{092}\PrintChar{123}}}{9}{a\+252, + a\+461}{1} +\indexitem{1}{\texttt {\PrintChar{092}\PrintChar{124}}}{9}{a\+460}{1} +\indexitem{1}{\texttt {\PrintChar{092}\PrintChar{125}}}{9}{a\+253, + a\+462}{1} +\indexitem{1}{\texttt {\PrintChar{092}\PrintChar{126}}}{9}{a\+234, + a\+458}{2} + \indexitem{2}{default}{9}{\main{a\+189}}{2} + \indexitem{2}{\texttt {OT1} encoding}{9}{\main{a\+341}}{2} + \indexitem{2}{\texttt {OT4} encoding}{9}{\main{a\+629}}{2} + \indexitem{2}{\texttt {T1} encoding}{9}{\main{a\+406}}{3} + \indexitem{3}{\texttt {A} composite}{9}{\main{a\+540}}{3} + \indexitem{3}{\texttt {a} composite}{9}{\main{a\+566}}{3} + \indexitem{3}{\texttt {N} composite}{9}{\main{a\+552}}{3} + \indexitem{3}{\texttt {n} composite}{9}{\main{a\+582}}{3} + \indexitem{3}{\texttt {O} composite}{9}{\main{a\+556}}{3} + \indexitem{3}{\texttt {o} composite}{9}{\main{a\+586}}{2} + \indexitem{2}{\texttt {T2A} encoding}{9}{\main{b\+16}}{2} + \indexitem{2}{\texttt {T2B} encoding}{9}{\main{b\+16}}{2} + \indexitem{2}{\texttt {T2C} encoding}{9}{\main{b\+16}}{2} + \indexitem{2}{\texttt {X2} encoding}{9}{\main{b\+16}}{1} +\indexitem{1}{\texttt {\PrintChar{092}`}}{9}{a\+372, a\+476, + a\+667}{2} + \indexitem{2}{default}{9}{\main{a\+182}}{2} + \indexitem{2}{\texttt {OT1} encoding}{9}{\main{a\+340}}{2} + \indexitem{2}{\texttt {OT4} encoding}{9}{\main{a\+628}}{2} + \indexitem{2}{\texttt {T1} encoding}{9}{\main{a\+403}}{3} + \indexitem{3}{\texttt {A} composite}{9}{\main{a\+537}}{3} + \indexitem{3}{\texttt {a} composite}{9}{\main{a\+563}}{3} + \indexitem{3}{\texttt {E} composite}{9}{\main{a\+544}}{3} + \indexitem{3}{\texttt {e} composite}{9}{\main{a\+570}}{3} + \indexitem{3}{\texttt {I} composite}{9}{\main{a\+548}}{3} + \indexitem{3}{\texttt {i} composite}{9}{\main{a\+574}}{3} + \indexitem{3}{\texttt {\PrintChar{092}i} composite}{9}{ + \main{a\+575}}{3} + \indexitem{3}{\texttt {O} composite}{9}{\main{a\+553}}{3} + \indexitem{3}{\texttt {o} composite}{9}{\main{a\+583}}{3} + \indexitem{3}{\texttt {U} composite}{9}{\main{a\+558}}{3} + \indexitem{3}{\texttt {u} composite}{9}{\main{a\+588}}{2} + \indexitem{2}{\texttt {T2A} encoding}{9}{\main{b\+13}}{2} + \indexitem{2}{\texttt {T2B} encoding}{9}{\main{b\+13}}{2} + \indexitem{2}{\texttt {T2C} encoding}{9}{\main{b\+13}}{2} + \indexitem{2}{\texttt {X2} encoding}{9}{\main{b\+13}}{0} +%^^A +\indexnewletter{0}{A}{1} +\indexitem{1}{\texttt {\PrintChar{092}a}}{9}{\main{a\+173}}{1} +\indexitem{1}{\texttt {\PrintChar{092}AA}}{9}{a\+190, a\+380, + a\+430}{1} +\indexitem{1}{\texttt {\PrintChar{092}aa}}{9}{a\+195, a\+374, + a\+440}{1} +\indexitem{1}{\texttt {\PrintChar{092}accent}}{9}{a\+71, a\+350, + a\+375, a\+418, a\+640, b\+31}{1} +% \end{macrocode} + \end{list} + \end{figure*} + \item \texttt {\PrintChar{092}\PrintChar{095}}\pfill a-258 + \item \texttt {\PrintChar{092}\PrintChar{123}}\pfill a-252, a-461 + \item \texttt {\PrintChar{092}\PrintChar{124}}\pfill a-460 + \item \texttt {\PrintChar{092}\PrintChar{125}}\pfill a-253, a-462 + \item \texttt {\PrintChar{092}\PrintChar{126}}\pfill a-234, a-458 + \subitem default\pfill \main{a-189} + \subitem \texttt {OT1} encoding\pfill \main{a-341} + \subitem \texttt {OT4} encoding\pfill \main{a-629} + \subitem \texttt {T1} encoding\pfill \main{a-406} + \subsubitem \texttt {A} composite\pfill \main{a-540} + \subsubitem \texttt {a} composite\pfill \main{a-566} + \subsubitem \texttt {N} composite\pfill \main{a-552} + \subsubitem \texttt {n} composite\pfill \main{a-582} + \subsubitem \texttt {O} composite\pfill \main{a-556} + \subsubitem \texttt {o} composite\pfill \main{a-586} + \subitem \texttt {T2A} encoding\pfill \main{b-16} + \subitem \texttt {T2B} encoding\pfill \main{b-16} + \subitem \texttt {T2C} encoding\pfill \main{b-16} + \subitem \texttt {X2} encoding\pfill \main{b-16} + \item \texttt {\PrintChar{092}`}\pfill a-372, a-476, a-667 + \subitem default\pfill \main{a-182} + \subitem \texttt {OT1} encoding\pfill \main{a-340} + \subitem \texttt {OT4} encoding\pfill \main{a-628} + \subitem \texttt {T1} encoding\pfill \main{a-403} + \subsubitem \texttt {A} composite\pfill \main{a-537} + \subsubitem \texttt {a} composite\pfill \main{a-563} + \subsubitem \texttt {E} composite\pfill \main{a-544} + \subsubitem \texttt {e} composite\pfill \main{a-570} + \subsubitem \texttt {I} composite\pfill \main{a-548} + \subsubitem \texttt {i} composite\pfill \main{a-574} + \subsubitem \texttt {\PrintChar{092}i} composite\pfill + \main{a-575} + \subsubitem \texttt {O} composite\pfill \main{a-553} + \subsubitem \texttt {o} composite\pfill \main{a-583} + \subsubitem \texttt {U} composite\pfill \main{a-558} + \subsubitem \texttt {u} composite\pfill \main{a-588} + \subitem \texttt {T2A} encoding\pfill \main{b-13} + \subitem \texttt {T2B} encoding\pfill \main{b-13} + \subitem \texttt {T2C} encoding\pfill \main{b-13} + \subitem \texttt {X2} encoding\pfill \main{b-13} + + \indexspace +{\bfseries\hfil A\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}a}\pfill \main{a-173} + \item \texttt {\PrintChar{092}AA}\pfill a-190, a-380, a-430 + \item \texttt {\PrintChar{092}aa}\pfill a-195, a-374, a-440 + \item \texttt {\PrintChar{092}accent}\pfill a-71, a-350, a-375, + a-418, a-640, b-31 + \item \texttt {\PrintChar{092}accent@spacefactor}\pfill a-70--a-72 + \item \texttt {\PrintChar{092}add@accent}\pfill a-65, \main{a-67} + \item \texttt {\PrintChar{092}AE}\efill + \subitem default\pfill \main{a-191} + \subitem \texttt {OT1} encoding\pfill \main{a-355} + \subitem \texttt {OT4} encoding\pfill \main{a-645} + \subitem \texttt {T1} encoding\pfill \main{a-431} + \item \texttt {\PrintChar{092}ae}\efill + \subitem default\pfill \main{a-196} + \subitem \texttt {OT1} encoding\pfill \main{a-358} + \subitem \texttt {OT4} encoding\pfill \main{a-649} + \subitem \texttt {T1} encoding\pfill \main{a-441} + \item \texttt {\PrintChar{092}afterassignment}\pfill a-162, a-170 + \item \texttt {\PrintChar{092}@autoerr}\pfill a-51 + + \indexspace +{\bfseries\hfil B\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}b}\efill + \subitem default\pfill \main{a-183} + \subitem \texttt {OT1} encoding\pfill \main{a-346} + \subitem \texttt {OT4} encoding\pfill \main{a-636} + \subitem \texttt {T1} encoding\pfill \main{a-414} + \subitem \texttt {T2A} encoding\pfill \main{b-27} + \subitem \texttt {T2B} encoding\pfill \main{b-27} + \subitem \texttt {T2C} encoding\pfill \main{b-27} + \subitem \texttt {X2} encoding\pfill \main{b-27} + + \indexspace +{\bfseries\hfil C\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}C}\efill + \subitem \texttt {T2A} encoding\pfill \main{b-25} + \subitem \texttt {T2B} encoding\pfill \main{b-25} + \subitem \texttt {T2C} encoding\pfill \main{b-25} + \subitem \texttt {X2} encoding\pfill \main{b-25} + \item \texttt {\PrintChar{092}c}\efill + \subitem default\pfill \main{a-184} + \subitem \texttt {OT1} encoding\pfill \main{a-349} + \subitem \texttt {OT4} encoding\pfill \main{a-639} + \subitem \texttt {T1} encoding\pfill \main{a-417} + \subsubitem \texttt {C} composite\pfill \main{a-543} + \subsubitem \texttt {c} composite\pfill \main{a-569} + \subsubitem \texttt {S} composite\pfill \main{a-501} + \subsubitem \texttt {s} composite\pfill \main{a-528} + \subsubitem \texttt {T} composite\pfill \main{a-503} + \subsubitem \texttt {t} composite\pfill \main{a-530} + \subitem \texttt {T2A} encoding\pfill \main{b-30} + \subsubitem \texttt {\PrintChar{092}CYRZ} composite\pfill + \main{b-448} + \subsubitem \texttt {\PrintChar{092}cyrz} composite\pfill + \main{b-449} + \subitem \texttt {T2B} encoding\pfill \main{b-30} + \subitem \texttt {T2C} encoding\pfill \main{b-30} + \subitem \texttt {X2} encoding\pfill \main{b-30} + \subsubitem \texttt {\PrintChar{092}CYRZ} composite\pfill + \main{b-448} + \subsubitem \texttt {\PrintChar{092}cyrz} composite\pfill + \main{b-449} + \item \texttt {\PrintChar{092}capitalacute}\efill + \subitem default\pfill \main{a-848} + \subitem \texttt {TS1} encoding\pfill \main{a-713} + \item \texttt {\PrintChar{092}capitalbreve}\efill + \subitem default\pfill \main{a-855} + \subitem \texttt {TS1} encoding\pfill \main{a-720} + \item \texttt {\PrintChar{092}capitalcaron}\efill + \subitem default\pfill \main{a-854} + \subitem \texttt {TS1} encoding\pfill \main{a-719} + \item \texttt {\PrintChar{092}capitalcedilla}\efill + \subitem default\pfill \main{a-845} + \subitem \texttt {TS1} encoding\pfill \main{a-706} + \item \texttt {\PrintChar{092}capitalcircumflex}\efill + \subitem default\pfill \main{a-849} + \subitem \texttt {TS1} encoding\pfill \main{a-714} + \item \texttt {\PrintChar{092}capitaldieresis}\efill + \subitem default\pfill \main{a-851} + \subitem \texttt {TS1} encoding\pfill \main{a-716} + \item \texttt {\PrintChar{092}capitaldotaccent}\efill + \subitem default\pfill \main{a-857} + \subitem \texttt {TS1} encoding\pfill \main{a-722} + \item \texttt {\PrintChar{092}capitalgrave}\efill + \subitem default\pfill \main{a-847} + \subitem \texttt {TS1} encoding\pfill \main{a-712} + \item \texttt {\PrintChar{092}capitalhungarumlaut}\efill + \subitem default\pfill \main{a-852} + \subitem \texttt {TS1} encoding\pfill \main{a-717} + \item \texttt {\PrintChar{092}capitalmacron}\efill + \subitem default\pfill \main{a-856} + \subitem \texttt {TS1} encoding\pfill \main{a-721} + \item \texttt {\PrintChar{092}capitalnewtie}\efill + \subitem default\pfill \main{a-861} + \subitem \texttt {TS1} encoding\pfill \main{a-726} + \item \texttt {\PrintChar{092}capitalogonek}\efill + \subitem default\pfill \main{a-846} + \subitem \texttt {TS1} encoding\pfill \main{a-709} + \item \texttt {\PrintChar{092}capitalring}\efill + \subitem default\pfill \main{a-853} + \subitem \texttt {TS1} encoding\pfill \main{a-718} + \item \texttt {\PrintChar{092}capitaltie}\efill + \subitem default\pfill \main{a-859} + \subitem \texttt {TS1} encoding\pfill \main{a-724} + \item \texttt {\PrintChar{092}capitaltilde}\efill + \subitem default\pfill \main{a-850} + \subitem \texttt {TS1} encoding\pfill \main{a-715} + \item \texttt {\PrintChar{092}@car}\pfill a-77 + \item \texttt {\PrintChar{092}cf@encoding}\pfill a-29, a-36, a-39, + a-48, a-114 + \item \texttt {\PrintChar{092}@changed@cmd}\pfill \main{a-3}, a-63, + a-173 + \item \texttt {\PrintChar{092}@changed@x}\pfill \main{a-3}, a-161, + a-169 + \item \texttt {\PrintChar{092}@changed@x@mouth}\pfill a-161, a-169 + \item \texttt {\PrintChar{092}char}\pfill a-348, a-351, a-382, a-385, + a-392, a-399, a-416, a-419, a-425, a-427, a-429, a-610, + a-638, a-641, a-671, a-678, a-685, a-708, a-711, a-759, + b-29, b-32, b-37, b-39, b-41 + \item \texttt {\PrintChar{092}chardef}\pfill a-8 + \item \texttt {\PrintChar{092}copyright}\pfill a-232, a-260 + \item \texttt {\PrintChar{092}crcr}\pfill a-347, a-351, a-354, a-415, + a-420, a-423, a-425, a-609, a-637, a-641, a-644, a-708, + a-711, a-758, b-28, b-33, b-35, b-37 + \item \texttt {\PrintChar{092}@curr@enc}\pfill a-114, a-116 + \item \texttt {\PrintChar{092}curr@fontshape}\pfill a-130 + \item \texttt {\PrintChar{092}@current@cmd}\pfill a-20 + \item \texttt {\PrintChar{092}CurrentOption}\pfill a-300, a-302, + a-314 + \item \texttt {\PrintChar{092}CYRA}\pfill a-272 + \subitem \texttt {T2A} encoding\pfill \main{b-76} + \subitem \texttt {T2B} encoding\pfill \main{b-76} + \subitem \texttt {T2C} encoding\pfill \main{b-76} + \subitem \texttt {X2} encoding\pfill \main{b-76} + \item \texttt {\PrintChar{092}cyra}\pfill a-272, a-317 + \subitem \texttt {T2A} encoding\pfill \main{b-77} + \subitem \texttt {T2B} encoding\pfill \main{b-77} + \subitem \texttt {T2C} encoding\pfill \main{b-77} + \subitem \texttt {X2} encoding\pfill \main{b-77} + \item \texttt {\PrintChar{092}CYRABHCH}\pfill a-272, b-458, b-462 + \subitem \texttt {T2C} encoding\pfill \main{b-349} + \subitem \texttt {X2} encoding\pfill \main{b-381} + \item \texttt {\PrintChar{092}cyrabhch}\pfill a-272, b-459, b-463 + \subitem \texttt {T2C} encoding\pfill \main{b-350} + \subitem \texttt {X2} encoding\pfill \main{b-382} + \item \texttt {\PrintChar{092}CYRABHCHDSC}\pfill a-272 + \subitem \texttt {T2C} encoding\pfill \main{b-351} + \subitem \texttt {X2} encoding\pfill \main{b-383} + \item \texttt {\PrintChar{092}cyrabhchdsc}\pfill a-272 + \subitem \texttt {T2C} encoding\pfill \main{b-352} + \subitem \texttt {X2} encoding\pfill \main{b-384} + \item \texttt {\PrintChar{092}CYRABHDZE}\pfill a-273 + \subitem \texttt {T2B} encoding\pfill \main{b-271} + \subitem \texttt {T2C} encoding\pfill \main{b-329} + \subitem \texttt {X2} encoding\pfill \main{b-155} + \item \texttt {\PrintChar{092}cyrabhdze}\pfill a-272 + \subitem \texttt {T2B} encoding\pfill \main{b-272} + \subitem \texttt {T2C} encoding\pfill \main{b-330} + \subitem \texttt {X2} encoding\pfill \main{b-156} + \item \texttt {\PrintChar{092}CYRABHHA}\pfill a-273 + \subitem \texttt {T2C} encoding\pfill \main{b-361} + \subitem \texttt {X2} encoding\pfill \main{b-403} + \item \texttt {\PrintChar{092}cyrabhha}\pfill a-273 + \subitem \texttt {T2C} encoding\pfill \main{b-362} + \subitem \texttt {X2} encoding\pfill \main{b-404} + \item \texttt {\PrintChar{092}CYRAE}\pfill a-273 + \subitem \texttt {T2A} encoding\pfill \main{b-223} + \subitem \texttt {X2} encoding\pfill \main{b-374} + \item \texttt {\PrintChar{092}cyrae}\pfill a-273 + \subitem \texttt {T2A} encoding\pfill \main{b-224} + \subitem \texttt {X2} encoding\pfill \main{b-376} + \item \texttt {\PrintChar{092}CYRB}\pfill a-273 + \subitem \texttt {T2A} encoding\pfill \main{b-78} + \subitem \texttt {T2B} encoding\pfill \main{b-78} + \subitem \texttt {T2C} encoding\pfill \main{b-78} + \subitem \texttt {X2} encoding\pfill \main{b-78} + \item \texttt {\PrintChar{092}cyrb}\pfill a-273 + \subitem \texttt {T2A} encoding\pfill \main{b-79} + \subitem \texttt {T2B} encoding\pfill \main{b-79} + \subitem \texttt {T2C} encoding\pfill \main{b-79} + \subitem \texttt {X2} encoding\pfill \main{b-79} + \item \texttt {\PrintChar{092}CYRBYUS}\pfill a-274 + \subitem \texttt {X2} encoding\pfill \main{b-431} + \item \texttt {\PrintChar{092}cyrbyus}\pfill a-273 + \subitem \texttt {X2} encoding\pfill \main{b-432} + \item \texttt {\PrintChar{092}CYRC}\pfill a-274 + \subitem \texttt {T2A} encoding\pfill \main{b-120} + \subitem \texttt {T2B} encoding\pfill \main{b-120} + \subitem \texttt {T2C} encoding\pfill \main{b-120} + \subitem \texttt {X2} encoding\pfill \main{b-120} + \item \texttt {\PrintChar{092}cyrc}\pfill a-274 + \subitem \texttt {T2A} encoding\pfill \main{b-121} + \subitem \texttt {T2B} encoding\pfill \main{b-121} + \subitem \texttt {T2C} encoding\pfill \main{b-121} + \subitem \texttt {X2} encoding\pfill \main{b-121} + \item \texttt {\PrintChar{092}CYRCH}\pfill a-274 + \subitem \texttt {T2A} encoding\pfill \main{b-122} + \subitem \texttt {T2B} encoding\pfill \main{b-122} + \subitem \texttt {T2C} encoding\pfill \main{b-122} + \subitem \texttt {X2} encoding\pfill \main{b-122} + \item \texttt {\PrintChar{092}cyrch}\pfill a-274 + \subitem \texttt {T2A} encoding\pfill \main{b-123} + \subitem \texttt {T2B} encoding\pfill \main{b-123} + \subitem \texttt {T2C} encoding\pfill \main{b-123} + \subitem \texttt {X2} encoding\pfill \main{b-123} + \item \texttt {\PrintChar{092}CYRCHLDSC}\pfill a-274 + \subitem \texttt {T2B} encoding\pfill \main{b-303} + \subitem \texttt {X2} encoding\pfill \main{b-187} + \item \texttt {\PrintChar{092}cyrchldsc}\pfill a-274 + \subitem \texttt {T2B} encoding\pfill \main{b-304} + \subitem \texttt {X2} encoding\pfill \main{b-188} + \item \texttt {\PrintChar{092}CYRCHRDSC}\pfill a-275 + \subitem \texttt {T2A} encoding\pfill \main{b-247} + \subitem \texttt {T2B} encoding\pfill \main{b-305} + \subitem \texttt {T2C} encoding\pfill \main{b-363} + \subitem \texttt {X2} encoding\pfill \main{b-189} + \item \texttt {\PrintChar{092}cyrchrdsc}\pfill a-274 + \subitem \texttt {T2A} encoding\pfill \main{b-248} + \subitem \texttt {T2B} encoding\pfill \main{b-306} + \subitem \texttt {T2C} encoding\pfill \main{b-364} + \subitem \texttt {X2} encoding\pfill \main{b-190} + \item \texttt {\PrintChar{092}CYRCHVCRS}\pfill a-275 + \subitem \texttt {T2A} encoding\pfill \main{b-245} + \subitem \texttt {X2} encoding\pfill \main{b-423} + \item \texttt {\PrintChar{092}cyrchvcrs}\pfill a-275 + \subitem \texttt {T2A} encoding\pfill \main{b-246} + \subitem \texttt {X2} encoding\pfill \main{b-424} + \item \texttt {\PrintChar{092}CYRD}\pfill a-275 + \subitem \texttt {T2A} encoding\pfill \main{b-84} + \subitem \texttt {T2B} encoding\pfill \main{b-84} + \subitem \texttt {T2C} encoding\pfill \main{b-84} + \subitem \texttt {X2} encoding\pfill \main{b-84} + \item \texttt {\PrintChar{092}cyrd}\pfill a-275 + \subitem \texttt {T2A} encoding\pfill \main{b-85} + \subitem \texttt {T2B} encoding\pfill \main{b-85} + \subitem \texttt {T2C} encoding\pfill \main{b-85} + \subitem \texttt {X2} encoding\pfill \main{b-85} + \item \texttt {\PrintChar{092}cyrdash}\efill + \subitem \texttt {T2A} encoding\pfill \main{b-43} + \subitem \texttt {T2B} encoding\pfill \main{b-43} + \subitem \texttt {T2C} encoding\pfill \main{b-43} + \subitem \texttt {X2} encoding\pfill \main{b-43} + \item \texttt {\PrintChar{092}CYRDELTA}\pfill a-275 + \subitem \texttt {T2B} encoding\pfill \main{b-269} + \subitem \texttt {X2} encoding\pfill \main{b-435} + \item \texttt {\PrintChar{092}cyrdelta}\pfill a-275 + \subitem \texttt {T2B} encoding\pfill \main{b-270} + \subitem \texttt {X2} encoding\pfill \main{b-436} + \item \texttt {\PrintChar{092}CYRDJE}\pfill a-276 + \subitem \texttt {T2A} encoding\pfill \main{b-203} + \subitem \texttt {X2} encoding\pfill \main{b-377} + \item \texttt {\PrintChar{092}cyrdje}\pfill a-276 + \subitem \texttt {T2A} encoding\pfill \main{b-204} + \subitem \texttt {X2} encoding\pfill \main{b-378} + \item \texttt {\PrintChar{092}CYRDZE}\pfill a-276 + \subitem \texttt {T2A} encoding\pfill \main{b-229} + \subitem \texttt {T2B} encoding\pfill \main{b-416} + \subitem \texttt {T2C} encoding\pfill \main{b-416} + \subitem \texttt {X2} encoding\pfill \main{b-416} + \item \texttt {\PrintChar{092}cyrdze}\pfill a-276 + \subitem \texttt {T2A} encoding\pfill \main{b-230} + \subitem \texttt {T2B} encoding\pfill \main{b-417} + \subitem \texttt {T2C} encoding\pfill \main{b-417} + \subitem \texttt {X2} encoding\pfill \main{b-417} + \item \texttt {\PrintChar{092}CYRDZHE}\pfill a-276 + \subitem \texttt {T2A} encoding\pfill \main{b-243} + \subitem \texttt {T2C} encoding\pfill \main{b-359} + \subitem \texttt {X2} encoding\pfill \main{b-421} + \item \texttt {\PrintChar{092}cyrdzhe}\pfill a-276 + \subitem \texttt {T2A} encoding\pfill \main{b-244} + \subitem \texttt {T2C} encoding\pfill \main{b-360} + \subitem \texttt {X2} encoding\pfill \main{b-422} + \item \texttt {\PrintChar{092}CYRE}\pfill a-276, b-441 + \subitem \texttt {T2A} encoding\pfill \main{b-86} + \subitem \texttt {T2B} encoding\pfill \main{b-86} + \subitem \texttt {T2C} encoding\pfill \main{b-86} + \subitem \texttt {X2} encoding\pfill \main{b-86} + \item \texttt {\PrintChar{092}cyre}\pfill a-276, b-442 + \subitem \texttt {T2A} encoding\pfill \main{b-87} + \subitem \texttt {T2B} encoding\pfill \main{b-87} + \subitem \texttt {T2C} encoding\pfill \main{b-87} + \subitem \texttt {X2} encoding\pfill \main{b-87} + \item \texttt {\PrintChar{092}CYREPS}\pfill a-277 + \subitem \texttt {T2B} encoding\pfill \main{b-311} + \subitem \texttt {X2} encoding\pfill \main{b-195} + \item \texttt {\PrintChar{092}cyreps}\pfill a-276 + \subitem \texttt {T2B} encoding\pfill \main{b-312} + \subitem \texttt {X2} encoding\pfill \main{b-196} + \item \texttt {\PrintChar{092}CYREREV}\pfill a-277 + \subitem \texttt {T2A} encoding\pfill \main{b-134} + \subitem \texttt {T2B} encoding\pfill \main{b-134} + \subitem \texttt {T2C} encoding\pfill \main{b-134} + \subitem \texttt {X2} encoding\pfill \main{b-134} + \item \texttt {\PrintChar{092}cyrerev}\pfill a-277 + \subitem \texttt {T2A} encoding\pfill \main{b-135} + \subitem \texttt {T2B} encoding\pfill \main{b-135} + \subitem \texttt {T2C} encoding\pfill \main{b-135} + \subitem \texttt {X2} encoding\pfill \main{b-135} + \item \texttt {\PrintChar{092}CYRERY}\pfill a-277 + \subitem \texttt {T2A} encoding\pfill \main{b-130} + \subitem \texttt {T2B} encoding\pfill \main{b-130} + \subitem \texttt {T2C} encoding\pfill \main{b-130} + \subitem \texttt {X2} encoding\pfill \main{b-130} + \item \texttt {\PrintChar{092}cyrery}\pfill a-277 + \subitem \texttt {T2A} encoding\pfill \main{b-131} + \subitem \texttt {T2B} encoding\pfill \main{b-131} + \subitem \texttt {T2C} encoding\pfill \main{b-131} + \subitem \texttt {X2} encoding\pfill \main{b-131} + \item \texttt {\PrintChar{092}CYRF}\pfill a-277 + \subitem \texttt {T2A} encoding\pfill \main{b-116} + \subitem \texttt {T2B} encoding\pfill \main{b-116} + \subitem \texttt {T2C} encoding\pfill \main{b-116} + \subitem \texttt {X2} encoding\pfill \main{b-116} + \item \texttt {\PrintChar{092}cyrf}\pfill a-277 + \subitem \texttt {T2A} encoding\pfill \main{b-117} + \subitem \texttt {T2B} encoding\pfill \main{b-117} + \subitem \texttt {T2C} encoding\pfill \main{b-117} + \subitem \texttt {X2} encoding\pfill \main{b-117} + \item \texttt {\PrintChar{092}CYRFITA}\pfill a-278 + \item \texttt {\PrintChar{092}cyrfita}\pfill a-277 + \item \texttt {\PrintChar{092}CYRG}\pfill a-278 + \subitem \texttt {T2A} encoding\pfill \main{b-82} + \subitem \texttt {T2B} encoding\pfill \main{b-82} + \subitem \texttt {T2C} encoding\pfill \main{b-82} + \subitem \texttt {X2} encoding\pfill \main{b-82} + \item \texttt {\PrintChar{092}cyrg}\pfill a-278 + \subitem \texttt {T2A} encoding\pfill \main{b-83} + \subitem \texttt {T2B} encoding\pfill \main{b-83} + \subitem \texttt {T2C} encoding\pfill \main{b-83} + \subitem \texttt {X2} encoding\pfill \main{b-83} + \item \texttt {\PrintChar{092}CYRGDSC}\pfill a-278 + \subitem \texttt {T2B} encoding\pfill \main{b-261} + \subitem \texttt {X2} encoding\pfill \main{b-145} + \item \texttt {\PrintChar{092}cyrgdsc}\pfill a-278 + \subitem \texttt {T2B} encoding\pfill \main{b-262} + \subitem \texttt {X2} encoding\pfill \main{b-146} + \item \texttt {\PrintChar{092}CYRGDSCHCRS}\pfill a-278 + \subitem \texttt {T2B} encoding\pfill \main{b-256} + \item \texttt {\PrintChar{092}cyrgdschcrs}\pfill a-278 + \subitem \texttt {T2B} encoding\pfill \main{b-258} + \item \texttt {\PrintChar{092}CYRGHCRS}\pfill a-279 + \subitem \texttt {T2A} encoding\pfill \main{b-201} + \subitem \texttt {T2B} encoding\pfill \main{b-259} + \subitem \texttt {X2} encoding\pfill \main{b-143} + \item \texttt {\PrintChar{092}cyrghcrs}\pfill a-279 + \subitem \texttt {T2A} encoding\pfill \main{b-202} + \subitem \texttt {T2B} encoding\pfill \main{b-260} + \subitem \texttt {X2} encoding\pfill \main{b-144} + \item \texttt {\PrintChar{092}CYRGHK}\pfill a-279 + \subitem \texttt {T2B} encoding\pfill \main{b-263} + \subitem \texttt {T2C} encoding\pfill \main{b-321} + \subitem \texttt {X2} encoding\pfill \main{b-147} + \item \texttt {\PrintChar{092}cyrghk}\pfill a-279 + \subitem \texttt {T2B} encoding\pfill \main{b-264} + \subitem \texttt {T2C} encoding\pfill \main{b-322} + \subitem \texttt {X2} encoding\pfill \main{b-148} + \item \texttt {\PrintChar{092}CYRGUP}\pfill a-279 + \subitem \texttt {T2A} encoding\pfill \main{b-198} + \subitem \texttt {X2} encoding\pfill \main{b-140} + \item \texttt {\PrintChar{092}cyrgup}\pfill a-279 + \subitem \texttt {T2A} encoding\pfill \main{b-200} + \subitem \texttt {X2} encoding\pfill \main{b-142} + \item \texttt {\PrintChar{092}CYRH}\pfill a-279 + \subitem \texttt {T2A} encoding\pfill \main{b-118} + \subitem \texttt {T2B} encoding\pfill \main{b-118} + \subitem \texttt {T2C} encoding\pfill \main{b-118} + \subitem \texttt {X2} encoding\pfill \main{b-118} + \item \texttt {\PrintChar{092}cyrh}\pfill a-279 + \subitem \texttt {T2A} encoding\pfill \main{b-119} + \subitem \texttt {T2B} encoding\pfill \main{b-119} + \subitem \texttt {T2C} encoding\pfill \main{b-119} + \subitem \texttt {X2} encoding\pfill \main{b-119} + \item \texttt {\PrintChar{092}CYRHDSC}\pfill a-280 + \subitem \texttt {T2A} encoding\pfill \main{b-241} + \subitem \texttt {T2B} encoding\pfill \main{b-299} + \subitem \texttt {T2C} encoding\pfill \main{b-357} + \subitem \texttt {X2} encoding\pfill \main{b-183} + \item \texttt {\PrintChar{092}cyrhdsc}\pfill a-280 + \subitem \texttt {T2A} encoding\pfill \main{b-242} + \subitem \texttt {T2B} encoding\pfill \main{b-300} + \subitem \texttt {T2C} encoding\pfill \main{b-358} + \subitem \texttt {X2} encoding\pfill \main{b-184} + \item \texttt {\PrintChar{092}CYRHHCRS}\pfill a-280 + \subitem \texttt {T2B} encoding\pfill \main{b-297} + \item \texttt {\PrintChar{092}cyrhhcrs}\pfill a-280 + \subitem \texttt {T2B} encoding\pfill \main{b-298} + \item \texttt {\PrintChar{092}CYRHHK}\pfill a-280 + \subitem \texttt {T2B} encoding\pfill \main{b-301} + \subitem \texttt {X2} encoding\pfill \main{b-185} + \item \texttt {\PrintChar{092}cyrhhk}\pfill a-280 + \subitem \texttt {T2B} encoding\pfill \main{b-302} + \subitem \texttt {X2} encoding\pfill \main{b-186} + \item \texttt {\PrintChar{092}CYRHRDSN}\pfill a-281 + \subitem \texttt {T2A} encoding\pfill \main{b-128} + \subitem \texttt {T2B} encoding\pfill \main{b-128} + \subitem \texttt {T2C} encoding\pfill \main{b-128} + \subitem \texttt {X2} encoding\pfill \main{b-128} + \item \texttt {\PrintChar{092}cyrhrdsn}\pfill a-280 + \subitem \texttt {T2A} encoding\pfill \main{b-129} + \subitem \texttt {T2B} encoding\pfill \main{b-129} + \subitem \texttt {T2C} encoding\pfill \main{b-129} + \subitem \texttt {X2} encoding\pfill \main{b-129} + \item \texttt {\PrintChar{092}CYRI}\pfill a-281, b-443 + \subitem \texttt {T2A} encoding\pfill \main{b-92} + \subitem \texttt {T2B} encoding\pfill \main{b-92} + \subitem \texttt {T2C} encoding\pfill \main{b-92} + \subitem \texttt {X2} encoding\pfill \main{b-92} + \item \texttt {\PrintChar{092}cyri}\pfill a-281, b-444 + \subitem \texttt {T2A} encoding\pfill \main{b-93} + \subitem \texttt {T2B} encoding\pfill \main{b-93} + \subitem \texttt {T2C} encoding\pfill \main{b-93} + \subitem \texttt {X2} encoding\pfill \main{b-93} + \item \texttt {\PrintChar{092}CYRIE}\pfill a-281 + \subitem \texttt {T2A} encoding\pfill \main{b-249} + \subitem \texttt {X2} encoding\pfill \main{b-191} + \item \texttt {\PrintChar{092}cyrie}\pfill a-281 + \subitem \texttt {T2A} encoding\pfill \main{b-250} + \subitem \texttt {X2} encoding\pfill \main{b-192} + \item \texttt {\PrintChar{092}CYRII}\pfill a-281, b-446 + \subitem \texttt {T2A} encoding\pfill \main{b-392} + \subitem \texttt {T2B} encoding\pfill \main{b-392} + \subitem \texttt {T2C} encoding\pfill \main{b-392} + \subitem \texttt {X2} encoding\pfill \main{b-392} + \item \texttt {\PrintChar{092}cyrii}\pfill a-281, b-447 + \subitem \texttt {T2A} encoding\pfill \main{b-393} + \subitem \texttt {T2B} encoding\pfill \main{b-393} + \subitem \texttt {T2C} encoding\pfill \main{b-393} + \subitem \texttt {X2} encoding\pfill \main{b-393} + \item \texttt {\PrintChar{092}CYRISHRT}\pfill a-281 + \subitem \texttt {T2A} encoding\pfill \main{b-94} + \subitem \texttt {T2B} encoding\pfill \main{b-94} + \subitem \texttt {T2C} encoding\pfill \main{b-94} + \subitem \texttt {X2} encoding\pfill \main{b-94} + \item \texttt {\PrintChar{092}cyrishrt}\pfill a-281 + \subitem \texttt {T2A} encoding\pfill \main{b-95} + \subitem \texttt {T2B} encoding\pfill \main{b-95} + \subitem \texttt {T2C} encoding\pfill \main{b-95} + \subitem \texttt {X2} encoding\pfill \main{b-95} + \item \texttt {\PrintChar{092}CYRISHRTDSC}\pfill a-282 + \subitem \texttt {T2C} encoding\pfill \main{b-355} + \item \texttt {\PrintChar{092}cyrishrtdsc}\pfill a-282 + \subitem \texttt {T2C} encoding\pfill \main{b-356} + \item \texttt {\PrintChar{092}CYRIZH}\pfill a-282 + \subitem \texttt {X2} encoding\pfill \main{b-433} + \item \texttt {\PrintChar{092}cyrizh}\pfill a-282 + \subitem \texttt {X2} encoding\pfill \main{b-434} + \item \texttt {\PrintChar{092}CYRJE}\pfill a-282 + \subitem \texttt {T2A} encoding\pfill \main{b-394} + \subitem \texttt {T2B} encoding\pfill \main{b-394} + \subitem \texttt {T2C} encoding\pfill \main{b-394} + \subitem \texttt {X2} encoding\pfill \main{b-394} + \item \texttt {\PrintChar{092}cyrje}\pfill a-282 + \subitem \texttt {T2A} encoding\pfill \main{b-395} + \subitem \texttt {T2B} encoding\pfill \main{b-395} + \subitem \texttt {T2C} encoding\pfill \main{b-395} + \subitem \texttt {X2} encoding\pfill \main{b-395} + \item \texttt {\PrintChar{092}CYRK}\pfill a-282 + \subitem \texttt {T2A} encoding\pfill \main{b-96} + \subitem \texttt {T2B} encoding\pfill \main{b-96} + \subitem \texttt {T2C} encoding\pfill \main{b-96} + \subitem \texttt {X2} encoding\pfill \main{b-96} + \item \texttt {\PrintChar{092}cyrk}\pfill a-282 + \subitem \texttt {T2A} encoding\pfill \main{b-97} + \subitem \texttt {T2B} encoding\pfill \main{b-97} + \subitem \texttt {T2C} encoding\pfill \main{b-97} + \subitem \texttt {X2} encoding\pfill \main{b-97} + \item \texttt {\PrintChar{092}CYRKBEAK}\pfill a-283 + \subitem \texttt {T2A} encoding\pfill \main{b-219} + \subitem \texttt {X2} encoding\pfill \main{b-161} + \item \texttt {\PrintChar{092}cyrkbeak}\pfill a-283 + \subitem \texttt {T2A} encoding\pfill \main{b-220} + \subitem \texttt {X2} encoding\pfill \main{b-162} + \item \texttt {\PrintChar{092}CYRKDSC}\pfill a-283 + \subitem \texttt {T2A} encoding\pfill \main{b-217} + \subitem \texttt {T2B} encoding\pfill \main{b-275} + \subitem \texttt {T2C} encoding\pfill \main{b-333} + \subitem \texttt {X2} encoding\pfill \main{b-159} + \item \texttt {\PrintChar{092}cyrkdsc}\pfill a-283 + \subitem \texttt {T2A} encoding\pfill \main{b-218} + \subitem \texttt {T2B} encoding\pfill \main{b-276} + \subitem \texttt {T2C} encoding\pfill \main{b-334} + \subitem \texttt {X2} encoding\pfill \main{b-160} + \item \texttt {\PrintChar{092}CYRKHCRS}\pfill a-283 + \subitem \texttt {T2C} encoding\pfill \main{b-337} + \subitem \texttt {X2} encoding\pfill \main{b-387} + \item \texttt {\PrintChar{092}cyrkhcrs}\pfill a-283 + \subitem \texttt {T2C} encoding\pfill \main{b-338} + \subitem \texttt {X2} encoding\pfill \main{b-388} + \item \texttt {\PrintChar{092}CYRKHK}\pfill a-284 + \subitem \texttt {T2B} encoding\pfill \main{b-279} + \subitem \texttt {X2} encoding\pfill \main{b-163} + \item \texttt {\PrintChar{092}cyrkhk}\pfill a-283 + \subitem \texttt {T2B} encoding\pfill \main{b-280} + \subitem \texttt {X2} encoding\pfill \main{b-164} + \item \texttt {\PrintChar{092}CYRKVCRS}\pfill a-284 + \subitem \texttt {T2A} encoding\pfill \main{b-221} + \subitem \texttt {X2} encoding\pfill \main{b-385} + \item \texttt {\PrintChar{092}cyrkvcrs}\pfill a-284 + \subitem \texttt {T2A} encoding\pfill \main{b-222} + \subitem \texttt {X2} encoding\pfill \main{b-386} + \item \texttt {\PrintChar{092}CYRL}\pfill a-284 + \subitem \texttt {T2A} encoding\pfill \main{b-98} + \subitem \texttt {T2B} encoding\pfill \main{b-98} + \subitem \texttt {T2C} encoding\pfill \main{b-98} + \subitem \texttt {X2} encoding\pfill \main{b-98} + \item \texttt {\PrintChar{092}cyrl}\pfill a-284 + \subitem \texttt {T2A} encoding\pfill \main{b-99} + \subitem \texttt {T2B} encoding\pfill \main{b-99} + \subitem \texttt {T2C} encoding\pfill \main{b-99} + \subitem \texttt {X2} encoding\pfill \main{b-99} + \item \texttt {\PrintChar{092}cyrlangle}\efill + \subitem \texttt {T2A} encoding\pfill \main{b-69} + \subitem \texttt {T2B} encoding\pfill \main{b-69} + \subitem \texttt {T2C} encoding\pfill \main{b-69} + \subitem \texttt {X2} encoding\pfill \main{b-69} + \item \texttt {\PrintChar{092}CYRLDSC}\pfill a-284 + \subitem \texttt {T2B} encoding\pfill \main{b-277} + \subitem \texttt {T2C} encoding\pfill \main{b-335} + \subitem \texttt {X2} encoding\pfill \main{b-389} + \item \texttt {\PrintChar{092}cyrldsc}\pfill a-284 + \subitem \texttt {T2B} encoding\pfill \main{b-278} + \subitem \texttt {T2C} encoding\pfill \main{b-336} + \subitem \texttt {X2} encoding\pfill \main{b-390} + \item \texttt {\PrintChar{092}CYRLHK}\pfill a-285 + \subitem \texttt {T2B} encoding\pfill \main{b-281} + \subitem \texttt {T2C} encoding\pfill \main{b-339} + \subitem \texttt {X2} encoding\pfill \main{b-165} + \item \texttt {\PrintChar{092}cyrlhk}\pfill a-284 + \subitem \texttt {T2B} encoding\pfill \main{b-282} + \subitem \texttt {T2C} encoding\pfill \main{b-340} + \subitem \texttt {X2} encoding\pfill \main{b-166} + \item \texttt {\PrintChar{092}CYRLJE}\pfill a-285 + \subitem \texttt {T2A} encoding\pfill \main{b-213} + \subitem \texttt {T2B} encoding\pfill \main{b-273} + \subitem \texttt {X2} encoding\pfill \main{b-396} + \item \texttt {\PrintChar{092}cyrlje}\pfill a-285 + \subitem \texttt {T2A} encoding\pfill \main{b-214} + \subitem \texttt {T2B} encoding\pfill \main{b-274} + \subitem \texttt {X2} encoding\pfill \main{b-398} + \item \texttt {\PrintChar{092}CYRM}\pfill a-285 + \subitem \texttt {T2A} encoding\pfill \main{b-100} + \subitem \texttt {T2B} encoding\pfill \main{b-100} + \subitem \texttt {T2C} encoding\pfill \main{b-100} + \subitem \texttt {X2} encoding\pfill \main{b-100} + \item \texttt {\PrintChar{092}cyrm}\pfill a-285 + \subitem \texttt {T2A} encoding\pfill \main{b-101} + \subitem \texttt {T2B} encoding\pfill \main{b-101} + \subitem \texttt {T2C} encoding\pfill \main{b-101} + \subitem \texttt {X2} encoding\pfill \main{b-101} + \item \texttt {\PrintChar{092}CYRMDSC}\pfill a-285 + \subitem \texttt {T2C} encoding\pfill \main{b-331} + \subitem \texttt {X2} encoding\pfill \main{b-399} + \item \texttt {\PrintChar{092}cyrmdsc}\pfill a-285 + \subitem \texttt {T2C} encoding\pfill \main{b-332} + \subitem \texttt {X2} encoding\pfill \main{b-400} + \item \texttt {\PrintChar{092}CYRMHK}\pfill a-285 + \subitem \texttt {T2C} encoding\pfill \main{b-343} + \item \texttt {\PrintChar{092}cyrmhk}\pfill a-285 + \subitem \texttt {T2C} encoding\pfill \main{b-344} + \item \texttt {\PrintChar{092}CYRN}\pfill a-286 + \subitem \texttt {T2A} encoding\pfill \main{b-102} + \subitem \texttt {T2B} encoding\pfill \main{b-102} + \subitem \texttt {T2C} encoding\pfill \main{b-102} + \subitem \texttt {X2} encoding\pfill \main{b-102} + \item \texttt {\PrintChar{092}cyrn}\pfill a-286 + \subitem \texttt {T2A} encoding\pfill \main{b-103} + \subitem \texttt {T2B} encoding\pfill \main{b-103} + \subitem \texttt {T2C} encoding\pfill \main{b-103} + \subitem \texttt {X2} encoding\pfill \main{b-103} + \item \texttt {\PrintChar{092}CYRNDSC}\pfill a-286 + \subitem \texttt {T2A} encoding\pfill \main{b-225} + \subitem \texttt {T2B} encoding\pfill \main{b-283} + \subitem \texttt {T2C} encoding\pfill \main{b-341} + \subitem \texttt {X2} encoding\pfill \main{b-167} + \item \texttt {\PrintChar{092}cyrndsc}\pfill a-286 + \subitem \texttt {T2A} encoding\pfill \main{b-226} + \subitem \texttt {T2B} encoding\pfill \main{b-284} + \subitem \texttt {T2C} encoding\pfill \main{b-342} + \subitem \texttt {X2} encoding\pfill \main{b-168} + \item \texttt {\PrintChar{092}CYRNG}\pfill a-286 + \subitem \texttt {T2A} encoding\pfill \main{b-227} + \subitem \texttt {T2B} encoding\pfill \main{b-285} + \subitem \texttt {X2} encoding\pfill \main{b-169} + \item \texttt {\PrintChar{092}cyrng}\pfill a-286 + \subitem \texttt {T2A} encoding\pfill \main{b-228} + \subitem \texttt {T2B} encoding\pfill \main{b-286} + \subitem \texttt {X2} encoding\pfill \main{b-170} + \item \texttt {\PrintChar{092}CYRNHK}\pfill a-286 + \subitem \texttt {T2B} encoding\pfill \main{b-287} + \subitem \texttt {T2C} encoding\pfill \main{b-345} + \subitem \texttt {X2} encoding\pfill \main{b-171} + \item \texttt {\PrintChar{092}cyrnhk}\pfill a-286 + \subitem \texttt {T2B} encoding\pfill \main{b-288} + \subitem \texttt {T2C} encoding\pfill \main{b-346} + \subitem \texttt {X2} encoding\pfill \main{b-172} + \item \texttt {\PrintChar{092}CYRNJE}\pfill a-287 + \subitem \texttt {T2A} encoding\pfill \main{b-253} + \subitem \texttt {T2B} encoding\pfill \main{b-307} + \subitem \texttt {X2} encoding\pfill \main{b-401} + \item \texttt {\PrintChar{092}cyrnje}\pfill a-286 + \subitem \texttt {T2A} encoding\pfill \main{b-254} + \subitem \texttt {T2B} encoding\pfill \main{b-308} + \subitem \texttt {X2} encoding\pfill \main{b-402} + \item \texttt {\PrintChar{092}CYRNLHK}\pfill a-287 + \subitem \texttt {T2C} encoding\pfill \main{b-365} + \subitem \texttt {X2} encoding\pfill \main{b-437} + \item \texttt {\PrintChar{092}cyrnlhk}\pfill a-287 + \subitem \texttt {T2C} encoding\pfill \main{b-366} + \subitem \texttt {X2} encoding\pfill \main{b-438} + \item \texttt {\PrintChar{092}CYRO}\pfill a-287 + \subitem \texttt {T2A} encoding\pfill \main{b-104} + \subitem \texttt {T2B} encoding\pfill \main{b-104} + \subitem \texttt {T2C} encoding\pfill \main{b-104} + \subitem \texttt {X2} encoding\pfill \main{b-104} + \item \texttt {\PrintChar{092}cyro}\pfill a-287 + \subitem \texttt {T2A} encoding\pfill \main{b-105} + \subitem \texttt {T2B} encoding\pfill \main{b-105} + \subitem \texttt {T2C} encoding\pfill \main{b-105} + \subitem \texttt {X2} encoding\pfill \main{b-105} + \item \texttt {\PrintChar{092}CYROTLD}\pfill a-287 + \subitem \texttt {T2A} encoding\pfill \main{b-231} + \subitem \texttt {T2B} encoding\pfill \main{b-289} + \subitem \texttt {T2C} encoding\pfill \main{b-347} + \subitem \texttt {X2} encoding\pfill \main{b-173} + \item \texttt {\PrintChar{092}cyrotld}\pfill a-287 + \subitem \texttt {T2A} encoding\pfill \main{b-232} + \subitem \texttt {T2B} encoding\pfill \main{b-290} + \subitem \texttt {T2C} encoding\pfill \main{b-348} + \subitem \texttt {X2} encoding\pfill \main{b-174} + \item \texttt {\PrintChar{092}CYRP}\pfill a-287 + \subitem \texttt {T2A} encoding\pfill \main{b-106} + \subitem \texttt {T2B} encoding\pfill \main{b-106} + \subitem \texttt {T2C} encoding\pfill \main{b-106} + \subitem \texttt {X2} encoding\pfill \main{b-106} + \item \texttt {\PrintChar{092}cyrp}\pfill a-287 + \subitem \texttt {T2A} encoding\pfill \main{b-107} + \subitem \texttt {T2B} encoding\pfill \main{b-107} + \subitem \texttt {T2C} encoding\pfill \main{b-107} + \subitem \texttt {X2} encoding\pfill \main{b-107} + \item \texttt {\PrintChar{092}CYRpalochka}\efill + \subitem \texttt {T2A} encoding\pfill \main{b-68} + \subitem \texttt {T2B} encoding\pfill \main{b-68} + \subitem \texttt {T2C} encoding\pfill \main{b-68} + \subitem \texttt {X2} encoding\pfill \main{b-68} + \item \texttt {\PrintChar{092}CYRPHK}\pfill a-288 + \subitem \texttt {T2C} encoding\pfill \main{b-314} + \subitem \texttt {X2} encoding\pfill \main{b-405} + \item \texttt {\PrintChar{092}cyrphk}\pfill a-288 + \subitem \texttt {T2C} encoding\pfill \main{b-316} + \subitem \texttt {X2} encoding\pfill \main{b-406} + \item \texttt {\PrintChar{092}CYRQ}\pfill a-288 + \subitem \texttt {T2A} encoding\pfill \main{b-410} + \subitem \texttt {T2B} encoding\pfill \main{b-410} + \subitem \texttt {T2C} encoding\pfill \main{b-410} + \subitem \texttt {X2} encoding\pfill \main{b-410} + \item \texttt {\PrintChar{092}cyrq}\pfill a-288 + \subitem \texttt {T2A} encoding\pfill \main{b-411} + \subitem \texttt {T2B} encoding\pfill \main{b-411} + \subitem \texttt {T2C} encoding\pfill \main{b-411} + \subitem \texttt {X2} encoding\pfill \main{b-411} + \item \texttt {\PrintChar{092}CYRR}\pfill a-288 + \subitem \texttt {T2A} encoding\pfill \main{b-108} + \subitem \texttt {T2B} encoding\pfill \main{b-108} + \subitem \texttt {T2C} encoding\pfill \main{b-108} + \subitem \texttt {X2} encoding\pfill \main{b-108} + \item \texttt {\PrintChar{092}cyrr}\pfill a-288 + \subitem \texttt {T2A} encoding\pfill \main{b-109} + \subitem \texttt {T2B} encoding\pfill \main{b-109} + \subitem \texttt {T2C} encoding\pfill \main{b-109} + \subitem \texttt {X2} encoding\pfill \main{b-109} + \item \texttt {\PrintChar{092}cyrrangle}\efill + \subitem \texttt {T2A} encoding\pfill \main{b-70} + \subitem \texttt {T2B} encoding\pfill \main{b-70} + \subitem \texttt {T2C} encoding\pfill \main{b-70} + \subitem \texttt {X2} encoding\pfill \main{b-70} + \item \texttt {\PrintChar{092}CYRRDSC}\pfill a-288 + \subitem \texttt {T2C} encoding\pfill \main{b-325} + \subitem \texttt {X2} encoding\pfill \main{b-407} + \item \texttt {\PrintChar{092}cyrrdsc}\pfill a-288 + \subitem \texttt {T2C} encoding\pfill \main{b-326} + \subitem \texttt {X2} encoding\pfill \main{b-408} + \item \texttt {\PrintChar{092}CYRRHK}\pfill a-289 + \subitem \texttt {T2C} encoding\pfill \main{b-369} + \item \texttt {\PrintChar{092}cyrrhk}\pfill a-288 + \subitem \texttt {T2C} encoding\pfill \main{b-370} + \item \texttt {\PrintChar{092}CYRRTICK}\pfill a-289 + \subitem \texttt {T2C} encoding\pfill \main{b-327} + \item \texttt {\PrintChar{092}cyrrtick}\pfill a-289 + \subitem \texttt {T2C} encoding\pfill \main{b-328} + \item \texttt {\PrintChar{092}CYRS}\pfill a-289, b-450 + \subitem \texttt {T2A} encoding\pfill \main{b-110} + \subitem \texttt {T2B} encoding\pfill \main{b-110} + \subitem \texttt {T2C} encoding\pfill \main{b-110} + \subitem \texttt {X2} encoding\pfill \main{b-110} + \item \texttt {\PrintChar{092}cyrs}\pfill a-289, b-451 + \subitem \texttt {T2A} encoding\pfill \main{b-111} + \subitem \texttt {T2B} encoding\pfill \main{b-111} + \subitem \texttt {T2C} encoding\pfill \main{b-111} + \subitem \texttt {X2} encoding\pfill \main{b-111} + \item \texttt {\PrintChar{092}CYRSACRS}\pfill a-289 + \subitem \texttt {T2B} encoding\pfill \main{b-291} + \item \texttt {\PrintChar{092}cyrsacrs}\pfill a-289 + \subitem \texttt {T2B} encoding\pfill \main{b-292} + \item \texttt {\PrintChar{092}CYRSCHWA}\pfill a-290 + \subitem \texttt {T2A} encoding\pfill \main{b-251} + \subitem \texttt {T2B} encoding\pfill \main{b-309} + \subitem \texttt {T2C} encoding\pfill \main{b-367} + \subitem \texttt {X2} encoding\pfill \main{b-193} + \item \texttt {\PrintChar{092}cyrschwa}\pfill a-290 + \subitem \texttt {T2A} encoding\pfill \main{b-252} + \subitem \texttt {T2B} encoding\pfill \main{b-310} + \subitem \texttt {T2C} encoding\pfill \main{b-368} + \subitem \texttt {X2} encoding\pfill \main{b-194} + \item \texttt {\PrintChar{092}CYRSDSC}\pfill a-290 + \subitem \texttt {T2A} encoding\pfill \main{b-233} + \subitem \texttt {X2} encoding\pfill \main{b-175} + \item \texttt {\PrintChar{092}cyrsdsc}\pfill a-290 + \subitem \texttt {T2A} encoding\pfill \main{b-234} + \subitem \texttt {X2} encoding\pfill \main{b-176} + \item \texttt {\PrintChar{092}CYRSEMISFTSN}\pfill a-290 + \subitem \texttt {T2C} encoding\pfill \main{b-353} + \item \texttt {\PrintChar{092}cyrsemisftsn}\pfill a-290 + \subitem \texttt {T2C} encoding\pfill \main{b-354} + \item \texttt {\PrintChar{092}CYRSFTSN}\pfill a-291 + \subitem \texttt {T2A} encoding\pfill \main{b-132} + \subitem \texttt {T2B} encoding\pfill \main{b-132} + \subitem \texttt {T2C} encoding\pfill \main{b-132} + \subitem \texttt {X2} encoding\pfill \main{b-132} + \item \texttt {\PrintChar{092}cyrsftsn}\pfill a-291 + \subitem \texttt {T2A} encoding\pfill \main{b-133} + \subitem \texttt {T2B} encoding\pfill \main{b-133} + \subitem \texttt {T2C} encoding\pfill \main{b-133} + \subitem \texttt {X2} encoding\pfill \main{b-133} + \item \texttt {\PrintChar{092}CYRSH}\pfill a-291 + \subitem \texttt {T2A} encoding\pfill \main{b-124} + \subitem \texttt {T2B} encoding\pfill \main{b-124} + \subitem \texttt {T2C} encoding\pfill \main{b-124} + \subitem \texttt {X2} encoding\pfill \main{b-124} + \item \texttt {\PrintChar{092}cyrsh}\pfill a-291 + \subitem \texttt {T2A} encoding\pfill \main{b-125} + \subitem \texttt {T2B} encoding\pfill \main{b-125} + \subitem \texttt {T2C} encoding\pfill \main{b-125} + \subitem \texttt {X2} encoding\pfill \main{b-125} + \item \texttt {\PrintChar{092}CYRSHCH}\pfill a-291 + \subitem \texttt {T2A} encoding\pfill \main{b-126} + \subitem \texttt {T2B} encoding\pfill \main{b-126} + \subitem \texttt {T2C} encoding\pfill \main{b-126} + \subitem \texttt {X2} encoding\pfill \main{b-126} + \item \texttt {\PrintChar{092}cyrshch}\pfill a-291 + \subitem \texttt {T2A} encoding\pfill \main{b-127} + \subitem \texttt {T2B} encoding\pfill \main{b-127} + \subitem \texttt {T2C} encoding\pfill \main{b-127} + \subitem \texttt {X2} encoding\pfill \main{b-127} + \item \texttt {\PrintChar{092}CYRSHHA}\pfill a-291 + \subitem \texttt {T2A} encoding\pfill \main{b-207} + \subitem \texttt {T2B} encoding\pfill \main{b-265} + \subitem \texttt {T2C} encoding\pfill \main{b-323} + \subitem \texttt {X2} encoding\pfill \main{b-149} + \item \texttt {\PrintChar{092}cyrshha}\pfill a-291 + \subitem \texttt {T2A} encoding\pfill \main{b-208} + \subitem \texttt {T2B} encoding\pfill \main{b-266} + \subitem \texttt {T2C} encoding\pfill \main{b-324} + \subitem \texttt {X2} encoding\pfill \main{b-150} + \item \texttt {\PrintChar{092}CYRT}\pfill a-292 + \subitem \texttt {T2A} encoding\pfill \main{b-112} + \subitem \texttt {T2B} encoding\pfill \main{b-112} + \subitem \texttt {T2C} encoding\pfill \main{b-112} + \subitem \texttt {X2} encoding\pfill \main{b-112} + \item \texttt {\PrintChar{092}cyrt}\pfill a-292 + \subitem \texttt {T2A} encoding\pfill \main{b-113} + \subitem \texttt {T2B} encoding\pfill \main{b-113} + \subitem \texttt {T2C} encoding\pfill \main{b-113} + \subitem \texttt {X2} encoding\pfill \main{b-113} + \item \texttt {\PrintChar{092}CYRTDSC}\pfill a-292 + \subitem \texttt {T2C} encoding\pfill \main{b-319} + \subitem \texttt {X2} encoding\pfill \main{b-412} + \item \texttt {\PrintChar{092}cyrtdsc}\pfill a-292 + \subitem \texttt {T2C} encoding\pfill \main{b-320} + \subitem \texttt {X2} encoding\pfill \main{b-414} + \item \texttt {\PrintChar{092}CYRTETSE}\pfill a-292 + \subitem \texttt {T2C} encoding\pfill \main{b-317} + \subitem \texttt {X2} encoding\pfill \main{b-418} + \item \texttt {\PrintChar{092}cyrtetse}\pfill a-292 + \subitem \texttt {T2C} encoding\pfill \main{b-318} + \subitem \texttt {X2} encoding\pfill \main{b-420} + \item \texttt {\PrintChar{092}CYRTSHE}\pfill a-292 + \subitem \texttt {T2A} encoding\pfill \main{b-205} + \subitem \texttt {X2} encoding\pfill \main{b-379} + \item \texttt {\PrintChar{092}cyrtshe}\pfill a-292 + \subitem \texttt {T2A} encoding\pfill \main{b-206} + \subitem \texttt {X2} encoding\pfill \main{b-380} + \item \texttt {\PrintChar{092}CYRU}\pfill a-293, b-454 + \subitem \texttt {T2A} encoding\pfill \main{b-114} + \subitem \texttt {T2B} encoding\pfill \main{b-114} + \subitem \texttt {T2C} encoding\pfill \main{b-114} + \subitem \texttt {X2} encoding\pfill \main{b-114} + \item \texttt {\PrintChar{092}cyru}\pfill a-293, b-455 + \subitem \texttt {T2A} encoding\pfill \main{b-115} + \subitem \texttt {T2B} encoding\pfill \main{b-115} + \subitem \texttt {T2C} encoding\pfill \main{b-115} + \subitem \texttt {X2} encoding\pfill \main{b-115} + \item \texttt {\PrintChar{092}CYRUSHRT}\pfill a-293 + \subitem \texttt {T2A} encoding\pfill \main{b-235} + \subitem \texttt {T2B} encoding\pfill \main{b-293} + \subitem \texttt {X2} encoding\pfill \main{b-177} + \item \texttt {\PrintChar{092}cyrushrt}\pfill a-293 + \subitem \texttt {T2A} encoding\pfill \main{b-236} + \subitem \texttt {T2B} encoding\pfill \main{b-294} + \subitem \texttt {X2} encoding\pfill \main{b-178} + \item \texttt {\PrintChar{092}CYRV}\pfill a-293 + \subitem \texttt {T2A} encoding\pfill \main{b-80} + \subitem \texttt {T2B} encoding\pfill \main{b-80} + \subitem \texttt {T2C} encoding\pfill \main{b-80} + \subitem \texttt {X2} encoding\pfill \main{b-80} + \item \texttt {\PrintChar{092}cyrv}\pfill a-293 + \subitem \texttt {T2A} encoding\pfill \main{b-81} + \subitem \texttt {T2B} encoding\pfill \main{b-81} + \subitem \texttt {T2C} encoding\pfill \main{b-81} + \subitem \texttt {X2} encoding\pfill \main{b-81} + \item \texttt {\PrintChar{092}CYRW}\pfill a-293 + \subitem \texttt {T2A} encoding\pfill \main{b-426} + \subitem \texttt {T2B} encoding\pfill \main{b-426} + \subitem \texttt {T2C} encoding\pfill \main{b-426} + \subitem \texttt {X2} encoding\pfill \main{b-426} + \item \texttt {\PrintChar{092}cyrw}\pfill a-293 + \subitem \texttt {T2A} encoding\pfill \main{b-427} + \subitem \texttt {T2B} encoding\pfill \main{b-427} + \subitem \texttt {T2C} encoding\pfill \main{b-427} + \subitem \texttt {X2} encoding\pfill \main{b-427} + \item \texttt {\PrintChar{092}CYRY}\pfill a-293 + \subitem \texttt {T2A} encoding\pfill \main{b-237} + \subitem \texttt {T2B} encoding\pfill \main{b-295} + \subitem \texttt {X2} encoding\pfill \main{b-179} + \item \texttt {\PrintChar{092}cyry}\pfill a-293 + \subitem \texttt {T2A} encoding\pfill \main{b-238} + \subitem \texttt {T2B} encoding\pfill \main{b-296} + \subitem \texttt {X2} encoding\pfill \main{b-180} + \item \texttt {\PrintChar{092}CYRYA}\pfill a-294 + \subitem \texttt {T2A} encoding\pfill \main{b-138} + \subitem \texttt {T2B} encoding\pfill \main{b-138} + \subitem \texttt {T2C} encoding\pfill \main{b-138} + \subitem \texttt {X2} encoding\pfill \main{b-138} + \item \texttt {\PrintChar{092}cyrya}\pfill a-294 + \subitem \texttt {T2A} encoding\pfill \main{b-139} + \subitem \texttt {T2B} encoding\pfill \main{b-139} + \subitem \texttt {T2C} encoding\pfill \main{b-139} + \subitem \texttt {X2} encoding\pfill \main{b-139} + \item \texttt {\PrintChar{092}CYRYAT}\pfill a-294 + \subitem \texttt {X2} encoding\pfill \main{b-428} + \item \texttt {\PrintChar{092}cyryat}\pfill a-294 + \subitem \texttt {X2} encoding\pfill \main{b-430} + \item \texttt {\PrintChar{092}CYRYHCRS}\pfill a-294 + \subitem \texttt {T2A} encoding\pfill \main{b-239} + \subitem \texttt {X2} encoding\pfill \main{b-181} + \item \texttt {\PrintChar{092}cyryhcrs}\pfill a-294 + \subitem \texttt {T2A} encoding\pfill \main{b-240} + \subitem \texttt {X2} encoding\pfill \main{b-182} + \item \texttt {\PrintChar{092}CYRYI}\pfill a-294 + \subitem \texttt {T2A} encoding\pfill \main{b-215} + \subitem \texttt {X2} encoding\pfill \main{b-157} + \item \texttt {\PrintChar{092}cyryi}\pfill a-294 + \subitem \texttt {T2A} encoding\pfill \main{b-216} + \subitem \texttt {X2} encoding\pfill \main{b-158} + \item \texttt {\PrintChar{092}CYRYO}\pfill a-295 + \subitem \texttt {T2A} encoding\pfill \main{b-372} + \subitem \texttt {T2B} encoding\pfill \main{b-372} + \subitem \texttt {T2C} encoding\pfill \main{b-372} + \subitem \texttt {X2} encoding\pfill \main{b-372} + \item \texttt {\PrintChar{092}cyryo}\pfill a-294 + \subitem \texttt {T2A} encoding\pfill \main{b-373} + \subitem \texttt {T2B} encoding\pfill \main{b-373} + \subitem \texttt {T2C} encoding\pfill \main{b-373} + \subitem \texttt {X2} encoding\pfill \main{b-373} + \item \texttt {\PrintChar{092}CYRYU}\pfill a-295 + \subitem \texttt {T2A} encoding\pfill \main{b-136} + \subitem \texttt {T2B} encoding\pfill \main{b-136} + \subitem \texttt {T2C} encoding\pfill \main{b-136} + \subitem \texttt {X2} encoding\pfill \main{b-136} + \item \texttt {\PrintChar{092}cyryu}\pfill a-295 + \subitem \texttt {T2A} encoding\pfill \main{b-137} + \subitem \texttt {T2B} encoding\pfill \main{b-137} + \subitem \texttt {T2C} encoding\pfill \main{b-137} + \subitem \texttt {X2} encoding\pfill \main{b-137} + \item \texttt {\PrintChar{092}CYRZ}\pfill a-295, b-448 + \subitem \texttt {T2A} encoding\pfill \main{b-90} + \subitem \texttt {T2B} encoding\pfill \main{b-90} + \subitem \texttt {T2C} encoding\pfill \main{b-90} + \subitem \texttt {X2} encoding\pfill \main{b-90} + \item \texttt {\PrintChar{092}cyrz}\pfill a-295, b-449 + \subitem \texttt {T2A} encoding\pfill \main{b-91} + \subitem \texttt {T2B} encoding\pfill \main{b-91} + \subitem \texttt {T2C} encoding\pfill \main{b-91} + \subitem \texttt {X2} encoding\pfill \main{b-91} + \item \texttt {\PrintChar{092}CYRZDSC}\pfill a-295 + \subitem \texttt {T2A} encoding\pfill \main{b-211} + \subitem \texttt {X2} encoding\pfill \main{b-153} + \item \texttt {\PrintChar{092}cyrzdsc}\pfill a-295 + \subitem \texttt {T2A} encoding\pfill \main{b-212} + \subitem \texttt {X2} encoding\pfill \main{b-154} + \item \texttt {\PrintChar{092}CYRZH}\pfill a-295 + \subitem \texttt {T2A} encoding\pfill \main{b-88} + \subitem \texttt {T2B} encoding\pfill \main{b-88} + \subitem \texttt {T2C} encoding\pfill \main{b-88} + \subitem \texttt {X2} encoding\pfill \main{b-88} + \item \texttt {\PrintChar{092}cyrzh}\pfill a-295 + \subitem \texttt {T2A} encoding\pfill \main{b-89} + \subitem \texttt {T2B} encoding\pfill \main{b-89} + \subitem \texttt {T2C} encoding\pfill \main{b-89} + \subitem \texttt {X2} encoding\pfill \main{b-89} + \item \texttt {\PrintChar{092}CYRZHDSC}\pfill a-296 + \subitem \texttt {T2A} encoding\pfill \main{b-209} + \subitem \texttt {T2B} encoding\pfill \main{b-267} + \subitem \texttt {X2} encoding\pfill \main{b-151} + \item \texttt {\PrintChar{092}cyrzhdsc}\pfill a-296 + \subitem \texttt {T2A} encoding\pfill \main{b-210} + \subitem \texttt {T2B} encoding\pfill \main{b-268} + \subitem \texttt {X2} encoding\pfill \main{b-152} + + \indexspace +{\bfseries\hfil D\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}d}\efill + \subitem default\pfill \main{a-185} + \subitem \texttt {OT1} encoding\pfill \main{a-352} + \subitem \texttt {OT4} encoding\pfill \main{a-642} + \subitem \texttt {T1} encoding\pfill \main{a-421} + \subitem \texttt {T2A} encoding\pfill \main{b-34} + \subitem \texttt {T2B} encoding\pfill \main{b-34} + \subitem \texttt {T2C} encoding\pfill \main{b-34} + \subitem \texttt {X2} encoding\pfill \main{b-34} + \item \texttt {\PrintChar{092}dag}\pfill a-256 + \item \texttt {\PrintChar{092}dagger}\pfill a-256 + \item \texttt {\PrintChar{092}ddag}\pfill a-257 + \item \texttt {\PrintChar{092}ddagger}\pfill a-257 + \item \texttt {\PrintChar{092}@dec@text@cmd}\pfill \main{a-3} + \item \texttt {\PrintChar{092}DeclareFontEncoding}\pfill a-334, + a-402, a-595, a-615, a-621, a-704, b-8--b-11 + \item \texttt {\PrintChar{092}DeclareFontSubstitution}\pfill a-622, + a-705, b-12 + \item \texttt {\PrintChar{092}DeclareOption}\pfill a-299 + \item \texttt {\PrintChar{092}DeclareRobustCommand}\pfill + a-251--a-258, a-260, a-262, a-264 + \item \texttt {\PrintChar{092}DeclareTextAccent}\pfill \usage{2}, + \main{a-64}, a-335--a-345, a-403--a-413, a-618, + a-623--a-633, a-712--a-726, b-13--b-26 + \item \texttt {\PrintChar{092}DeclareTextAccentDefault}\pfill + \usage{3}, \main{a-135}, a-176--a-189, a-226, a-229, + a-844--a-861 + \item \texttt {\PrintChar{092}DeclareTextCommand}\pfill \usage{1}, + \main{a-3}, a-58, a-65, a-346, a-349, a-352, a-374, + a-376, a-378, a-380, a-386, a-393, a-414, a-417, a-421, + a-424, a-426, a-428, a-607, a-634, a-636, a-639, a-642, + a-672, a-679, a-706, a-709, a-756, b-27, b-30, b-34, + b-36, b-38, b-40 + \item \texttt {\PrintChar{092}DeclareTextCommandDefault}\pfill + \usage{3}, \main{a-57}, a-136, a-138, a-230, + a-233--a-236, a-238, a-242, a-246--a-250 + \item \texttt {\PrintChar{092}DeclareTextComposite}\pfill \usage{2}, + \main{a-74}, a-483--a-592, a-686--a-701, b-75, + b-441--b-444, b-446--b-451, b-454, b-455, b-458, b-459, + b-462, b-463 + \item \texttt {\PrintChar{092}DeclareTextCompositeCommand}\pfill + \usage{2}, \main{a-74}, a-383, a-669 + \item \texttt {\PrintChar{092}DeclareTextSymbol}\pfill \usage{1}, + \main{a-3}, a-355--a-373, a-430--a-482, a-596--a-606, + a-616, a-617, a-645--a-668, a-727--a-755, a-762--a-841, + b-42--b-74, b-76--b-139, b-141--b-196, b-199--b-254, + b-257--b-312, b-315--b-370, b-372, b-373, b-375--b-390, + b-392--b-395, b-397--b-408, b-410, b-411, b-413, b-414, + b-416, b-417, b-419--b-424, b-426, b-427, b-429--b-438 + \item \texttt {\PrintChar{092}DeclareTextSymbolDefault}\pfill + \usage{3}, \main{a-135}, a-190--a-225, a-227, a-228, + a-862--a-970 + \item \texttt {\PrintChar{092}DH}\efill + \subitem \texttt {T1} encoding\pfill \main{a-432} + \item \texttt {\PrintChar{092}dh}\efill + \subitem \texttt {T1} encoding\pfill \main{a-442} + \item \texttt {\PrintChar{092}dimen@}\pfill a-381, a-382, + a-384, a-385, a-670, a-671 + \item \texttt {\PrintChar{092}DJ}\efill + \subitem \texttt {T1} encoding\pfill \main{a-433} + \item \texttt {\PrintChar{092}dj}\efill + \subitem \texttt {T1} encoding\pfill \main{a-443} + \item \texttt {\PrintChar{092}dots}\pfill a-264, a-266 + + \indexspace +{\bfseries\hfil E\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}@eha}\pfill a-49 + \item \texttt {\PrintChar{092}@@enc@update}\pfill a-133 + \item \texttt {\PrintChar{092}encodingdefault}\pfill a-300, a-326 + + \indexspace +{\bfseries\hfil F\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}f}\efill + \subitem \texttt {T2A} encoding\pfill \main{b-24} + \subitem \texttt {T2B} encoding\pfill \main{b-24} + \subitem \texttt {T2C} encoding\pfill \main{b-24} + \subitem \texttt {X2} encoding\pfill \main{b-24} + \item \texttt {\PrintChar{092}f@encoding}\pfill a-128 + \item \texttt {\PrintChar{092}f@size}\pfill a-130 + \item \texttt {\PrintChar{092}@firstofone}\pfill a-68, a-113 + \item \texttt {\PrintChar{092}@firstoftwo}\pfill a-97 + \item \texttt {\PrintChar{092}font}\pfill a-243--a-245, a-387, a-394, + a-673, a-680 + \item \texttt {\PrintChar{092}font@name}\pfill a-129, a-132 + \item \texttt {\PrintChar{092}fontdimen}\pfill a-243--a-245, a-387, + a-394, a-673, a-680 + \item \texttt {\PrintChar{092}fontencoding}\pfill a-326 + \item \texttt {\PrintChar{092}fontshape}\pfill a-397, a-683 + + \indexspace +{\bfseries\hfil G\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}@gobble}\pfill a-24 + \item \texttt {\PrintChar{092}guillemotleft}\efill + \subitem \texttt {OT4} encoding\pfill \main{a-650} + \subitem \texttt {T1} encoding\pfill \main{a-444} + \subitem \texttt {T2A} encoding\pfill \main{b-71} + \subitem \texttt {T2B} encoding\pfill \main{b-71} + \subitem \texttt {T2C} encoding\pfill \main{b-71} + \subitem \texttt {X2} encoding\pfill \main{b-71} + \item \texttt {\PrintChar{092}guillemotright}\efill + \subitem \texttt {OT4} encoding\pfill \main{a-651} + \subitem \texttt {T1} encoding\pfill \main{a-445} + \subitem \texttt {T2A} encoding\pfill \main{b-72} + \subitem \texttt {T2B} encoding\pfill \main{b-72} + \subitem \texttt {T2C} encoding\pfill \main{b-72} + \subitem \texttt {X2} encoding\pfill \main{b-72} + \item \texttt {\PrintChar{092}guilsinglleft}\efill + \subitem \texttt {T1} encoding\pfill \main{a-446} + \item \texttt {\PrintChar{092}guilsinglright}\efill + \subitem \texttt {T1} encoding\pfill \main{a-447} + + \indexspace +{\bfseries\hfil H\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}H}\efill + \subitem default\pfill \main{a-180} + \subitem \texttt {OT1} encoding\pfill \main{a-342} + \subitem \texttt {OT4} encoding\pfill \main{a-630} + \subitem \texttt {T1} encoding\pfill \main{a-408} + \subsubitem \texttt {O} composite\pfill \main{a-496} + \subsubitem \texttt {o} composite\pfill \main{a-523} + \subsubitem \texttt {U} composite\pfill \main{a-504} + \subsubitem \texttt {u} composite\pfill \main{a-531} + \subitem \texttt {T2A} encoding\pfill \main{b-18} + \subitem \texttt {T2B} encoding\pfill \main{b-18} + \subitem \texttt {T2C} encoding\pfill \main{b-18} + \subitem \texttt {X2} encoding\pfill \main{b-18} + \item \texttt {\PrintChar{092}hb@xt@}\pfill a-377 + \item \texttt {\PrintChar{092}@height}\pfill a-239, a-241 + \item \texttt {\PrintChar{092}hidewidth}\pfill a-347, a-348, a-351, + a-354, a-415, a-416, a-419, a-423, a-425, a-637, a-638, + a-641, a-644, a-708, a-711, b-28, b-29, b-32, b-35, + b-37 + \item \texttt {\PrintChar{092}hmode@bgroup}\pfill a-67, \main{a-73}, + a-347, a-353, a-379, a-386, a-393, a-415, a-422, a-607, + a-637, a-643, a-672, a-679, a-707, a-710, a-756 + \item \texttt {\PrintChar{092}hmode@start@before@group}\pfill a-68, + a-111, a-113, a-119, \main{a-134} + \item \texttt {\PrintChar{092}hrule}\pfill a-237, a-240 + \item \texttt {\PrintChar{092}hyphenation}\pfill \main{a-155} + \item \texttt {\PrintChar{092}@@hyphenation}\pfill \main{a-155} + + \indexspace +{\bfseries\hfil I\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}i}\pfill a-483, a-575, a-577, a-579, + a-581, b-75 + \subitem default\pfill \main{a-197} + \subitem \texttt {OT1} encoding\pfill \main{a-359} + \subitem \texttt {OT4} encoding\pfill \main{a-652} + \subitem \texttt {T1} encoding\pfill \main{a-448} + \subitem \texttt {T2A} encoding\pfill \main{b-73} + \subitem \texttt {T2B} encoding\pfill \main{b-73} + \subitem \texttt {T2C} encoding\pfill \main{b-73} + \item \texttt {\PrintChar{092}@ifdefinable}\pfill a-16 + \item \texttt {\PrintChar{092}ifin@}\pfill a-316, a-319 + \item \texttt {\PrintChar{092}@ifl@ter}\pfill a-330, a-331 + \item \texttt {\PrintChar{092}@ifl@ter@@}\pfill a-330, a-331 + \item \texttt {\PrintChar{092}in@}\pfill a-314, a-317 + \item \texttt {\PrintChar{092}@inmathwarn}\pfill \main{a-3} + \item \texttt {\PrintChar{092}input}\pfill a-971 + \item \texttt {\PrintChar{092}InputIfFileExists}\pfill a-304 + \item \texttt {\PrintChar{092}itshape}\pfill a-395, a-681 + + \indexspace +{\bfseries\hfil J\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}j}\efill + \subitem default\pfill \main{a-198} + \subitem \texttt {OT1} encoding\pfill \main{a-360} + \subitem \texttt {OT4} encoding\pfill \main{a-653} + \subitem \texttt {T1} encoding\pfill \main{a-449} + \subitem \texttt {T2A} encoding\pfill \main{b-74} + \subitem \texttt {T2B} encoding\pfill \main{b-74} + \subitem \texttt {T2C} encoding\pfill \main{b-74} + + \indexspace +{\bfseries\hfil K\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}k}\efill + \subitem \texttt {OT4} encoding\pfill \main{a-634} + \subsubitem \texttt {A} composite\pfill \main{a-686} + \subsubitem \texttt {a} composite\pfill \main{a-693} + \subsubitem \texttt {E} composite\pfill \main{a-688} + \subsubitem \texttt {e} composite\pfill \main{a-695} + \subitem \texttt {T1} encoding\pfill \main{a-424} + \subsubitem \texttt {A} composite\pfill \main{a-485} + \subsubitem \texttt {a} composite\pfill \main{a-512} + \subsubitem \texttt {E} composite\pfill \main{a-490} + \subsubitem \texttt {e} composite\pfill \main{a-517} + \subitem \texttt {T2A} encoding\pfill \main{b-36} + \subsubitem \texttt {\PrintChar{092}CYRS} composite\pfill + \main{b-450} + \subsubitem \texttt {\PrintChar{092}cyrs} composite\pfill + \main{b-451} + \subitem \texttt {T2B} encoding\pfill \main{b-36} + \subitem \texttt {T2C} encoding\pfill \main{b-36} + \subsubitem \texttt {\PrintChar{092}CYRABHCH} composite\pfill + \main{b-461} + \subsubitem \texttt {\PrintChar{092}cyrabhch} composite\pfill + \main{b-463} + \subitem \texttt {X2} encoding\pfill \main{b-36} + \subsubitem \texttt {\PrintChar{092}CYRABHCH} composite\pfill + \main{b-457} + \subsubitem \texttt {\PrintChar{092}cyrabhch} composite\pfill + \main{b-459} + \subsubitem \texttt {\PrintChar{092}CYRS} composite\pfill + \main{b-450} + \subsubitem \texttt {\PrintChar{092}cyrs} composite\pfill + \main{b-451} + + \indexspace +{\bfseries\hfil L\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}L}\efill + \subitem default\pfill \main{a-192} + \subitem \texttt {OT1} encoding\pfill \main{a-376} + \subitem \texttt {OT4} encoding\pfill \main{a-648} + \subitem \texttt {T1} encoding\pfill \main{a-434} + \item \texttt {\PrintChar{092}l}\efill + \subitem default\pfill \main{a-199} + \subitem \texttt {OT1} encoding\pfill \main{a-378} + \subitem \texttt {OT4} encoding\pfill \main{a-654} + \subitem \texttt {T1} encoding\pfill \main{a-450} + \item \texttt {\PrintChar{092}LastDeclaredEncoding}\pfill b-12--b-27, + b-30, b-34, b-36, b-38, b-40, b-42--b-139, + b-372, b-373, b-392--b-395, b-410, b-411, b-416, b-417, + b-426, b-427, b-441--b-444, b-446--b-451, b-454, b-455 + \item \texttt {\PrintChar{092}@latex@error}\pfill a-47 + \item \texttt {\PrintChar{092}@latex@warning}\pfill a-55 + \item \texttt {\PrintChar{092}lbrace}\pfill a-252 + \item \texttt {\PrintChar{092}lccode}\pfill a-104 + \item \texttt {\PrintChar{092}ldots}\pfill a-266 + \item \texttt {\PrintChar{092}leavevmode}\pfill a-73, a-134, a-235, + a-237, a-350, a-377, a-381, a-384, a-418, a-640, a-670, + b-31 + \item \texttt {\PrintChar{092}lowercase}\pfill a-105, a-302 + + \indexspace +{\bfseries\hfil M\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}mathchardef}\pfill a-70 + \item \texttt {\PrintChar{092}mathdollar}\pfill a-251 + \item \texttt {\PrintChar{092}mathellipsis}\pfill a-265 + \item \texttt {\PrintChar{092}mathparagraph}\pfill a-254 + \item \texttt {\PrintChar{092}mathsection}\pfill a-255 + \item \texttt {\PrintChar{092}mathsterling}\pfill a-263 + \item \texttt {\PrintChar{092}mbox}\pfill a-239 + \item \texttt {\PrintChar{092}MessageBreak}\pfill a-121, a-307, + a-310 + + \indexspace +{\bfseries\hfil N\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}NeedsTeXFormat}\pfill b-2 + \item \texttt {\PrintChar{092}newcommand}\pfill a-4 + \item \texttt {\PrintChar{092}newtie}\efill + \subitem default\pfill \main{a-860} + \subitem \texttt {TS1} encoding\pfill \main{a-725} + \item \texttt {\PrintChar{092}nfss@text}\pfill a-259, a-261 + \item \texttt {\PrintChar{092}NG}\efill + \subitem \texttt {T1} encoding\pfill \main{a-435} + \item \texttt {\PrintChar{092}ng}\efill + \subitem \texttt {T1} encoding\pfill \main{a-451} + \item \texttt {\PrintChar{092}@nil}\pfill a-77 + \item \texttt {\PrintChar{092}null}\pfill a-425, a-708, a-711, b-37 + + \indexspace +{\bfseries\hfil O\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}O}\efill + \subitem default\pfill \main{a-194} + \subitem \texttt {OT1} encoding\pfill \main{a-357} + \subitem \texttt {OT4} encoding\pfill \main{a-647} + \subitem \texttt {T1} encoding\pfill \main{a-437} + \item \texttt {\PrintChar{092}o}\efill + \subitem default\pfill \main{a-201} + \subitem \texttt {OT1} encoding\pfill \main{a-362} + \subitem \texttt {OT4} encoding\pfill \main{a-655} + \subitem \texttt {T1} encoding\pfill \main{a-453} + \item \texttt {\PrintChar{092}o@lign}\pfill a-347, a-354, a-415, + a-423, a-637, a-644, b-28, b-35 + \item \texttt {\PrintChar{092}oalign}\pfill a-425, b-37 + \item \texttt {\PrintChar{092}OE}\efill + \subitem default\pfill \main{a-193} + \subitem \texttt {OT1} encoding\pfill \main{a-356} + \subitem \texttt {OT4} encoding\pfill \main{a-646} + \subitem \texttt {T1} encoding\pfill \main{a-436} + \item \texttt {\PrintChar{092}oe}\efill + \subitem default\pfill \main{a-200} + \subitem \texttt {OT1} encoding\pfill \main{a-361} + \subitem \texttt {OT4} encoding\pfill \main{a-656} + \subitem \texttt {T1} encoding\pfill \main{a-452} + \item \texttt {\PrintChar{092}@onlypreamble}\pfill a-18, a-19, + a-61, a-62, a-66, a-89, a-109, a-139, a-140, a-154 + \item \texttt {\PrintChar{092}ooalign}\pfill a-351, a-419, a-608, + a-641, a-708, a-711, a-757, b-32 + + \indexspace +{\bfseries\hfil P\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}P}\pfill a-254 + \item \texttt {\PrintChar{092}PackageError}\pfill a-305 + \item \texttt {\PrintChar{092}patterns}\pfill \main{a-155} + \item \texttt {\PrintChar{092}@@patterns}\pfill \main{a-155} + \item \texttt {\PrintChar{092}pickup@font}\pfill a-131 + \item \texttt {\PrintChar{092}pounds}\pfill a-262 + \item \texttt {\PrintChar{092}ProcessOptions}\pfill a-325 + \item \texttt {\PrintChar{092}protect}\pfill a-21, a-27, a-48, a-55, + a-159, a-167 + \item \texttt {\PrintChar{092}providecommand}\pfill a-6 + \item \texttt {\PrintChar{092}ProvidesFile}\pfill b-3--b-6 + \item \texttt {\PrintChar{092}ProvideTextCommand}\pfill \usage{1}, + \main{a-3}, a-60 + \item \texttt {\PrintChar{092}ProvideTextCommandDefault}\pfill + \usage{3}, \main{a-57} + + \indexspace +{\bfseries\hfil Q\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}quotedblbase}\efill + \subitem \texttt {OT4} encoding\pfill \main{a-657} + \subitem \texttt {T1} encoding\pfill \main{a-454} + \subitem \texttt {T2A} encoding\pfill \main{b-67} + \subitem \texttt {T2B} encoding\pfill \main{b-67} + \subitem \texttt {T2C} encoding\pfill \main{b-67} + \subitem \texttt {X2} encoding\pfill \main{b-67} + \item \texttt {\PrintChar{092}quotesinglbase}\efill + \subitem \texttt {T1} encoding\pfill \main{a-455} + + \indexspace +{\bfseries\hfil R\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}r}\efill + \subitem default\pfill \main{a-186} + \subitem \texttt {OT1} encoding\pfill \main{a-345} + \subsubitem \texttt {A} composite\pfill \main{a-383} + \subitem \texttt {OT4} encoding\pfill \main{a-633} + \subsubitem \texttt {A} composite\pfill \main{a-669} + \subitem \texttt {T1} encoding\pfill \main{a-409} + \subsubitem \texttt {A} composite\pfill \main{a-542} + \subsubitem \texttt {a} composite\pfill \main{a-568} + \subsubitem \texttt {U} composite\pfill \main{a-505} + \subsubitem \texttt {u} composite\pfill \main{a-532} + \subitem \texttt {T2A} encoding\pfill \main{b-19} + \subitem \texttt {T2B} encoding\pfill \main{b-19} + \subitem \texttt {T2C} encoding\pfill \main{b-19} + \subitem \texttt {X2} encoding\pfill \main{b-19} + \item \texttt {\PrintChar{092}raise}\pfill a-382, a-385, a-609, + a-671, a-758 + \item \texttt {\PrintChar{092}rbrace}\pfill a-253 + \item \texttt {\PrintChar{092}@rc@ifdefinable}\pfill a-16 + \item \texttt {\PrintChar{092}reserved@a}\pfill a-75, a-77, a-85, + a-102, a-107 + \item \texttt {\PrintChar{092}reserved@b}\pfill a-78, a-85 + \item \texttt {\PrintChar{092}reserved@f}\pfill a-301--a-304, a-306, + a-313 + \item \texttt {\PrintChar{092}rlap}\pfill a-382, a-385, a-671 + + \indexspace +{\bfseries\hfil S\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}S}\pfill a-255 + \item \texttt {\PrintChar{092}scshape}\pfill a-246 + \item \texttt {\PrintChar{092}@secondoftwo}\pfill a-95 + \item \texttt {\PrintChar{092}selectfont}\pfill a-326, a-397, a-683 + \item \texttt {\PrintChar{092}sh@ft}\pfill a-347, a-354, a-415, + a-423, a-637, a-644, b-28, b-35 + \item \texttt {\PrintChar{092}slshape}\pfill a-388, a-674 + \item \texttt {\PrintChar{092}spacefactor}\pfill a-70, a-71 + \item \texttt {\PrintChar{092}SS}\efill + \subitem default\pfill \main{a-248} + \subitem \texttt {T1} encoding\pfill \main{a-438} + \item \texttt {\PrintChar{092}ss}\efill + \subitem default\pfill \main{a-202} + \subitem \texttt {OT1} encoding\pfill \main{a-363} + \subitem \texttt {OT4} encoding\pfill \main{a-658} + \subitem \texttt {T1} encoding\pfill \main{a-456} + \item \texttt {\PrintChar{092}@strip@args}\pfill \main{a-74} + \item \texttt {\PrintChar{092}symbol}\pfill a-122 + + \indexspace +{\bfseries\hfil T\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}t}\efill + \subitem default\pfill \main{a-229}, \main{a-858} + \subitem \texttt {OML} encoding\pfill \main{a-618} + \subitem \texttt {TS1} encoding\pfill \main{a-723} + \item \texttt {\PrintChar{092}@tabacckludge}\pfill a-173, a-175 + \item \texttt {\PrintChar{092}@tempboxa}\pfill a-69 + \item \texttt {\PrintChar{092}@text@composite}\pfill \main{a-74} + \item \texttt {\PrintChar{092}@text@composite@x}\pfill \main{a-74} + \item \texttt {\PrintChar{092}textacutedbl}\efill + \subitem default\pfill \main{a-908} + \subitem \texttt {TS1} encoding\pfill \main{a-778} + \item \texttt {\PrintChar{092}textascendercompwordmark}\efill + \subitem default\pfill \main{a-863} + \subitem \texttt {TS1} encoding\pfill \main{a-728} + \item \texttt {\PrintChar{092}textasciiacute}\efill + \subitem default\pfill \main{a-957} + \subitem \texttt {TS1} encoding\pfill \main{a-828} + \item \texttt {\PrintChar{092}textasciibreve}\efill + \subitem default\pfill \main{a-905} + \subitem \texttt {TS1} encoding\pfill \main{a-776} + \item \texttt {\PrintChar{092}textasciicaron}\efill + \subitem default\pfill \main{a-906} + \subitem \texttt {TS1} encoding\pfill \main{a-777} + \item \texttt {\PrintChar{092}textasciicircum}\efill + \subitem default\pfill \main{a-233} + \subitem \texttt {T1} encoding\pfill \main{a-457} + \subitem \texttt {T2A} encoding\pfill \main{b-53} + \subitem \texttt {T2B} encoding\pfill \main{b-53} + \subitem \texttt {T2C} encoding\pfill \main{b-53} + \subitem \texttt {X2} encoding\pfill \main{b-53} + \item \texttt {\PrintChar{092}textasciidieresis}\efill + \subitem default\pfill \main{a-945} + \subitem \texttt {TS1} encoding\pfill \main{a-816} + \item \texttt {\PrintChar{092}textasciigrave}\efill + \subitem default\pfill \main{a-896} + \subitem \texttt {TS1} encoding\pfill \main{a-767} + \item \texttt {\PrintChar{092}textasciimacron}\efill + \subitem default\pfill \main{a-952} + \subitem \texttt {TS1} encoding\pfill \main{a-823} + \item \texttt {\PrintChar{092}textasciitilde}\efill + \subitem default\pfill \main{a-234} + \subitem \texttt {T1} encoding\pfill \main{a-458} + \subitem \texttt {T2A} encoding\pfill \main{b-58} + \subitem \texttt {T2B} encoding\pfill \main{b-58} + \subitem \texttt {T2C} encoding\pfill \main{b-58} + \subitem \texttt {X2} encoding\pfill \main{b-58} + \item \texttt {\PrintChar{092}textasteriskcentered}\efill + \subitem default\pfill \main{a-215}, \main{a-873} + \subitem \texttt {OMS} encoding\pfill \main{a-596} + \subitem \texttt {TS1} encoding\pfill \main{a-738} + \item \texttt {\PrintChar{092}textbackslash}\efill + \subitem default\pfill \main{a-216} + \subitem \texttt {OMS} encoding\pfill \main{a-597} + \subitem \texttt {T1} encoding\pfill \main{a-459} + \subitem \texttt {T2A} encoding\pfill \main{b-52} + \subitem \texttt {T2B} encoding\pfill \main{b-52} + \subitem \texttt {T2C} encoding\pfill \main{b-52} + \subitem \texttt {X2} encoding\pfill \main{b-52} + \item \texttt {\PrintChar{092}textbaht}\efill + \subitem default\pfill \main{a-931} + \subitem \texttt {TS1} encoding\pfill \main{a-802} + \item \texttt {\PrintChar{092}textbar}\efill + \subitem default\pfill \main{a-217} + \subitem \texttt {OMS} encoding\pfill \main{a-598} + \subitem \texttt {T1} encoding\pfill \main{a-460} + \subitem \texttt {T2A} encoding\pfill \main{b-56} + \subitem \texttt {T2B} encoding\pfill \main{b-56} + \subitem \texttt {T2C} encoding\pfill \main{b-56} + \subitem \texttt {X2} encoding\pfill \main{b-56} + \item \texttt {\PrintChar{092}textbardbl}\efill + \subitem default\pfill \main{a-911} + \subitem \texttt {TS1} encoding\pfill \main{a-782} + \item \texttt {\PrintChar{092}textbigcircle}\efill + \subitem default\pfill \main{a-890} + \subitem \texttt {TS1} encoding\pfill \main{a-755} + \item \texttt {\PrintChar{092}textblank}\efill + \subitem default\pfill \main{a-870} + \subitem \texttt {TS1} encoding\pfill \main{a-735} + \item \texttt {\PrintChar{092}textborn}\efill + \subitem default\pfill \main{a-897} + \subitem \texttt {TS1} encoding\pfill \main{a-768} + \item \texttt {\PrintChar{092}textbraceleft}\pfill a-252 + \subitem default\pfill \main{a-218} + \subitem \texttt {OMS} encoding\pfill \main{a-599} + \subitem \texttt {T1} encoding\pfill \main{a-461} + \subitem \texttt {T2A} encoding\pfill \main{b-55} + \subitem \texttt {T2B} encoding\pfill \main{b-55} + \subitem \texttt {T2C} encoding\pfill \main{b-55} + \subitem \texttt {X2} encoding\pfill \main{b-55} + \item \texttt {\PrintChar{092}textbraceright}\pfill a-253 + \subitem default\pfill \main{a-219} + \subitem \texttt {OMS} encoding\pfill \main{a-600} + \subitem \texttt {T1} encoding\pfill \main{a-462} + \subitem \texttt {T2A} encoding\pfill \main{b-57} + \subitem \texttt {T2B} encoding\pfill \main{b-57} + \subitem \texttt {T2C} encoding\pfill \main{b-57} + \subitem \texttt {X2} encoding\pfill \main{b-57} + \item \texttt {\PrintChar{092}textbrokenbar}\efill + \subitem default\pfill \main{a-943} + \subitem \texttt {TS1} encoding\pfill \main{a-814} + \item \texttt {\PrintChar{092}textbullet}\efill + \subitem default\pfill \main{a-220}, \main{a-913} + \subitem \texttt {OMS} encoding\pfill \main{a-601} + \subitem \texttt {TS1} encoding\pfill \main{a-784} + \item \texttt {\PrintChar{092}textcapitalcompwordmark}\efill + \subitem default\pfill \main{a-862} + \subitem \texttt {TS1} encoding\pfill \main{a-727} + \item \texttt {\PrintChar{092}textcelsius}\efill + \subitem default\pfill \main{a-914} + \subitem \texttt {TS1} encoding\pfill \main{a-785} + \item \texttt {\PrintChar{092}textcent}\efill + \subitem default\pfill \main{a-939} + \subitem \texttt {TS1} encoding\pfill \main{a-810} + \item \texttt {\PrintChar{092}textcentoldstyle}\efill + \subitem default\pfill \main{a-916} + \subitem \texttt {TS1} encoding\pfill \main{a-787} + \item \texttt {\PrintChar{092}textcircled}\pfill a-230, a-246 + \subitem default\pfill \main{a-226}, \main{a-843} + \subitem \texttt {OMS} encoding\pfill \main{a-607} + \subitem \texttt {TS1} encoding\pfill \main{a-756} + \item \texttt {\PrintChar{092}textcircledP}\efill + \subitem default\pfill \main{a-950} + \subitem \texttt {TS1} encoding\pfill \main{a-821} + \item \texttt {\PrintChar{092}textcolonmonetary}\efill + \subitem default\pfill \main{a-918} + \subitem \texttt {TS1} encoding\pfill \main{a-789} + \item \texttt {\PrintChar{092}textcompwordmark}\efill + \subitem default\pfill \main{a-235} + \subitem \texttt {T1} encoding\pfill \main{a-463} + \subitem \texttt {T2A} encoding\pfill \main{b-45} + \subitem \texttt {T2B} encoding\pfill \main{b-45} + \subitem \texttt {T2C} encoding\pfill \main{b-45} + \subitem \texttt {X2} encoding\pfill \main{b-45} + \item \texttt {\PrintChar{092}textcopyleft}\efill + \subitem default\pfill \main{a-948} + \subitem \texttt {TS1} encoding\pfill \main{a-819} + \item \texttt {\PrintChar{092}textcopyright}\pfill a-261 + \subitem default\pfill \main{a-230}, \main{a-946} + \subitem \texttt {TS1} encoding\pfill \main{a-817} + \item \texttt {\PrintChar{092}textcurrency}\efill + \subitem default\pfill \main{a-941} + \subitem \texttt {T2A} encoding\pfill \main{b-60} + \subitem \texttt {T2B} encoding\pfill \main{b-60} + \subitem \texttt {T2C} encoding\pfill \main{b-60} + \subitem \texttt {TS1} encoding\pfill \main{a-812} + \subitem \texttt {X2} encoding\pfill \main{b-60} + \item \texttt {\PrintChar{092}textdagger}\pfill a-256 + \subitem default\pfill \main{a-222}, \main{a-909} + \subitem \texttt {OMS} encoding\pfill \main{a-603} + \subitem \texttt {TS1} encoding\pfill \main{a-780} + \item \texttt {\PrintChar{092}textdaggerdbl}\pfill a-257 + \subitem default\pfill \main{a-221}, \main{a-910} + \subitem \texttt {OMS} encoding\pfill \main{a-602} + \subitem \texttt {TS1} encoding\pfill \main{a-781} + \item \texttt {\PrintChar{092}textdblhyphen}\efill + \subitem default\pfill \main{a-874} + \subitem \texttt {TS1} encoding\pfill \main{a-739} + \item \texttt {\PrintChar{092}textdblhyphenchar}\efill + \subitem default\pfill \main{a-904} + \subitem \texttt {TS1} encoding\pfill \main{a-775} + \item \texttt {\PrintChar{092}textdegree}\efill + \subitem default\pfill \main{a-953} + \subitem \texttt {TS1} encoding\pfill \main{a-824} + \item \texttt {\PrintChar{092}textdied}\efill + \subitem default\pfill \main{a-899} + \subitem \texttt {TS1} encoding\pfill \main{a-770} + \item \texttt {\PrintChar{092}textdiscount}\efill + \subitem default\pfill \main{a-933} + \subitem \texttt {TS1} encoding\pfill \main{a-804} + \item \texttt {\PrintChar{092}textdiv}\efill + \subitem default\pfill \main{a-970} + \subitem \texttt {TS1} encoding\pfill \main{a-841} + \item \texttt {\PrintChar{092}textdivorced}\efill + \subitem default\pfill \main{a-898} + \subitem \texttt {TS1} encoding\pfill \main{a-769} + \item \texttt {\PrintChar{092}textdollar}\pfill a-251, a-973, a-975 + \subitem default\pfill \main{a-203}, \main{a-871} + \subitem \texttt {OT1} encoding\pfill \main{a-386} + \subitem \texttt {OT4} encoding\pfill \main{a-672} + \subitem \texttt {T1} encoding\pfill \main{a-464} + \subitem \texttt {T2A} encoding\pfill \main{b-47} + \subitem \texttt {T2B} encoding\pfill \main{b-47} + \subitem \texttt {T2C} encoding\pfill \main{b-47} + \subitem \texttt {TS1} encoding\pfill \main{a-736} + \subitem \texttt {X2} encoding\pfill \main{b-47} + \item \texttt {\PrintChar{092}textdollaroldstyle}\efill + \subitem default\pfill \main{a-915} + \subitem \texttt {TS1} encoding\pfill \main{a-786} + \item \texttt {\PrintChar{092}textdong}\efill + \subitem default\pfill \main{a-927} + \subitem \texttt {TS1} encoding\pfill \main{a-798} + \item \texttt {\PrintChar{092}textdownarrow}\efill + \subitem default\pfill \main{a-895} + \subitem \texttt {TS1} encoding\pfill \main{a-766} + \item \texttt {\PrintChar{092}texteightoldstyle}\efill + \subitem default\pfill \main{a-884} + \subitem \texttt {TS1} encoding\pfill \main{a-749} + \item \texttt {\PrintChar{092}textellipsis}\pfill a-265 + \subitem default\pfill \main{a-242} + \item \texttt {\PrintChar{092}textemdash}\efill + \subitem default\pfill \main{a-204} + \subitem \texttt {OT1} encoding\pfill \main{a-364} + \subitem \texttt {OT4} encoding\pfill \main{a-659} + \subitem \texttt {T1} encoding\pfill \main{a-465} + \subitem \texttt {T2A} encoding\pfill \main{b-44} + \subitem \texttt {T2B} encoding\pfill \main{b-44} + \subitem \texttt {T2C} encoding\pfill \main{b-44} + \subitem \texttt {X2} encoding\pfill \main{b-44} + \item \texttt {\PrintChar{092}textendash}\efill + \subitem default\pfill \main{a-205} + \subitem \texttt {OT1} encoding\pfill \main{a-365} + \subitem \texttt {OT4} encoding\pfill \main{a-660} + \subitem \texttt {T1} encoding\pfill \main{a-466} + \subitem \texttt {T2A} encoding\pfill \main{b-42} + \subitem \texttt {T2B} encoding\pfill \main{b-42} + \subitem \texttt {T2C} encoding\pfill \main{b-42} + \subitem \texttt {X2} encoding\pfill \main{b-42} + \item \texttt {\PrintChar{092}textestimated}\efill + \subitem default\pfill \main{a-934} + \subitem \texttt {TS1} encoding\pfill \main{a-805} + \item \texttt {\PrintChar{092}texteuro}\efill + \subitem default\pfill \main{a-968} + \subitem \texttt {TS1} encoding\pfill \main{a-839} + \item \texttt {\PrintChar{092}textexclamdown}\efill + \subitem default\pfill \main{a-206} + \subitem \texttt {OT1} encoding\pfill \main{a-366} + \subitem \texttt {OT4} encoding\pfill \main{a-661} + \subitem \texttt {T1} encoding\pfill \main{a-467} + \item \texttt {\PrintChar{092}textfiveoldstyle}\efill + \subitem default\pfill \main{a-881} + \subitem \texttt {TS1} encoding\pfill \main{a-746} + \item \texttt {\PrintChar{092}textflorin}\efill + \subitem default\pfill \main{a-917} + \subitem \texttt {TS1} encoding\pfill \main{a-788} + \item \texttt {\PrintChar{092}textfouroldstyle}\efill + \subitem default\pfill \main{a-880} + \subitem \texttt {TS1} encoding\pfill \main{a-745} + \item \texttt {\PrintChar{092}textfractionsolidus}\efill + \subitem default\pfill \main{a-875} + \subitem \texttt {TS1} encoding\pfill \main{a-740} + \item \texttt {\PrintChar{092}textgravedbl}\efill + \subitem default\pfill \main{a-907} + \subitem \texttt {TS1} encoding\pfill \main{a-779} + \item \texttt {\PrintChar{092}textgreater}\efill + \subitem default\pfill \main{a-228} + \subitem \texttt {OML} encoding\pfill \main{a-617} + \subitem \texttt {T1} encoding\pfill \main{a-468} + \subitem \texttt {T2A} encoding\pfill \main{b-49} + \subitem \texttt {T2B} encoding\pfill \main{b-49} + \subitem \texttt {T2C} encoding\pfill \main{b-49} + \subitem \texttt {X2} encoding\pfill \main{b-49} + \item \texttt {\PrintChar{092}textguarani}\efill + \subitem default\pfill \main{a-921} + \subitem \texttt {TS1} encoding\pfill \main{a-792} + \item \texttt {\PrintChar{092}texthyphen}\pfill a-208, a-368, a-470, + a-663, b-51 + \item \texttt {\PrintChar{092}texthyphenchar}\pfill a-207, a-367, + a-469, a-662, b-50 + \item \texttt {\PrintChar{092}textinterrobang}\efill + \subitem default\pfill \main{a-925} + \subitem \texttt {TS1} encoding\pfill \main{a-796} + \item \texttt {\PrintChar{092}textinterrobangdown}\efill + \subitem default\pfill \main{a-926} + \subitem \texttt {TS1} encoding\pfill \main{a-797} + \item \texttt {\PrintChar{092}textlangle}\efill + \subitem default\pfill \main{a-886} + \subitem \texttt {TS1} encoding\pfill \main{a-751} + \item \texttt {\PrintChar{092}textlbrackdbl}\efill + \subitem default\pfill \main{a-892} + \subitem \texttt {TS1} encoding\pfill \main{a-763} + \item \texttt {\PrintChar{092}textleaf}\efill + \subitem default\pfill \main{a-900} + \subitem \texttt {TS1} encoding\pfill \main{a-771} + \item \texttt {\PrintChar{092}textleftarrow}\efill + \subitem default\pfill \main{a-868} + \subitem \texttt {TS1} encoding\pfill \main{a-733} + \item \texttt {\PrintChar{092}textless}\efill + \subitem default\pfill \main{a-227} + \subitem \texttt {OML} encoding\pfill \main{a-616} + \subitem \texttt {T1} encoding\pfill \main{a-471} + \subitem \texttt {T2A} encoding\pfill \main{b-48} + \subitem \texttt {T2B} encoding\pfill \main{b-48} + \subitem \texttt {T2C} encoding\pfill \main{b-48} + \subitem \texttt {X2} encoding\pfill \main{b-48} + \item \texttt {\PrintChar{092}textlira}\efill + \subitem default\pfill \main{a-923} + \subitem \texttt {TS1} encoding\pfill \main{a-794} + \item \texttt {\PrintChar{092}textlnot}\efill + \subitem default\pfill \main{a-949} + \subitem \texttt {TS1} encoding\pfill \main{a-820} + \item \texttt {\PrintChar{092}textlquill}\efill + \subitem default\pfill \main{a-937} + \subitem \texttt {TS1} encoding\pfill \main{a-808} + \item \texttt {\PrintChar{092}textmarried}\efill + \subitem default\pfill \main{a-901} + \subitem \texttt {TS1} encoding\pfill \main{a-772} + \item \texttt {\PrintChar{092}textmho}\efill + \subitem default\pfill \main{a-889} + \subitem \texttt {TS1} encoding\pfill \main{a-754} + \item \texttt {\PrintChar{092}textminus}\efill + \subitem default\pfill \main{a-887} + \subitem \texttt {TS1} encoding\pfill \main{a-752} + \item \texttt {\PrintChar{092}textmu}\efill + \subitem default\pfill \main{a-958} + \subitem \texttt {TS1} encoding\pfill \main{a-829} + \item \texttt {\PrintChar{092}textmusicalnote}\efill + \subitem default\pfill \main{a-902} + \subitem \texttt {TS1} encoding\pfill \main{a-773} + \item \texttt {\PrintChar{092}textnaira}\efill + \subitem default\pfill \main{a-920} + \subitem \texttt {TS1} encoding\pfill \main{a-791} + \item \texttt {\PrintChar{092}textnineoldstyle}\efill + \subitem default\pfill \main{a-885} + \subitem \texttt {TS1} encoding\pfill \main{a-750} + \item \texttt {\PrintChar{092}textnumero}\efill + \subitem default\pfill \main{a-932} + \subitem \texttt {T2A} encoding\pfill \main{b-59} + \subitem \texttt {T2B} encoding\pfill \main{b-59} + \subitem \texttt {T2C} encoding\pfill \main{b-59} + \subitem \texttt {TS1} encoding\pfill \main{a-803} + \subitem \texttt {X2} encoding\pfill \main{b-59} + \item \texttt {\PrintChar{092}textohm}\efill + \subitem default\pfill \main{a-891} + \subitem \texttt {TS1} encoding\pfill \main{a-762} + \item \texttt {\PrintChar{092}textonehalf}\efill + \subitem default\pfill \main{a-966} + \subitem \texttt {TS1} encoding\pfill \main{a-837} + \item \texttt {\PrintChar{092}textoneoldstyle}\efill + \subitem default\pfill \main{a-877} + \subitem \texttt {TS1} encoding\pfill \main{a-742} + \item \texttt {\PrintChar{092}textonequarter}\efill + \subitem default\pfill \main{a-965} + \subitem \texttt {TS1} encoding\pfill \main{a-836} + \item \texttt {\PrintChar{092}textonesuperior}\efill + \subitem default\pfill \main{a-962} + \subitem \texttt {TS1} encoding\pfill \main{a-833} + \item \texttt {\PrintChar{092}textopenbullet}\efill + \subitem default\pfill \main{a-935} + \subitem \texttt {TS1} encoding\pfill \main{a-806} + \item \texttt {\PrintChar{092}textordfeminine}\efill + \subitem default\pfill \main{a-249}, \main{a-947} + \subitem \texttt {TS1} encoding\pfill \main{a-818} + \item \texttt {\PrintChar{092}textordmasculine}\efill + \subitem default\pfill \main{a-250}, \main{a-963} + \subitem \texttt {TS1} encoding\pfill \main{a-834} + \item \texttt {\PrintChar{092}textparagraph}\pfill a-254 + \subitem default\pfill \main{a-223}, \main{a-959} + \subitem \texttt {OMS} encoding\pfill \main{a-604} + \subitem \texttt {TS1} encoding\pfill \main{a-830} + \item \texttt {\PrintChar{092}textperiodcentered}\efill + \subitem default\pfill \main{a-224}, \main{a-960} + \subitem \texttt {OMS} encoding\pfill \main{a-605} + \subitem \texttt {TS1} encoding\pfill \main{a-831} + \item \texttt {\PrintChar{092}textpertenthousand}\pfill a-977 + \subitem default\pfill \main{a-929} + \subitem \texttt {T1} encoding\pfill \main{a-428} + \subitem \texttt {T2A} encoding\pfill \main{b-40} + \subitem \texttt {T2B} encoding\pfill \main{b-40} + \subitem \texttt {T2C} encoding\pfill \main{b-40} + \subitem \texttt {TS1} encoding\pfill \main{a-800} + \subitem \texttt {X2} encoding\pfill \main{b-40} + \item \texttt {\PrintChar{092}textperthousand}\pfill a-976 + \subitem default\pfill \main{a-912} + \subitem \texttt {T1} encoding\pfill \main{a-426} + \subitem \texttt {T2A} encoding\pfill \main{b-38} + \subitem \texttt {T2B} encoding\pfill \main{b-38} + \subitem \texttt {T2C} encoding\pfill \main{b-38} + \subitem \texttt {TS1} encoding\pfill \main{a-783} + \subitem \texttt {X2} encoding\pfill \main{b-38} + \item \texttt {\PrintChar{092}textpeso}\efill + \subitem default\pfill \main{a-922} + \subitem \texttt {TS1} encoding\pfill \main{a-793} + \item \texttt {\PrintChar{092}textpilcrow}\efill + \subitem default\pfill \main{a-930} + \subitem \texttt {TS1} encoding\pfill \main{a-801} + \item \texttt {\PrintChar{092}textpm}\efill + \subitem default\pfill \main{a-954} + \subitem \texttt {TS1} encoding\pfill \main{a-825} + \item \texttt {\PrintChar{092}textquestiondown}\efill + \subitem default\pfill \main{a-209} + \subitem \texttt {OT1} encoding\pfill \main{a-369} + \subitem \texttt {OT4} encoding\pfill \main{a-664} + \subitem \texttt {T1} encoding\pfill \main{a-472} + \item \texttt {\PrintChar{092}textquotedbl}\efill + \subitem \texttt {T1} encoding\pfill \main{a-475} + \subitem \texttt {T2A} encoding\pfill \main{b-62} + \subitem \texttt {T2B} encoding\pfill \main{b-62} + \subitem \texttt {T2C} encoding\pfill \main{b-62} + \subitem \texttt {X2} encoding\pfill \main{b-62} + \item \texttt {\PrintChar{092}textquotedblleft}\efill + \subitem default\pfill \main{a-210} + \subitem \texttt {OT1} encoding\pfill \main{a-370} + \subitem \texttt {OT4} encoding\pfill \main{a-665} + \subitem \texttt {T1} encoding\pfill \main{a-473} + \subitem \texttt {T2A} encoding\pfill \main{b-65} + \subitem \texttt {T2B} encoding\pfill \main{b-65} + \subitem \texttt {T2C} encoding\pfill \main{b-65} + \subitem \texttt {X2} encoding\pfill \main{b-65} + \item \texttt {\PrintChar{092}textquotedblright}\efill + \subitem default\pfill \main{a-211} + \subitem \texttt {OT1} encoding\pfill \main{a-371} + \subitem \texttt {OT4} encoding\pfill \main{a-666} + \subitem \texttt {T1} encoding\pfill \main{a-474} + \subitem \texttt {T2A} encoding\pfill \main{b-66} + \subitem \texttt {T2B} encoding\pfill \main{b-66} + \subitem \texttt {T2C} encoding\pfill \main{b-66} + \subitem \texttt {X2} encoding\pfill \main{b-66} + \item \texttt {\PrintChar{092}textquoteleft}\efill + \subitem default\pfill \main{a-212} + \subitem \texttt {OT1} encoding\pfill \main{a-372} + \subitem \texttt {OT4} encoding\pfill \main{a-667} + \subitem \texttt {T1} encoding\pfill \main{a-476} + \subitem \texttt {T2A} encoding\pfill \main{b-63} + \subitem \texttt {T2B} encoding\pfill \main{b-63} + \subitem \texttt {T2C} encoding\pfill \main{b-63} + \subitem \texttt {X2} encoding\pfill \main{b-63} + \item \texttt {\PrintChar{092}textquoteright}\efill + \subitem default\pfill \main{a-213} + \subitem \texttt {OT1} encoding\pfill \main{a-373} + \subitem \texttt {OT4} encoding\pfill \main{a-668} + \subitem \texttt {T1} encoding\pfill \main{a-477} + \subitem \texttt {T2A} encoding\pfill \main{b-64} + \subitem \texttt {T2B} encoding\pfill \main{b-64} + \subitem \texttt {T2C} encoding\pfill \main{b-64} + \subitem \texttt {X2} encoding\pfill \main{b-64} + \item \texttt {\PrintChar{092}textquotesingle}\efill + \subitem default\pfill \main{a-872} + \subitem \texttt {TS1} encoding\pfill \main{a-737} + \item \texttt {\PrintChar{092}textquotestraightbase}\efill + \subitem default\pfill \main{a-864} + \subitem \texttt {TS1} encoding\pfill \main{a-729} + \item \texttt {\PrintChar{092}textquotestraightdblbase}\efill + \subitem default\pfill \main{a-865} + \subitem \texttt {TS1} encoding\pfill \main{a-730} + \item \texttt {\PrintChar{092}textrangle}\efill + \subitem default\pfill \main{a-888} + \subitem \texttt {TS1} encoding\pfill \main{a-753} + \item \texttt {\PrintChar{092}textrbrackdbl}\efill + \subitem default\pfill \main{a-893} + \subitem \texttt {TS1} encoding\pfill \main{a-764} + \item \texttt {\PrintChar{092}textrecipe}\efill + \subitem default\pfill \main{a-924} + \subitem \texttt {TS1} encoding\pfill \main{a-795} + \item \texttt {\PrintChar{092}textreferencemark}\efill + \subitem default\pfill \main{a-961} + \subitem \texttt {TS1} encoding\pfill \main{a-832} + \item \texttt {\PrintChar{092}textregistered}\efill + \subitem default\pfill \main{a-246}, \main{a-951} + \subitem \texttt {TS1} encoding\pfill \main{a-822} + \item \texttt {\PrintChar{092}textrightarrow}\efill + \subitem default\pfill \main{a-869} + \subitem \texttt {TS1} encoding\pfill \main{a-734} + \item \texttt {\PrintChar{092}textrquill}\efill + \subitem default\pfill \main{a-938} + \subitem \texttt {TS1} encoding\pfill \main{a-809} + \item \texttt {\PrintChar{092}textsection}\pfill a-255 + \subitem default\pfill \main{a-225}, \main{a-944} + \subitem \texttt {OMS} encoding\pfill \main{a-606} + \subitem \texttt {T1} encoding\pfill \main{a-478} + \subitem \texttt {T2A} encoding\pfill \main{b-61} + \subitem \texttt {T2B} encoding\pfill \main{b-61} + \subitem \texttt {T2C} encoding\pfill \main{b-61} + \subitem \texttt {TS1} encoding\pfill \main{a-815} + \subitem \texttt {X2} encoding\pfill \main{b-61} + \item \texttt {\PrintChar{092}textservicemark}\efill + \subitem default\pfill \main{a-936} + \subitem \texttt {TS1} encoding\pfill \main{a-807} + \item \texttt {\PrintChar{092}textsevenoldstyle}\efill + \subitem default\pfill \main{a-883} + \subitem \texttt {TS1} encoding\pfill \main{a-748} + \item \texttt {\PrintChar{092}textsixoldstyle}\efill + \subitem default\pfill \main{a-882} + \subitem \texttt {TS1} encoding\pfill \main{a-747} + \item \texttt {\PrintChar{092}textsterling}\pfill a-263, a-972, + a-974 + \subitem default\pfill \main{a-214}, \main{a-940} + \subitem \texttt {OT1} encoding\pfill \main{a-393} + \subitem \texttt {OT4} encoding\pfill \main{a-679} + \subitem \texttt {T1} encoding\pfill \main{a-479} + \subitem \texttt {TS1} encoding\pfill \main{a-811} + \item \texttt {\PrintChar{092}textsuperscript}\pfill a-247, + a-249, a-250 + \item \texttt {\PrintChar{092}textsurd}\efill + \subitem default\pfill \main{a-964} + \subitem \texttt {TS1} encoding\pfill \main{a-835} + \item \texttt {\PrintChar{092}TextSymbolUnavailable}\pfill + \main{a-3}, a-635 + \item \texttt {\PrintChar{092}textthreeoldstyle}\efill + \subitem default\pfill \main{a-879} + \subitem \texttt {TS1} encoding\pfill \main{a-744} + \item \texttt {\PrintChar{092}textthreequarters}\efill + \subitem default\pfill \main{a-967} + \subitem \texttt {TS1} encoding\pfill \main{a-838} + \item \texttt {\PrintChar{092}textthreequartersemdash}\efill + \subitem default\pfill \main{a-867} + \subitem \texttt {TS1} encoding\pfill \main{a-732} + \item \texttt {\PrintChar{092}textthreesuperior}\efill + \subitem default\pfill \main{a-956} + \subitem \texttt {TS1} encoding\pfill \main{a-827} + \begin{figure*}[tp] + A verbatim extract from the index (without \textsf{docidx2e}): + + \let\item=\listenvironmentitem + \expandafter\def \expandafter\MacroFont \expandafter{% + \MacroFont\footnotesize} +\begin{verbatim} + \item \texttt {\PrintChar{092}U}\efill + \subitem \texttt {T2A} encoding\pfill \main{b-26} + \subsubitem \texttt {\PrintChar{092}CYRI} composite\pfill \main{b-443} + \subsubitem \texttt {\PrintChar{092}cyri} composite\pfill \main{b-444} + \subsubitem \texttt {\PrintChar{092}CYRU} composite\pfill \main{b-453} + \subsubitem \texttt {\PrintChar{092}cyru} composite\pfill \main{b-455} + \subitem \texttt {T2B} encoding\pfill \main{b-26} + \subsubitem \texttt {\PrintChar{092}CYRI} composite\pfill \main{b-443} + \subsubitem \texttt {\PrintChar{092}cyri} composite\pfill \main{b-444} + \subsubitem \texttt {\PrintChar{092}CYRU} composite\pfill \main{b-453} + \subsubitem \texttt {\PrintChar{092}cyru} composite\pfill \main{b-455} + \subitem \texttt {T2C} encoding\pfill \main{b-26} + \subsubitem \texttt {\PrintChar{092}CYRI} composite\pfill \main{b-443} + \subsubitem \texttt {\PrintChar{092}cyri} composite\pfill \main{b-444} + \subitem \texttt {X2} encoding\pfill \main{b-26} + \subsubitem \texttt {\PrintChar{092}CYRI} composite\pfill \main{b-443} + \subsubitem \texttt {\PrintChar{092}cyri} composite\pfill \main{b-444} + \subsubitem \texttt {\PrintChar{092}CYRU} composite\pfill \main{b-453} + \subsubitem \texttt {\PrintChar{092}cyru} composite\pfill \main{b-455} + \item \texttt {\PrintChar{092}u}\efill + \subitem default\pfill \main{a-187} + \subitem \texttt {OT1} encoding\pfill \main{a-343} + \subitem \texttt {OT4} encoding\pfill \main{a-631} + \subitem \texttt {T1} encoding\pfill \main{a-411} + \subsubitem \texttt {A} composite\pfill \main{a-484} + \subsubitem \texttt {a} composite\pfill \main{a-511} + \subsubitem \texttt {G} composite\pfill \main{a-491} + \subsubitem \texttt {g} composite\pfill \main{a-518} + \subitem \texttt {T2A} encoding\pfill \main{b-21} + \subitem \texttt {T2B} encoding\pfill \main{b-21} + \subitem \texttt {T2C} encoding\pfill \main{b-21} + \subitem \texttt {X2} encoding\pfill \main{b-21} + \item \texttt {\PrintChar{092}@uclclist}\pfill a-270, a-271, a-318 + \item \texttt {\PrintChar{092}UndeclareTextCommand}\pfill \usage{4}, + \main{a-141}, a-972--a-977 + \item \texttt {\PrintChar{092}@undefined}\pfill a-145, a-147 + \item \texttt {\PrintChar{092}update@uclc@with@cyrillic}\pfill a-269, + a-297, a-321, a-327 + \item \texttt {\PrintChar{092}upshape}\pfill a-390, a-609, a-676, a-758 + \item \texttt {\PrintChar{092}@use@text@encoding}\pfill \main{a-110} + \item \texttt {\PrintChar{092}UseTextAccent}\pfill \usage{3}, + \main{a-110}, a-138 + \item \texttt {\PrintChar{092}UseTextSymbol}\pfill \usage{2}, + \main{a-110}, a-136 +\end{verbatim} + \end{figure*} + \item \texttt {\PrintChar{092}texttildelow}\efill + \subitem default\pfill \main{a-903} + \subitem \texttt {TS1} encoding\pfill \main{a-774} + \item \texttt {\PrintChar{092}texttimes}\efill + \subitem default\pfill \main{a-969} + \subitem \texttt {TS1} encoding\pfill \main{a-840} + \item \texttt {\PrintChar{092}texttrademark}\efill + \subitem default\pfill \main{a-247}, \main{a-928} + \subitem \texttt {TS1} encoding\pfill \main{a-799} + \item \texttt {\PrintChar{092}texttwelveudash}\efill + \subitem default\pfill \main{a-866} + \subitem \texttt {TS1} encoding\pfill \main{a-731} + \item \texttt {\PrintChar{092}texttwooldstyle}\efill + \subitem default\pfill \main{a-878} + \subitem \texttt {TS1} encoding\pfill \main{a-743} + \item \texttt {\PrintChar{092}texttwosuperior}\efill + \subitem default\pfill \main{a-955} + \subitem \texttt {TS1} encoding\pfill \main{a-826} + \item \texttt {\PrintChar{092}textunderscore}\pfill a-259 + \subitem default\pfill \main{a-236} + \subitem \texttt {T1} encoding\pfill \main{a-480} + \subitem \texttt {T2A} encoding\pfill \main{b-54} + \subitem \texttt {T2B} encoding\pfill \main{b-54} + \subitem \texttt {T2C} encoding\pfill \main{b-54} + \subitem \texttt {X2} encoding\pfill \main{b-54} + \item \texttt {\PrintChar{092}textuparrow}\efill + \subitem default\pfill \main{a-894} + \subitem \texttt {TS1} encoding\pfill \main{a-765} + \item \texttt {\PrintChar{092}textvisiblespace}\efill + \subitem default\pfill \main{a-238} + \subitem \texttt {T1} encoding\pfill \main{a-481} + \subitem \texttt {T2A} encoding\pfill \main{b-46} + \subitem \texttt {T2B} encoding\pfill \main{b-46} + \subitem \texttt {T2C} encoding\pfill \main{b-46} + \subitem \texttt {X2} encoding\pfill \main{b-46} + \item \texttt {\PrintChar{092}textwon}\efill + \subitem default\pfill \main{a-919} + \subitem \texttt {TS1} encoding\pfill \main{a-790} + \item \texttt {\PrintChar{092}textyen}\efill + \subitem default\pfill \main{a-942} + \subitem \texttt {TS1} encoding\pfill \main{a-813} + \item \texttt {\PrintChar{092}textzerooldstyle}\efill + \subitem default\pfill \main{a-876} + \subitem \texttt {TS1} encoding\pfill \main{a-741} + \item \texttt {\PrintChar{092}TH}\efill + \subitem \texttt {T1} encoding\pfill \main{a-439} + \item \texttt {\PrintChar{092}th}\efill + \subitem \texttt {T1} encoding\pfill \main{a-482} + \item \texttt {\PrintChar{092}@thirdofthree}\pfill a-147 + \item \texttt {\PrintChar{092}@typeset@protect}\pfill a-21, a-27, + a-160, a-168 + + \indexspace +{\bfseries\hfil U\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}U}\efill + \subitem \texttt {T2A} encoding\pfill \main{b-26} + \subsubitem \texttt {\PrintChar{092}CYRI} composite\pfill + \main{b-443} + \subsubitem \texttt {\PrintChar{092}cyri} composite\pfill + \main{b-444} + \subsubitem \texttt {\PrintChar{092}CYRU} composite\pfill + \main{b-453} + \subsubitem \texttt {\PrintChar{092}cyru} composite\pfill + \main{b-455} + \subitem \texttt {T2B} encoding\pfill \main{b-26} + \subsubitem \texttt {\PrintChar{092}CYRI} composite\pfill + \main{b-443} + \subsubitem \texttt {\PrintChar{092}cyri} composite\pfill + \main{b-444} + \subsubitem \texttt {\PrintChar{092}CYRU} composite\pfill + \main{b-453} + \subsubitem \texttt {\PrintChar{092}cyru} composite\pfill + \main{b-455} + \subitem \texttt {T2C} encoding\pfill \main{b-26} + \subsubitem \texttt {\PrintChar{092}CYRI} composite\pfill + \main{b-443} + \subsubitem \texttt {\PrintChar{092}cyri} composite\pfill + \main{b-444} + \subitem \texttt {X2} encoding\pfill \main{b-26} + \subsubitem \texttt {\PrintChar{092}CYRI} composite\pfill + \main{b-443} + \subsubitem \texttt {\PrintChar{092}cyri} composite\pfill + \main{b-444} + \subsubitem \texttt {\PrintChar{092}CYRU} composite\pfill + \main{b-453} + \subsubitem \texttt {\PrintChar{092}cyru} composite\pfill + \main{b-455} + \item \texttt {\PrintChar{092}u}\efill + \subitem default\pfill \main{a-187} + \subitem \texttt {OT1} encoding\pfill \main{a-343} + \subitem \texttt {OT4} encoding\pfill \main{a-631} + \subitem \texttt {T1} encoding\pfill \main{a-411} + \subsubitem \texttt {A} composite\pfill \main{a-484} + \subsubitem \texttt {a} composite\pfill \main{a-511} + \subsubitem \texttt {G} composite\pfill \main{a-491} + \subsubitem \texttt {g} composite\pfill \main{a-518} + \subitem \texttt {T2A} encoding\pfill \main{b-21} + \subitem \texttt {T2B} encoding\pfill \main{b-21} + \subitem \texttt {T2C} encoding\pfill \main{b-21} + \subitem \texttt {X2} encoding\pfill \main{b-21} + \item \texttt {\PrintChar{092}@uclclist}\pfill a-270, a-271, a-318 + \item \texttt {\PrintChar{092}UndeclareTextCommand}\pfill \usage{4}, + \main{a-141}, a-972--a-977 + \item \texttt {\PrintChar{092}@undefined}\pfill a-145, a-147 + \item \texttt {\PrintChar{092}update@uclc@with@cyrillic}\pfill a-269, + a-297, a-321, a-327 + \item \texttt {\PrintChar{092}upshape}\pfill a-390, a-609, a-676, + a-758 + \item \texttt {\PrintChar{092}@use@text@encoding}\pfill \main{a-110} + \item \texttt {\PrintChar{092}UseTextAccent}\pfill \usage{3}, + \main{a-110}, a-138 + \item \texttt {\PrintChar{092}UseTextSymbol}\pfill \usage{2}, + \main{a-110}, a-136 + + \indexspace +{\bfseries\hfil V\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}v}\efill + \subitem default\pfill \main{a-188} + \subitem \texttt {OT1} encoding\pfill \main{a-344} + \subitem \texttt {OT4} encoding\pfill \main{a-632} + \subitem \texttt {T1} encoding\pfill \main{a-410} + \subsubitem \texttt {C} composite\pfill \main{a-487} + \subsubitem \texttt {c} composite\pfill \main{a-514} + \subsubitem \texttt {D} composite\pfill \main{a-488} + \subsubitem \texttt {d} composite\pfill \main{a-515} + \subsubitem \texttt {E} composite\pfill \main{a-489} + \subsubitem \texttt {e} composite\pfill \main{a-516} + \subsubitem \texttt {L} composite\pfill \main{a-493} + \subsubitem \texttt {l} composite\pfill \main{a-520} + \subsubitem \texttt {N} composite\pfill \main{a-495} + \subsubitem \texttt {n} composite\pfill \main{a-522} + \subsubitem \texttt {R} composite\pfill \main{a-498} + \subsubitem \texttt {r} composite\pfill \main{a-525} + \subsubitem \texttt {S} composite\pfill \main{a-500} + \subsubitem \texttt {s} composite\pfill \main{a-527} + \subsubitem \texttt {T} composite\pfill \main{a-502} + \subsubitem \texttt {t} composite\pfill \main{a-529} + \subsubitem \texttt {Z} composite\pfill \main{a-508} + \subsubitem \texttt {z} composite\pfill \main{a-535} + \subitem \texttt {T2A} encoding\pfill \main{b-20} + \subitem \texttt {T2B} encoding\pfill \main{b-20} + \subitem \texttt {T2C} encoding\pfill \main{b-20} + \subitem \texttt {X2} encoding\pfill \main{b-20} + \item \texttt {\PrintChar{092}vrule}\pfill a-239, a-241 + + \indexspace +{\bfseries\hfil W\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}@width}\pfill a-237, a-240 + \item \texttt {\PrintChar{092}@wrong@font@char}\pfill a-121 + + \indexspace +{\bfseries\hfil X\hfil}\nopagebreak + + \item \texttt {\PrintChar{092}@xxxii}\pfill a-377, a-379 + + \end{theindex} + +\end{document} |