Article View: comp.lang.postscript
Article #8167Re: Re: Encoding vectors/character sets
From: Glenn Reid
Date: Mon, 27 Mar 1989 21:32
Date: Mon, 27 Mar 1989 21:32
189 lines
7598 bytes
7598 bytes
In article <4232408a.1830f@apollo.COM> hayes@apollo.COM (Timothy Hayes) writes:
>
> I am reposting this since I received no responses from
>anyone at Adobe. I have received several messages from
>other people in this newsgroup that are also keenly interested
>in a solution.
Since this is of general interest, I posted a reply on March 15.
Perhaps it didn't make it to the outside world, but I got no error
reports. Anyway, here it is again.
Glenn Reid
Adobe Systems
[ original header moved right to avoid confusing any software ]
Path: adobe!greid
From: greid@adobe.com (Glenn Reid)
Newsgroups: comp.lang.postscript
Subject: Re: Re: Encoding vectors/character sets
Message-ID: <655@adobe.UUCP>
Date: 15 Mar 89 18:55:07 GMT
References: <42053a69.1830f@apollo.COM>
Sender: news@adobe.COM
Reply-To: greid@adobe.COM (Glenn Reid)
Organization: Adobe Systems Incorporated, Mountain View
Lines: 162
In article <42053a69.1830f@apollo.COM> hayes@apollo.COM (Timothy Hayes) writes:
>I am slightly confused, is ISOLatin1Encoding an encoding vector that
>I should pass to ReEncodeSmall? I have enclosed the PostScript code I
>used to try this but, ISOLatin1Encoding was not defined.
Enclosed is the original program, slightly rewritten. It supplies the
ISOLatin1Encoding vector if it is not already in ROM, and checks to see
if the font you are trying to reencode contains the appropriate
characters. It is possible to have the vector but not have the
character set (newer printer, old downloadable font) or to have
the character set but not have the vector (old printer, newer
downloadable font). This upgrade was made quite two or three years
ago, so it is getting harder and harder to find a printer that doesn't
have them, but they certainly exist. In fact, I couldn't find such a
printer around Adobe, so I'm not certain that my font checking code
works properly, but it should be close.
Glenn Reid
Adobe Systems
%!
%%Creator: Timothy Hayes with a little help from Glenn Reid
%%Title: sample program for ISO Latin-1 Encoding of fonts
%%EndComments
% define /ISOLatin1Encoding only if it's not already there. If it is
% there, save the memory you otherwise would have wasted with the array:
/ISOLatin1Encoding where { pop save true }{ false } ifelse
/ISOLatin1Encoding [ %def
/.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/minus/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/space/exclamdown/cent/sterling/currency/yen/brokenbar
/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot
/hyphen/registered/macron/degree/plusminus/twosuperior/threesuperior
/acute/mu/paragraph/periodcentered/cedilla/onesuperior/ordmasculine
/guillemotright/onequarter/onehalf/threequarters/questiondown
/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla
/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute
/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis
/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave
/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex
/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex/udieresis
/yacute/thorn/ydieresis
] def
% boolean still on stack from previous "ifelse" statement
{ restore } if
% The "checkISO" procedure is called from "reencodeISO" below. It checks
% to see if the font has the ISO-Latin-1 characters by looking for "Thorn".
% You may want to omit this (and the call to it below).
/checkISO { %def % expects a font dictionary
dup /FontType known { %ifelse
dup /FontType get 3 ne { %ifelse
dup /CharStrings known { %ifelse
dup /CharStrings get /Thorn known { %ifelse
% everything is cool
}{ %else
% does not have ISO character set; error message here.
dup /FontName known
{ dup /FontName get }{ /UnknownFont } ifelse
% font name is on stack. print it across comm channel:
128 string cvs print
(: does not support ISO character set.) = flush
stop % abort entire print job.
} ifelse
}{ (checkISO: No CharStrings; something wrong.) == } ifelse
}{ (checkISO: User-defined font; you're on your own.) == } ifelse
} { (checkISO: No FontType; you're on your own.) == } ifelse
} bind def
% The following procedure will reencode a font by copying it and replacing
% it with a vector of 256 names that you supply (hopefully the ISOLatin1
% vector, since it is tailored for ISOLain1; if you get rid of the
% "checkISO" procedure call and name it just "reencode", it is more
% generally useful).
%
% It expects to find three things on the operand stack:
%
% [ array ] /NewName /OldName reencodeISO
/reencodeISO { %def
findfont checkISO dup length dict begin
{ 1 index /FID ne {def}{pop pop} ifelse } forall
exch /Encoding exch def
currentdict end definefont pop
} bind def
ISOLatin1Encoding /Courier-Foreign /Courier reencodeISO
% the rest of the program is as originally posted:
/Courier-Foreign findfont 14 scalefont setfont
/char 1 string def
/nstr 3 string def
/newline
{ currentpoint 13 sub
exch pop LM
exch moveto } def
/prt-n % stack:code
{nstr cvs show} def
/prtchar % stack:code
{ char 0
3 -1 roll put
char show } def
/PrintCodeandChar % stack:code
{ dup prt-n
( ) show
prtchar newline } def
144 708 moveto
(Courier-Foreign 14 point) show
/LM 72 def
LM 672 moveto
32 1 64 {PrintCodeandChar} for
/LM 144 def
LM 672 moveto
65 1 96 {PrintCodeandChar} for
/LM 216 def
LM 672 moveto
97 1 127 {PrintCodeandChar} for
/LM 288 def
LM 672 moveto
128 1 159 {PrintCodeandChar} for
/LM 360 def
LM 672 moveto
160 1 191 {PrintCodeandChar} for
/LM 432 def
LM 672 moveto
192 1 223 {PrintCodeandChar} for
/LM 504 def
LM 672 moveto
224 1 255 {PrintCodeandChar} for
showpage
Technical Details
Message-ID:
<696@adobe.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!adobe!greidReferences:
<4232408a.1830f@apollo.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!adobe!greid From: greid@adobe.com (Glenn Reid) Newsgroups: comp.lang.postscript Subject: Re: Re: Encoding vectors/character sets Summary: here it is again Message-ID: <696@adobe.UUCP> Date: 27 Mar 89 21:32:50 GMT References: <4232408a.1830f@apollo.COM> Sender: news@adobe.COM Reply-To: greid@adobe.COM (Glenn Reid) Organization: Adobe Systems Incorporated, Mountain View Lines: 189