how to create type 3 glyphs in postscript

297 views Asked by At
%%LanguageLevel: 3 
8 dict begin
/FontName /T3_414 def
/FontType 3 def
/FontBBox [ 0 0 1  1  ] def
/FontMatrix [0.011368 0 0  0.011368 0 0  ] def 
/Encoding 256 array def
0 1 255 {Encoding exch /.notdef put} for
Encoding 97 /g7516  put 
/BuildGlyph 
{ exch /CharProcs get exch % Get CharProcs dictionary 
2 copy known not % See if charname is known 
{ pop /.notdef } 
    if 
        get exec % Execute BuildGlyph procedure 
} bind def 
    /BuildChar % LanguageLevel 1 compatibility 
    { 1 index /Encoding get exch get 
        1 index /BuildGlyph get exec 
    } bind def 
/CharProcs 255 dict def
CharProcs begin 
/.notdef {} bind def
/g7516{

75 0 3  62 71 7  setcachedevice 
gsave
[
0.01  0  0  0.01  0  0  ] concat 
gsave
[6800 0 0  6900 300 700  ]concat

<<
/ImageType 1
  /Width  68
  /Height  69
  /ImageMatrix [  68 0 0  -69 0 69]
  /BitsPerComponent  1

  /Decode [1 0]
  /DataSource <78 9c 5d d1 3b 4e c3 40 10 06 e0 59 1c b1 ae 70
0a 4a e4 e4 06 70 80 08 ef 31 68 39 02 9d 23 81
6c 23 24 52 72 20 9a 1c 83 22 c2 a0 1c 80 96 02
21 47 29 68 50 ec 54 06 39 4a fe d9 9d 18 0b 57
9f d6 b3 b3 f3 50 d4 f9 bc cd 1e 33 23 f8 ee ff
c7 c7 f0 0f b9 b1 c1 8a d4 27 9f ea 27 e3 e2 20
5d f9 ba b6 81 9b 9e d7 58 6c 0f d4 b3 d1 e3 d4
dd 6f 11 5c 59 a8 56 40 45 7e 2d 38 59 0a ce 5f
19 83 82 92 8c 28 b1 91 59 4a 51 ce 78 31 88 0b
17 9c 84 3f 17 da c5 68 2e b8 be eb e0 f0 17 88
27 36 3d 51 ed 23 fd 65 8a 24 25 9a 88 b2 24 77
91 45 54 a8 95 b4 ef 1a 75 ed 2b 5b 04 66 e5 fe
a2 69 6a 7a d2 59 ad f6 ad 71 2e ae 9a ca 63 8c
01 35 52 19 ae 5d 65 e5 29 8e 6f 6e a5 93 f8 5e
3a a9 e3 07 7b 4b ad 38 89 15 bf ca f0 66 17 5f
16 7a fc b8 b4 08 2a d4 ce 08 17 78 97 31 9a a3
12 46 3c d1 ef c3 b2 af f8 2a ca c5 11 f2 60 41
80 2b 1a d0 3f 7c 08 1c ad 05 98 37 d6 04 9c bd
11 a5 9c 91 b7 ac dc fb 76 04 32 8b a0 ac 1c bc
46 40 db 42 a6 13 4d 05 83 a9 69 57 2a db e1 a1
ef 20 17 c7 86 b3>

  <<
  /Predictor 15
  /Columns 68>>
/FlateDecode filter   

 >>
imagemask 
grestore
grestore
} bind def


end 
currentdict end

/Examplefont exch definefont pop
/Examplefont findfont 12 scalefont setfont
36 52 moveto
(ababab) show

I am working on type 3 fonts in postscript. i am trying to debug this file and there is an error. ioerror imagemask. The input glyph in pdf file looks like this. i have converted binary data to ascii hex as i found no way to use it as is.

   stream
75 0 3 -62 71 7 d1
0.01 0 0 0.01 0 0 cm
q 6800 0 0 -6900 300 700 cm
BI
/IM true
/W 68
/H 69
/BPC 1
/D[1
0]
/F/Fl
/DP<</Predictor 15
/Columns 68>>
ID xœ]Ñ;NÃ@àY±®p
Jääp€ï1h9#l#$Rr šƒ" €–!G)hPìT9JþÙWŸÖ³³óPÔù¼Í3#øîÿÇÇð¹±ÁŠÔ'Ÿê'ãâ ]ùº¶›ž×XlÔ³ÑãÔÝo\Y¨V@E~-8Y
Î_ƒ‚’Œ(±‘YJQÎx1ˆœ„?ÚÅh.¸¾ëàðˆ'6=Qí#ýeŠ$%šˆ²$w‘ET¨•´ïuí+[fåþ¢ijzÒY­ö­q.®šÊcŒ5R®]eå)Žon¥“ø^:©ã{K­8‰¿Êðf_zü¸´*ÔÎx—1š£F<Ñïò¯ø*ÊÅò`A€+Ð?|­˜7Öœ½¥œ‘·¬Üûv2‹ ¬¼F@ÛB¦Mƒ©iW*Ûá¡ï dž³
EI Q
endstream 
endobj 

Below are the postscript and pdf files links for further demonstration. https://ufile.io/zmmjv https://ufile.io/2r2eb

1

There are 1 answers

6
KenS On BEST ANSWER

The data in your hex string is not the same as the binary in the original PDF file. This leads to an error with the Flate decode filter. If I correct that, then there is no error.

Basically, you corrupted the data, so an error is entirely to be expected.

Note that you haven't started the file with a %! but you have inserted a %%LanguageLevel: 3 comment. I'm not sure what you think that's doing, but its pointless. Your program doesn't include a showpage, so it won't do anything useful either.