Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Printing accented characters

0 views
Skip to first unread message

Gerald Neufeld

unread,
May 12, 1995, 3:00:00 AM5/12/95
to
Hi,

I am a PostScript newbie. However, I do have copies of the PS Language Tutorial
and Cookbook and the "red book". I am trying to print up some bilingual
materials (French & English) and am having trouble getting the accented French
characters (eacute, ucircumflex, etc.) to print. Table E.5 in the redbook
(p.596) gives an Octal ISO code for these characters but no Std Code. If I
use the Octal Character Codes as shown on P.94 of the Tutorial & Cookbook as
in:

/Times-Roman findfont 12 scalefont setfont
300 400 moveto
(D\351cembre) show
showpage

I either get no character or the wrong character. What am I doing wrong?

Gerry Neufeld neu...@brandonu.ca


Thad Floryan

unread,
May 15, 1995, 3:00:00 AM5/15/95
to
In article <neufeld.6...@brandonu.ca>

You need to reencode a font to include the ISO codes. Enclosed is an example
from one of my PostScript programs. The example (below) will permit you to
use your "(D\351cembre) show" with \351 displayed as an eacute (assuming that's
what you wanted there :-)

% make a font with all language diacriticals (an eacute is used in one box)
%
/reencdict 12 dict def
/ReEncode {
reencdict begin
/newcodesandnames exch def
/newfontname exch def
/basefontname exch def
/basefontdict basefontname findfont def
/newfont basefontdict maxlength dict def
basefontdict
{ exch dup /FID ne { dup /Encoding eq
{ exch dup length array copy newfont 3 1 roll put }
{ exch newfont 3 1 roll put }
ifelse }
{ pop pop }
ifelse } forall
newfont /FontName newfontname put newcodesandnames aload pop
128 1 255
{ newfont /Encoding get exch /.notdef put } for
newcodesandnames length 2 idiv
{ newfont /Encoding get 3 1 roll put } repeat
newfontname newfont definefont pop end
} def
/isovec [
8#200 /grave 8#201 /acute 8#202 /circumflex
8#203 /tilde 8#204 /macron 8#205 /breve
8#206 /dotaccent 8#207 /dieresis 8#210 /ring
8#211 /cedilla 8#212 /hungarumlaut 8#213 /ogonek
8#214 /caron 8#220 /dotlessi 8#240 /space
8#241 /exclamdown 8#242 /cent 8#243 /sterling
8#244 /currency 8#245 /yen 8#246 /brokenbar
8#247 /section 8#250 /dieresis 8#251 /copyright
8#252 /ordfeminine 8#253 /guillemotleft 8#254 /logicalnot
8#255 /endash 8#256 /registered 8#257 /macron
8#260 /degree 8#261 /plusminus 8#262 /twosuperior
8#263 /threesuperior 8#264 /acute 8#265 /mu
8#266 /paragraph 8#267 /periodcentered 8#270 /cedilla
8#271 /onesuperior 8#272 /ordmasculine 8#273 /guillemotright
8#274 /onequarter 8#275 /onehalf 8#276 /threequarters
8#277 /questiondown 8#300 /Agrave 8#301 /Aacute
8#302 /Acircumflex 8#303 /Atilde 8#304 /Adieresis
8#305 /Aring 8#306 /AE 8#307 /Ccedilla
8#310 /Egrave 8#311 /Eacute 8#312 /Ecircumflex
8#313 /Edieresis 8#314 /Igrave 8#315 /Iacute
8#316 /Icircumflex 8#317 /Idieresis 8#320 /Eth
8#321 /Ntilde 8#322 /Ograve 8#323 /Oacute
8#324 /Ocircumflex 8#325 /Otilde 8#326 /Odieresis
8#327 /multiply 8#330 /Oslash 8#331 /Ugrave
8#332 /Uacute 8#333 /Ucircumflex 8#334 /Udieresis
8#335 /Yacute 8#336 /Thorn 8#337 /germandbls
8#340 /agrave 8#341 /aacute 8#342 /acircumflex
8#343 /atilde 8#344 /adieresis 8#345 /aring
8#346 /ae 8#347 /ccedilla 8#350 /egrave
8#351 /eacute 8#352 /ecircumflex 8#353 /edieresis
8#354 /igrave 8#355 /iacute 8#356 /icircumflex
8#357 /idieresis 8#360 /eth 8#361 /ntilde
8#362 /ograve 8#363 /oacute 8#364 /ocircumflex
8#365 /otilde 8#366 /odieresis 8#367 /divide
8#370 /oslash 8#371 /ugrave 8#372 /uacute
8#373 /ucircumflex 8#374 /udieresis 8#375 /yacute
8#376 /thorn 8#377 /ydieresis
] def
% end example

Here's how you would use the example with your test case (note the "-iso"
suffix usage with the "new" font):

% insert the example code here

/Times-Roman /Times-Roman-iso isovec ReEncode

/Times-Roman-iso findfont 12 scalefont setfont

Keith Vincent

unread,
May 16, 1995, 3:00:00 AM5/16/95
to
Gary,
The problem is that, from the Red Book (page 445 - ISOLatin1Encoding)
Roman text fonts produced by Adobe usually use the _StandardEncoding_
encoding vector.

But, as per instructions from the Red Book again (page 275 - Changing the Encoding
Vector, modify your code like

%!
/Times-Roman findfont dup length dict begin
{1 index /FID ne {def} {pop pop} ifelse } forall
/Encoding ISOLatin1Encoding def
currentdict
end
/Times-ISOLatin1 exch definefont pop

/Times-ISOLatin1 findfont 12 scalefont setfont
300 300 moveto (D\351cembre) show
showpage
And all works as planned.

Keith Vincent
Pegasus Systems Group - on contract to Hughes Aircraft of Canada

In article 004B...@brandonu.ca, neu...@brandonu.ca (Gerald Neufeld) writes:
>Hi,


>
>I am a PostScript newbie. However, I do have copies of the PS Language Tutorial
>and Cookbook and the "red book". I am trying to print up some bilingual
>materials (French & English) and am having trouble getting the accented French
>characters (eacute, ucircumflex, etc.) to print. Table E.5 in the redbook
>(p.596) gives an Octal ISO code for these characters but no Std Code. If I
>use the Octal Character Codes as shown on P.94 of the Tutorial & Cookbook as
>in:
>
> /Times-Roman findfont 12 scalefont setfont
> 300 400 moveto
> (D\351cembre) show
> showpage
>
>I either get no character or the wrong character. What am I doing wrong?
>

>Gerry Neufeld neu...@brandonu.ca
>

Clarke Brunt

unread,
May 16, 1995, 3:00:00 AM5/16/95
to
In article <neufeld.6...@brandonu.ca>, neu...@brandonu.ca (Gerald Neufeld) writes:
> I am a PostScript newbie. However, I do have copies of the PS Language Tutorial
> and Cookbook and the "red book". I am trying to print up some bilingual
> materials (French & English) and am having trouble getting the accented French
> characters (eacute, ucircumflex, etc.) to print. Table E.5 in the redbook
> (p.596) gives an Octal ISO code for these characters but no Std Code. If I
> use the Octal Character Codes as shown on P.94 of the Tutorial & Cookbook as
> in:
>
> /Times-Roman findfont 12 scalefont setfont
> 300 400 moveto
> (D\351cembre) show
> showpage
>
> I either get no character or the wrong character. What am I doing wrong?

If the character you want is shown in ISOLatin1Encoding, but not in
StandardEncoding, then you will need to re-encode the font. How to do
this should be in the book.

--
Clarke Brunt (CCB), Principal Software Engineer, Laser-Scan Ltd, Science Park,
Milton Rd, CAMBRIDGE, CB4 4FY, England. Tel: (+44) (0)1223 420414; Fax: 420044
Email: CLA...@LSL.CO.UK (via BRITAIN.EU.NET)

ce...@watson.ibm.com

unread,
May 16, 1995, 3:00:00 AM5/16/95
to
In <neufeld.6...@brandonu.ca>, neu...@brandonu.ca (Gerald Neufeld) writes:
>Hi,

>
>I am a PostScript newbie. However, I do have copies of the PS Language Tutorial
>and Cookbook and the "red book". I am trying to print up some bilingual
>materials (French & English) and am having trouble getting the accented French
>characters (eacute, ucircumflex, etc.) to print. Table E.5 in the redbook
>(p.596) gives an Octal ISO code for these characters but no Std Code. If I
>use the Octal Character Codes as shown on P.94 of the Tutorial & Cookbook as
>in:
>
> /Times-Roman findfont 12 scalefont setfont
> 300 400 moveto
> (D\351cembre) show
> showpage
>
>I either get no character or the wrong character. What am I doing wrong?
>
>Gerry Neufeld neu...@brandonu.ca
>

The standard encoding vector does not include eacute.
To obtain it you must set your font with the proper encoding vector.
Below is a Level 1 PostScript way of defining that vector.
(With Level 2, it is simpler to use the 'ISOLatin1Encoding' operator.)
The procedure "pEncode" below defines a new font with a given
encoding vector. Your example is recoded accordingly.

%!PS-
% === Font reencoding ===
/ISOLatin1Encoding
[ /.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
/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
/pEncode % aEncodingVector fFont nNewName __pEncode__ fFont
{
exch dup maxlength dict dup
begin
exch { 1 index /FID ne { def } { pop pop } ifelse } forall
/Encoding 4 -1 roll def
end
definefont
} def
% === Fonts ===
/Times-Roman findfont ISOLatin1Encoding exch /ISOTimes-Roman pEncode


12 scalefont setfont

300 400 moveto
(D\351cembre) show
showpage

%--Christian Lenz Cesar-...@watson.ibm.com--


Peter Kerr

unread,
Jun 6, 1995, 3:00:00 AM6/6/95
to
> /Times-Roman findfont 12 scalefont setfont
> 300 400 moveto
> (D\351cembre) show
> showpage
>
> I either get no character or the wrong character. What am I doing wrong?

The character corresponding to \351 in the Standard Encoding (Table E6
p598) is Oslash. A big heap of printer drivers and application software
use this Standard Encoding as the default.

You need to change the encoding to ISO Latin 1 as shown in sect.5.6 p275
of the Red Book

--
Peter Kerr bodger
School of Music chandler
University of Auckland neo-Luddite

Aandi inston

unread,
Jun 6, 1995, 3:00:00 AM6/6/95
to
You MUST re-encode the font before using it, since the
character you want is not present in the StandardEncoding
vector. In fact, there is no guarantee that a font has
any particular encoding, so it is good PostScript practice
ALWAYS to encode a font. Most people feel it is fair enough
to assume characters below 127 are in the right place
though. I think the cookbook includes an example of how
to re-encode a font. This is quite a lot of PostScript,
but there is no shortcut which will work in all cases.

--
Aandi Inston
Internet: 10012...@compuserve.com

0 new messages