|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 4220 (0x107c) Types: TextFile Names: »set-widths.psr«
└─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12 └─⟦af5ba6c8e⟧ »unix3.0/DVIWARE.tar.Z« └─⟦ca79c7339⟧ └─⟦this⟧ »DVIware/laser-setters/dvi-to-ps/TeXPS/dvitps/psr/set-widths.psr«
% Copyright (c) 1988 Stephan v. Bechtolsheim % This file is part of the TeXPS Software Package. % The TeXPS Software Package is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY. No author or distributor % accepts responsibility to anyone for the consequences of using it % or for whether it serves any particular purpose or works at all, % unless he says so in writing. Refer to the TeXPS Software Package % General Public License for full details. % Everyone is granted permission to copy, modify and redistribute % the TeXPS Software Package, but only under the conditions described in the % TeXPS Software Package General Public License. A copy of this license is % supposed to have been given to you along with TeXPS Software Package so you % can know your rights and responsibilities. It should be in a % file named CopyrightLong. Among other things, the copyright notice % and this notice must be preserved on all copies. % Routines to set the width of PS fonts. % Very similar to program 19, page 215ff of the PostScript Cookbook. % Contains two procedures: % (1) @AddWidthDictionary % (2) @MakeWidthDictionary /modwidthdict 8 dict def % local storage for procedure following % @AddWidthDictionary: % =================== % new-widths-dict old-font-name new-font-name @AddWidthDictionary % % old-font-name: name of font of which the width has to be changed. % new-font-name: name of the new font. % new-widths-dict: the width dictionary. % This is not a vector or array, but a complete width dictionary % as it has been previously generated by @MakeWidthDictionary. /@AddWidthDictionary { modwidthdict begin #ifdef DEBUG (@AddWidthDictionary: begin\n) print flush #endif /new-font-name exch def /old-font-name exch def /new-widths-dict exch def #ifdef DEBUG (new font: ) print new-font-name == (\n) print (old font: ) print old-font-name == (\n) print #endif % get the font dictionary of the old font /old-font-dict old-font-name findfont def % The new dictionary has one more entry than the old one /numentries old-font-dict maxlength 1 add def /newfont numentries dict def % create new dictionary old-font-dict % copy everything except for { % FontBBox and FID exch dup dup /FID ne exch /FontBBox ne and { exch newfont 3 1 roll put } { pop pop } ifelse } forall /newFontBBox old-font-dict /FontBBox get % bug fix, see exercise aload length array astore def % Add stuff to the new font dictionary newfont /FontBBox newFontBBox put newfont /FontName new-font-name put newfont /Metrics new-widths-dict put new-font-name newfont definefont % See 5.3 and 5.5 of the reference manual new-font-name % push the name also in the stack end % Dictionary returned from definefont still on stack exch def } def % @MakeWidthDictionary % ==================== % code-vector width-vector @MakeWidthDictionary width-dictionary % % Builds a width dictionary from a character code vector (with the % character names) and from a width vector. Both of them are combined % into one dictionary, which can be later added to the font. % The resulting width dictionary is left on the stack. /@MakeWidthDictionary { /width-vector exch def /code-vector exch def #ifdef DEBUG (Start @MakeWidthDictionary\n) print flush (Length of width vector: ) print width-vector length == (\n) print flush (Length of code vector: ) print code-vector length == (\n) print flush #endif % Alarm, if both vectors are not the same length width-vector length code-vector length ne {(@MakeWidthDictionary: Alarm: vectors of different length!\n) print flush quit} if % Create a dictionary to enter all the widths /width-dict code-vector length dict def % In a loop combine the coding vector and the width information 0 1 width-vector length 1 sub { /LoopCounter exch def width-dict code-vector LoopCounter get width-vector LoopCounter get put % This does a "/code width def" in width-dict % width-dict character-name new-width put } for width-dict % leave the width dictionary on the stack #ifdef DEBUG (End @MakeWidthDictionary\n) print flush #endif } def