Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deflate embeded font

Status
Not open for further replies.

stigic

Programmer
Oct 3, 2005
11
PL
me again on embeded fonts ;)
as you may have noticed, i managed type42 fonts. now i want to know if there's a smart way to use the deflate filter on the sfnts array, which contains the data from the ttf font. i tryed some ways, but i don't understand how to apply a filter only to a certain string..
for example, now i have the ttf definirion as a hex string <A3F4....>
but i want it as ascii85+deflated binary.
so, is there a way to replace
/sfnts [
<aaffffee....>
<aaffffee....>
...
<aaffffee....>
]
through some kind of
/sfnts [
<~!@#!#@@$#!$....~> /ASCII85Decode filter /FlateDecode filter
....
]
something?

on my images i've done it that way:
/Image {gsave
/ZData exch def /VHeight exch def
/VWidth exch def
/Height exch def
/Width exch def
/Y exch def
/X exch def
/Data ZData /FlateDecode filter def
X Y translate
VWidth VHeight scale
Width Height 8 [Width 0 0 Height neg 0 Height] Data false 3 colorimage
grestore
} def
34 486 143 17 107 13 {<~
Gb"/gl......!'EAV>^
~>} Image

thanks again
 
You need to read the data from the current file and
construct the array at run time. I didn't test this code.
Debugging is left for the exercise of the reader.

Code:
/read_sfnts
{ 
/sfnts [
currentfile 0 (%%EndBinary) /SubFileDecode filter
/ASCII85Decode filter /FlateDecode filter
{ dup 4096 string readstring pop 
  dup length 0 eq { pop pop exit } if 
  exch
} loop
] def
} bind def

%%BeginBinary ...
read_sfnts
.....
%%EndBinary

Your PostScript expert is just a click away.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top