For Programmers: Free Programming Magazines  


Home > Archive > PostScript > May 2005 > Font encoding









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Font encoding
Alain Reymond

2005-05-01, 3:59 pm

Hello,

Do you now how I can have an encoding to cp850 ?
We work with Linux and Windows. Under Linux, we have texts with accents
stored.

I wrote the following to change the StandardEncoding :

/Arial findfont
0 dict copy begin
/Encoding ISOLatin1Encoding def
/MyArial /FontName def
currentdict end
dup /FID undef
/MyArial exch definefont pop

/MyArial findfont
14 scalefont
setfont
120.00 720.00 moveto
(Méthode) show

If my text (Méthode) comes from a Windows editor, it is ok. But if I
write it (Méthode) from linux text editor, I have another character than
the é.

In fact, I found that under Linux, we have a cp850 char set.
Here are the hexa values :
Linux Windows
cp850 ISOLatin1
à 85 E0
é 82 E9

Is there a way to have a kind of :

/Encoding cp850 def

to have the accents on my printer !

Regards.
Don Lewis

2005-05-01, 3:59 pm

Try something like this to just replace a few accented characters.

/pc-850encoding {256 array} def % create an encoding array
ISOLatin1Encoding pc-850encoding copy % populate initial values
/pc-850encoding exch def
pc-850encoding
dup 144 /Eacute put
dup 147 /ocircumflex put
dup 130 /eacute put
dup 131 /acircumflex put
dup 133 /agrave put
dup 135 /ccedilla put
dup 136 /ecircumflex put
dup 138 /egrave put
dup 140 /icircumflex put
dup 160 /aacute put
dup 210 /Ecircumflex put
dup 212 /Egrave put
dup 226 /Ocircumflex put
/pc-850encoding exch def

"Alain Reymond" <arwebmail@skynet.be> wrote in message
news:427153e6$0$7739$ba620e4c@news.skynet.be...
> Hello,
>
> Do you know how I can have an encoding to cp850 ?
> We work with Linux and Windows. Under Linux, we have texts with accents
> stored.
>
> I wrote the following to change the StandardEncoding :
>
> /Arial findfont
> 0 dict copy begin
> /Encoding ISOLatin1Encoding def
> /MyArial /FontName def
> currentdict end
> dup /FID undef
> /MyArial exch definefont pop
>
> /MyArial findfont
> 14 scalefont
> setfont
> 120.00 720.00 moveto
> (Méthode) show
>
> If my text (Méthode) comes from a Windows editor, it is ok. But if I
> write it (Méthode) from linux text editor, I have another character than
> the é.
>
> In fact, I found that under Linux, we have a cp850 char set.
> Here are the hexa values :
> Linux Windows
> cp850 ISOLatin1
> à 85 E0
> é 82 E9
>
> Is there a way to have a kind of :
>
> /Encoding cp850 def
>
> to have the accents on my printer !
>
> Regards.



Alain Reymond

2005-05-01, 3:59 pm

Thank you for the tip.
I'll have a look at it and try.

Regards.

Don Lewis a écrit :
> Try something like this to just replace a few accented characters.
>
> /pc-850encoding {256 array} def % create an encoding array
> ISOLatin1Encoding pc-850encoding copy % populate initial values
> /pc-850encoding exch def
> pc-850encoding
> dup 144 /Eacute put
> dup 147 /ocircumflex put
> dup 130 /eacute put
> dup 131 /acircumflex put
> dup 133 /agrave put
> dup 135 /ccedilla put
> dup 136 /ecircumflex put
> dup 138 /egrave put
> dup 140 /icircumflex put
> dup 160 /aacute put
> dup 210 /Ecircumflex put
> dup 212 /Egrave put
> dup 226 /Ocircumflex put
> /pc-850encoding exch def
>
> "Alain Reymond" <arwebmail@skynet.be> wrote in message
> news:427153e6$0$7739$ba620e4c@news.skynet.be...
>
>
>
>

Alain Reymond

2005-05-01, 3:59 pm

It works perfectly.
Thank you.
Here is a completed (yet not complete!) version:

/pc-850encoding {256 array} def % create an encoding array
ISOLatin1Encoding pc-850encoding copy % populate initial values
/pc-850encoding exch def
pc-850encoding
dup 128 /Ccedilla put
dup 129 /udieresis put
dup 130 /eacute put
dup 131 /acircumflex put
dup 132 /adieresis put
dup 133 /agrave put
dup 134 /aring put
dup 135 /ccedilla put
dup 136 /ecircumflex put
dup 137 /edieresis put
dup 138 /egrave put
dup 139 /idieresis put
dup 140 /icircumflex put
dup 141 /igrave put
dup 142 /Adieresis put
dup 143 /Aring put
dup 144 /Eacute put
dup 145 /ae put
dup 146 /AE put
dup 147 /ocircumflex put
dup 148 /odieresis put
dup 149 /ograve put
dup 150 /ucircumflex put
dup 151 /ugrave put
dup 152 /ydieresis put
dup 153 /Odieresis put
dup 154 /Udieresis put
dup 155 /oslash put
dup 160 /aacute put
dup 161 /iacute put
dup 162 /oacute put
dup 163 /uacute put
dup 164 /ntilde put
dup 165 /Ntilde put
dup 225 /germandbls put
dup 248 /ring put
/pc-850encoding exch def

/Arial findfont
0 dict copy begin
/Encoding pc-850encoding def
/MyArial /FontName def
currentdict end
dup /FID undef
/MyArial exch definefont pop

/MyArial findfont
14 scalefont
setfont
120.00 720.00 moveto
(Méthode) show


Regards.

Alain


Don Lewis a écrit :
> Try something like this to just replace a few accented characters.
>
> /pc-850encoding {256 array} def % create an encoding array
> ISOLatin1Encoding pc-850encoding copy % populate initial values
> /pc-850encoding exch def
> pc-850encoding
> dup 144 /Eacute put
> dup 147 /ocircumflex put
> dup 130 /eacute put
> dup 131 /acircumflex put
> dup 133 /agrave put
> dup 135 /ccedilla put
> dup 136 /ecircumflex put
> dup 138 /egrave put
> dup 140 /icircumflex put
> dup 160 /aacute put
> dup 210 /Ecircumflex put
> dup 212 /Egrave put
> dup 226 /Ocircumflex put
> /pc-850encoding exch def
>
> "Alain Reymond" <arwebmail@skynet.be> wrote in message
> news:427153e6$0$7739$ba620e4c@news.skynet.be...
>
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com