%PS% % This script will re-encode all of the common fonts available in PostScript % machines with an ISO-8859-2 encoding vector. % It uses procedures to create font variants containing composite characters. % % This is set up first with the encoding vector for the desired font, ensuring % that the accent characters are in this vector. % % Then within the MakeISO2Font procedure, there is a dictionary called SpecialChars % which determines how the composite chars are to be created from the underlying % glyphs. Each name has an associated array of length 2, 3 or 4. % % If there are two elements, the first is the base character and the second is % the accent. The accent is positioned centred horizontally; its vertical % position will be automatically moved depending on the character height. % % If there are three elements, the third element indicates the horizontal start % position of the accent as a fraction of the width of the base character's % bounding box. The height is unmodified and not based on the base character % height. % % If there are four elements, the third is as for three elements, and the fourth % indicates Y positioning of the accent, again as a fraction of the base % character's bounding box height. % % In designing this code, an attempt has been made to select positions for the % accent marks which will work for all fonts. This is an impossible goal. % Even within the one font family, the italic version will have different % positioning requirements from the roman version. So rather than applying the % one SpecialChars array to all fonts, a better result would be obtained if the % numbers were individually tweaked for each font. % % Usage: % /new-font-name /latin1-name /original-font-name MakeISO2Font - % Unfortunately, it is most convenient to create an intermediate font, here % called the "latin1-font", which has the base characters and the accent glyphs % in the same position as they will appear in the new font. % % Copyright: Graham Freeman, 15 December 2006 % This program may be freely used and modified, provided that this copyright % notice is not removed or modified. The author expects no payment for its use, % and takes no responsibility for its misuse or any errors that might have been % made in its construction or transmission. /ISO8859_2_vec [ /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright /parenleft/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two /three/four/five/six/seven/eight/nine/colon/semicolon/less/equal/greater /question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft /backslash/bracketright/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j /k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef /dotlessi/grave/acute/circumflex/tilde/macron/breve/dotaccent /dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut/ogonek/caron % ISO 8859-2 encoding % Character name %C,code% Octal code in PS string /.notdef/Aogonek/breve % 160 161 162 \240 \241 \242 /Lslash/currency/Lcaron % 163 164 165 \243 \244 \245 /Sacute/section/dieresis % 166 167 168 \246 \247 \250 /Scaron/Scedilla/Tcaron % 169 170 171 \251 \252 \253 /Zacute/hyphen/Zcaron % 172 173 174 \254 \255 \256 /Zdot/degree/aogonek % 175 176 177 \257 \260 \261 /ogonek/lslash/acute % 178 179 180 \262 \263 \264 /lcaron/sacute/circumflex % 181 182 183 \265 \266 \267 /cedilla/scaron/scedilla % 184 185 186 \270 \271 \272 /tcaron/zacute/hungarumlaut % 187 188 189 \273 \274 \275 /zcaron/zdot/Racute % 190 191 192 \276 \277 \300 /Aacute/Acircumflex/Abreve % 193 194 195 \301 \302 \303 /Adieresis/Lacute/Cacute % 196 197 198 \304 \305 \306 /Ccedilla/Ccaron/Eacute % 199 200 201 \307 \310 \311 /Eogonek/Edieresis/Ecaron % 202 203 204 \312 \313 \314 /Iacute/Icircumflex/Dcaron % 205 206 207 \315 \316 \317 /Eth/Nacute/Ncaron % 208 209 210 \320 \321 \322 /Oacute/Ocircumflex/Ohungarumlaut % 211 212 213 \323 \324 \325 /Odieresis/multiply/Rcaron % 214 215 216 \326 \327 \330 /Uring/Uacute/Uhungarumlaut % 217 218 219 \331 \332 \333 /Udieresis/Yacute/Tcedilla % 220 221 222 \334 \335 \336 /germandbls/racute/aacute % 223 224 225 \337 \340 \341 /acircumflex/abreve/adieresis % 226 227 228 \342 \343 \344 /lacute/cacute/ccedilla % 229 230 231 \345 \346 \347 /ccaron/eacute/eogonek % 232 233 234 \350 \351 \352 /edieresis/ecaron/iacute % 235 236 237 \353 \354 \355 /icircumflex/dcaron/dstroke % 238 239 240 \356 \357 \360 /nacute/ncaron/oacute % 241 242 243 \361 \362 \363 /ocircumflex/ohungarumlaut/odieresis % 244 245 246 \364 \365 \366 /divide/rcaron/uring % 247 248 249 \367 \370 \371 /uacute/uhungarumlaut/udieresis % 250 251 252 \372 \373 \374 /yacute/tcedilla/dotaccent % 253 254 255 \375 \376 \377 ] def % new-font intermediate-font original-font MakeISO2Font - /MakeISO2Font { findfont dup length dict begin { 1 index /FID eq 2 index /Encoding eq or 2 index /UniqueID eq or {pop pop}{def}ifelse } forall /Encoding ISO8859_2_vec def dup currentdict end definefont pop 11 dict begin /BasefontName exch def /FontName exch def /FontType 3 def BasefontName findfont dup /FontBBox get /FontBBox exch def /Encoding ISO8859_2_vec def /FontMatrix get /FontMatrix exch def /SpecialChars 45 dict begin /Abreve [(A)(\226)] def /abreve [(a)(\226)] def /Aogonek [(A)(\236) .7] def /aogonek [(a)(\236) .7] def /Cacute [(C)(\222)] def /cacute [(c)(\222)] def /Ccaron [(C)(\237)] def /ccaron [(c)(\237)] def /Dcaron [(D)(\237)] def /dcaron [(d)(')1] def /dstroke [(d)(-) .9 1.1] def /Eogonek [(E)(\236) .5] def /eogonek [(e)(\236)] def /Ecaron [(E)(\237)] def /ecaron [(e)(\237)] def /Lacute [(L)(\222)] def /lacute [(l)(\222)] def /Lcaron [(L)(') .5] def /lcaron [(l)(') 1] def /Nacute [(N)(\222)] def /nacute [(n)(\222)] def /Ncaron [(N)(\237)] def /ncaron [(n)(\237)] def /Ohungarumlaut [(O)(\235)] def /ohungarumlaut [(o)(\235)] def /Racute [(R)(\222)] def /racute [(r)(\222)] def /Rcaron [(R)(\237)] def /rcaron [(r)(\237)] def /Sacute [(S)(\222)] def /sacute [(s)(\222)] def /Scedilla [(S)(,) .45] def /scedilla [(s)(,)] def /Tcaron [(T)(\237)] def /tcaron [(t)(') .9] def /Tcedilla [(T)(,) .45] def /tcedilla [(t)(,) .47] def /Uring [(U)(\232)] def /uring [(u)(\232)] def /Uhungarumlaut [(U)(\235)] def /uhungarumlaut [(u)(\235)] def /Zacute [(Z)(\222)] def /zacute [(z)(\222)] def /Zdot [(Z)(\227)] def /zdot [(z)(\227)] def currentdict end def /BuildChar { exch begin BasefontName findfont 1000 scalefont setfont Encoding 1 index get SpecialChars exch 2 copy known { get dup length 2 gt {dup length 3 eq { % X position, as fraction of b.box aload pop 2 index stringwidth % (1)(2) x dx dy newpath 0 0 moveto 4 index true charpath flattenpath pathbbox newpath 0 0 moveto 7 index true charpath flattenpath pathbbox % (1)(2) x dx dy lx1 ly1 ux1 uy1 lx2 ly2 ux2 uy2 5 index 11 index mul cvi dup 13 1 roll % (1)(2) d2x x dx dy lx1 ly1 ux1 uy1 lx2 ly2 ux2 uy2 d2x 3 -1 roll add 6 -1 roll 2 copy gt {pop}{exch pop}ifelse % (1)(2) d2x x dx dy lx1 ly1 uy1 lx2 ly2 uy2 ux exch 5 -1 roll 2 copy gt {pop}{exch pop}ifelse % (1)(2) d2x x dx dy lx1 ly1 lx2 ly2 ux uy 3 -1 roll 5 -1 roll 2 copy lt {pop}{exch pop}ifelse % (1)(2) d2x x dx dy lx1 lx2 ux uy ly 5 -2 roll 2 copy lt {pop}{exch pop}ifelse % (1)(2) d2x x dx dy ux uy ly lx exch 4 2 roll 1 index 6 index gt {1 index 7 1 roll 6 -1 roll pop }if % (1)(2) d2x x dxf dy lx ly ux uy 7 -1 roll pop 0 7 1 roll % (1)(2) d2x d2y dxf dyf lx ly ux uy } { % X,Y positions, as fractions of b.box aload pop 3 index stringwidth % (1)(2) x y dx dy newpath 0 0 moveto 4 index true charpath flattenpath pathbbox newpath 0 0 moveto 9 index true charpath flattenpath pathbbox % (1)(2) x y dx dy lx1 ly1 ux1 uy1 lx2 ly2 ux2 uy2 4 index 11 index mul cvi dup 14 1 roll % (1)(2) d2y x y dx dy lx1 ly1 ux1 uy1 lx2 ly2 ux2 uy2 d2y 6 index 13 index mul cvi dup 16 1 roll % (1)(2) d2x d2y x y dx dy lx1 ly1 ux1 uy1 lx2 ly2 ux2 uy2 d2y d2x 4 -1 roll add 7 -1 roll 2 copy gt {pop}{exch pop}ifelse % (1)(2) d2x d2y x y dx dy lx1 ly1 uy1 lx2 ly2 uy2 d2y ux 3 1 roll add 5 -1 roll 2 copy gt {pop}{exch pop}ifelse % (1)(2) d2x d2y x y dx dy lx1 ly1 lx2 ly2 ux uy 3 -1 roll 5 -1 roll 2 copy lt {pop}{exch pop}ifelse % (1)(2) d2x d2y x y dx dy lx1 lx2 ux uy ly 5 -2 roll 2 copy lt {pop}{exch pop}ifelse % (1)(2) d2x d2y x y dx dy ux uy ly lx exch 4 2 roll 1 index 6 index gt {1 index 7 1 roll 6 -1 roll pop }if % (1)(2) d2x d2y x y dxf dy lx ly ux uy 8 -2 roll pop pop % (1)(2) d2x d2y dxf dyf lx ly ux uy }ifelse} { aload pop 1 index stringwidth newpath 0 0 moveto 3 index true charpath flattenpath pathbbox newpath 0 0 moveto 6 index true charpath flattenpath pathbbox 8 copy pop neg exch pop exch sub 3 -1 roll add 4 -1 roll add 3 1 roll pop pop 2 div newpath 0 0 moveto (X) true charpath flattenpath pathbbox 4 1 roll pop pop pop newpath 0 0 moveto (x) true charpath flattenpath pathbbox 4 1 roll pop pop pop dup 3 1 roll sub dup 2 div 3 -1 roll add 7 index ge {pop 0} if 2 copy 14 2 roll 2 copy 5 -1 roll add 7 1 roll 4 -1 roll add 6 1 roll 3 -1 roll add 5 1 roll add 4 1 roll 5 -1 roll 2 copy gt {pop}{exch pop} ifelse 7 1 roll 4 -1 roll 2 copy gt {pop}{exch pop} ifelse 6 1 roll 3 -1 roll 2 copy lt {pop} {exch pop} ifelse 5 1 roll 2 copy lt {pop}{exch pop} ifelse 4 1 roll } ifelse setcachedevice moveto show 0 0 moveto show pop } { pop pop ( ) dup 0 3 index put dup stringwidth newpath 0 0 moveto 3 -1 roll true charpath flattenpath pathbbox setcachedevice Encoding exch get 0 0 moveto glyphshow }ifelse end } def FontName currentdict end definefont pop } def /FontVec [ /Times-Roman /Times-Roman-iso2 /Times-Roman-iso1 /Times-Italic /Times-Italic-iso2 /Times-Italic-iso1 /Times-Bold /Times-Bold-iso2 /Times-Bold-iso1 /Times-BoldItalic /Times-BoldItalic-iso2 /Times-BoldItalic-iso1 /Helvetica /Helvetica-iso2 /Helvetica-iso1 /Helvetica-Oblique /Helvetica-Oblique-iso2 /Helvetica-Oblique-iso1 /Helvetica-Bold /Helvetica-Bold-iso2 /Helvetica-Bold-iso1 /Helvetica-BoldOblique /Helvetica-BoldOblique-iso2 /Helvetica-BoldOblique-iso1 /Courier /Courier-iso2 /Courier-iso1 /Courier-Oblique /Courier-Oblique-iso2 /Courier-Oblique-iso1 /Courier-Bold /Courier-Bold-iso2 /Courier-Bold-iso1 /Courier-BoldOblique /Courier-BoldOblique-iso2 /Courier-BoldOblique-iso1 /Palatino-Roman /Palatino-Roman-iso2 /Palatino-Roman-iso1 /Palatino-Italic /Palatino-Italic-iso2 /Palatino-Italic-iso1 /Palatino-Bold /Palatino-Bold-iso2 /Palatino-Bold-iso1 /Palatino-BoldItalic /Palatino-BoldItalic-iso2 /Palatino-BoldItalic-iso1 /NewCenturySchlbk-Roman /NewCenturySchlbk-Roman-iso2 /NewCenturySchlbk-Roman-iso1 /NewCenturySchlbk-Italic /NewCenturySchlbk-Italic-iso2 /NewCenturySchlbk-Italic-iso1 /NewCenturySchlbk-Bold /NewCenturySchlbk-Bold-iso2 /NewCenturySchlbk-Bold-iso1 /NewCenturySchlbk-BoldItalic /NewCenturySchlbk-BoldItalic-iso2 /NewCenturySchlbk-BoldItalic-iso1 /Bookman-Light /Bookman-Light-iso2 /Bookman-Light-iso1 /Bookman-LightItalic /Bookman-LightItalic-iso2 /Bookman-LightItalic-iso1 /Bookman-Demi /Bookman-Demi-iso2 /Bookman-Demi-iso1 /Bookman-DemiItalic /Bookman-DemiItalic-iso2 /Bookman-DemiItalic-iso1 /AvantGarde-Book /AvantGarde-Book-iso2 /AvantGarde-Book-iso1 /AvantGarde-BookOblique /AvantGarde-BookOblique-iso2 /AvantGarde-BookOblique-iso1 /AvantGarde-Demi /AvantGarde-Demi-iso2 /AvantGarde-Demi-iso1 /AvantGarde-DemiOblique /AvantGarde-DemiOblique-iso2 /AvantGarde-DemiOblique-iso1 /Helvetica-Narrow /Helvetica-Narrow-iso2 /Helvetica-Narrow-iso1 /Helvetica-Narrow-Oblique /Helvetica-Narrow-Oblique-iso2 /Helvetica-Narrow-Oblique-iso1 /Helvetica-Narrow-Bold /Helvetica-Narrow-Bold-iso2 /Helvetica-Narrow-Bold-iso1 /Helvetica-Narrow-BoldOblique /Helvetica-Narrow-BoldOblique-iso2 /Helvetica-Narrow-BoldOblique-iso1 ] def % item table no-entries/line TabSearch item index true % item false /TabSearch { 1 index length 1 index idiv 1 sub 0 1 3 -1 roll {1 index mul dup 3 index exch get 4 index eq {3 1 roll pop pop true exit}{pop}ifelse}for dup type /booleantype ne {pop pop false}if } def % - SetFont - Replace Quikscript procedure /SetFont { Font FontTp FontWt FontStack FontInd get 2 mul add 2 mul add get FontVec 2 TabSearch {1 add FontVec exch get dup 3 1 roll pdfvec ReEncodeSmall Font FontTp FontWt FontStack FontInd get 2 mul add 2 mul add 2 index put} if findfont FntSizStack FntSiz get SubBase 0 ne {SubFr mul}if scalefont setfont } def QSdict begin userdict begin 0 1 FontVec length 3 idiv 1 sub { 3 mul dup FontVec exch get dup dup {findfont} stopped {pop pop pop exit}{pop}ifelse FontVec 3 index 1 add get dup 4 1 roll exch FontVec 6 -1 roll 2 add get exch MakeISO2Font /I 0 def {Font I get 1 index eq { pop Font I 3 -1 roll put exit} { /I I 1 add def} ifelse } loop } for end end PE %FN%%FN%