special characters in ps 
Author Message
 special characters in ps

Hello,

due to some unpleasant circumstances I have to edit some text in a
postscriptfile. The header looks like this:
%!PS-Adobe-3.0
...
/m   { moveto } def
/g   { setgray } def
/t   { gsave 1 -1 scale 0 exch rmoveto show grestore } def
/fn  { 150 72 div mul exch findfont exch
       scalefont setfont } def
...

and the lines including the text like this:

/Helvetica 10.000 fn
0.000 g
337 406 m
(TEXT1) 3.333 t
337 589 m
(TEXT2) 3.333 t
335 771 m
(TEXT3) 3.333 t
337 955 m
...

Now I want to edit the TEXT so that it contains a special character, a
degree sign (). There is no problem in editing, but neither ghostview
nor the printer want to print the sign. Does anybody know why?

Thanks,

Thomas



Mon, 16 Sep 2002 03:00:00 GMT  
 special characters in ps

Quote:

> Now I want to edit the TEXT so that it contains a special character, a
> degree sign (). There is no problem in editing, but neither ghostview
> nor the printer want to print the sign. Does anybody know why?

Yes.
You are adding a character that is not correctly encoded.
To obtain the desired result, you need to reencode the font and assign
an encoding (an character position) to the desired glyph. I have
appended an example how to reencode a font. After reencoding, you must
use the HelveticaX font, and insert \300 where you want the degree
symbol.

I hope this helps,
        Johan

--- example ---
% This is from the Blue Book.
%
% Make minor changes to an existing font

/ReEncodeSmallDict 12 dict def
/ReEncodeSmall
{ ReEncodeSmallDict 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
  newcodesandnames length 2 idiv
  { newfont /Encoding get 3 1 roll put }
  repeat

  newfontname newfont definefont pop
  end

Quote:
} def

/Vec [
  8#300 /degree
] def

/Helvetica /HelveticaX Vec ReEncodeSmall



Mon, 16 Sep 2002 03:00:00 GMT  
 special characters in ps

Quote:

>Now I want to edit the TEXT so that it contains a special character, a
>degree sign (). There is no problem in editing, but neither ghostview
>nor the printer want to print the sign. Does anybody know why?

Fonts in PostScript have an encoding. That is a mapping from the 256
byte values into specific characters in the font. You should not
assume any particular encoding. Check the PostScript file to see what
encoding it sets.
----------------------------------------

Visit http://www.*-*-*.com/ ,
PSAlter, psalters, tea, and small {*filter*} animals. And stuff.  


Mon, 16 Sep 2002 03:00:00 GMT  
 special characters in ps
Thanks Johan,

for your practical hints. It works fine,

Thomas



Tue, 17 Sep 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. special characters

2. special character conversion

3. special characters and ASCII code

4. Newbie - help with special character

5. newbie and M-dash, and other special characters

6. url special characters

7. Special characters help

8. Special characters in PostScript

9. Response.Write: Special characters

10. special character in vbscript?

11. Special characters

12. Special characters

 

 
Powered by phpBB® Forum Software