Re: Help converting a truetype unicode font to type3
In article <iadsk.9899$Rs1.4191@newsfe08.iad>, john@hotmail.com says...
> Thank you for the reply. Unfortunately my goal is to keep other part of
> the PostScript output intact, only the font to be changed. I have
> created type3 font with 22K procs, but the font can only be used for
> single-byte charsets.
This is always true, type 3 fonts can only address up to 256 glyphs. As
Ed suggested you can create a font with more glyphs than that and create
multiple instances of the font which can address different sequences of
256 glyphs.
> and sends directly to the printer.True type fonts are converted into CID
> type0 (with multiple type42 descendent fonts shared a huge sfnt array).
> In theory it should work on all cases and in fact the output always work
> correctly in GSView. However, if the true type font contains very large
> glyphs (such as Chinese character), the printers we tested report
> out-of-memory error.
Most likely your font is too large for the font cache.
> Converting to type 3 seems solved the problem,
Type 3 fonts are often rendered uncached.
> but
> we are unable to get around the 256 limit imposed on the limit.
As noted, this is an architectural limit of type 3 fonts, you can't
address more than 256 glyphs.
> If this type3 solution does not work, is there any way to solve the
> problem? Thanks!
First you need to identify a glyph which causes the problem, and decide
whether its a single glyph too large for the printers cache or whether
its simply the font which is too big. Most likely its *not* a single
glyph, as this would simply be rendered uncached, just like a type 3
font.
Try showing a single glyph from the font, if possible make it as simple
a glyph as possible. You should find most CJKV fonts also include lating
characters which would be a good place to start.
If that works, then its probably the glyph cache, not the font cache.
Now you need to find an example fo a glyph which is too big. Presumably
you already have some jobs which fail, try removing text using a binary
chop until you find a glyph which deosn't work.
If it doesn't work, then its the font which is too big. You could use
some fo the information below to write a custom error handler which
would return the current status of the cache.
I'm guessing its the font itself which is too big for the font cache.
The size of the font cache depends totally on your printer, some will
have more memory, some less, some will set aside more memory for fonts,
and so on. Printers intended for use with CJKV fonts will usually have
more memory and a larger font cache, as tehse fonts are always larger
than Latin fonts.
Now, the caches can usually be modified using PostScript. But first you
need to know how they are currently set. The cachestatus operator is a
good place to start. Assuming you can't interrogate the back channel
from your printer, try this job:
%!PS
/Courier 20 selectfont
/Str 256 string def
cachestatus
10 10 moveto (max glyph size ) show Str cvs show
10 25 moveto (max cached glyphs ) show Str cvs show
10 50 moveto (current cached glyphs ) show Str cvs show
10 75 moveto (max font/matrix combinations ) show Str cvs show
10 100 moveto (current font/matrix combinations ) show Str cvs show
10 125 moveto (max bitmap storage ) show Str cvs show
10 150 moveto (current bitmap storage ) show Str cvs show
10 200 moveto
currentcacheparams
{
dup type /marktype eq {exit} if
Str cvs show ( ) show
} loop
pop
10 250 moveto (current cache params) show
showpage
This will give you a number of parameters which you may be able to
affect. Note the number of parameters returned by currentcacheparams
(and therefore consumed by setcacheparams) is variable. However you can
also get at least some of the same information (depending on the
language level of your printer and its conformance with Adobe standards)
by checking the MaxFontCache, MinFontCompress and MaxFontItem
system/user parameters:
%!PS
/Courier 20 selectfont
/Str 256 string def
cachestatus
10 10 moveto (max glyph size ) show Str cvs show
10 25 moveto (max cached glyphs ) show Str cvs show
10 50 moveto (current cached glyphs ) show Str cvs show
10 75 moveto (max font/matrix combinations ) show Str cvs show
10 100 moveto (current font/matrix combinations ) show Str cvs show
10 125 moveto (max bitmap storage ) show Str cvs show
10 150 moveto (current bitmap storage ) show Str cvs show
currentsystemparams /MaxFontCache known {
currentsystemparams /MaxFontCache get
10 200 moveto (MaxFontCache ) show Str cvs show
} if
currentuserparams /MinFontCompress known {
currentuserparams /MinFontCompress get
10 225 moveto (MinFontCompress ) show Str cvs show
} if
currentuserparams /MaxFontItem known {
currentuserparams /MaxFontItem get
10 250 moveto (MaxFontItem ) show Str cvs show
} if
10 300 moveto
currentcacheparams
{
dup type /marktype eq {exit} if
Str cvs show ( ) show
} loop
pop
10 325 moveto (current cache params) show
showpage
You can play with the parameters, but the most important is probably the
MaxFontCache system parameter. You may be able to get your fonts to work
if you increase this value.
eg:
<</MaxFontCache 1000000>> setsystemparams
Warnings;
Nothing is free, increasing this memory pool will decrease available
memory elsewhere, the probability of a VM error will be increased.
Its entirely possible that your printer won't let you change the font
cache settings.
Its possible that the font cache isn't the root of your problems (though
you should be able to establish this by creating simple text only jobs
to test with.
You may want to contact the manufacturer of the printers you are using
and inquire whether they have any recommendations for this situation.
Ken
Fnews-brouse 1.9(20180406) -- by Mizuno, MWE <mwe@ccsf.jp>
GnuPG Key ID = ECC8A735
GnuPG Key fingerprint = 9BE6 B9E9 55A5 A499 CD51 946E 9BDC 7870 ECC8 A735