@@ -396,7 +396,7 @@ def _get_image_h_w_bits_command(self, im):
396396 imagecmd = "false 3 colorimage"
397397
398398 return h , w , bits , imagecmd
399-
399+
400400 def draw_image (self , gc , x , y , im , dx = None , dy = None , transform = None ):
401401 """
402402 Draw the Image instance into the current axes; x is the
@@ -1110,6 +1110,14 @@ def write(self, *kl, **kwargs):
11101110 for c in chars :
11111111 gind = cmap .get (c ) or 0
11121112 glyph_ids .append (gind )
1113+
1114+ fonttype = rcParams ['ps.fonttype' ]
1115+
1116+ # Can not use more than 255 characters from a
1117+ # single font for Type 3
1118+ if len (glyph_ids ) > 255 :
1119+ fonttype = 42
1120+
11131121 # The ttf to ps (subsetting) support doesn't work for
11141122 # OpenType fonts that are Postscript inside (like the
11151123 # STIX fonts). This will simply turn that off to avoid
@@ -1118,7 +1126,7 @@ def write(self, *kl, **kwargs):
11181126 raise RuntimeError ("OpenType CFF fonts can not be saved using the internal Postscript backend at this time.\n Consider using the Cairo backend." )
11191127 else :
11201128 fonttype = rcParams ['ps.fonttype' ]
1121- convert_ttf_to_ps (font_filename , fh , rcParams [ 'ps. fonttype' ] , glyph_ids )
1129+ convert_ttf_to_ps (font_filename , fh , fonttype , glyph_ids )
11221130 print >> fh , "end"
11231131 print >> fh , "%%EndProlog"
11241132
@@ -1394,7 +1402,7 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None):
13941402 """
13951403
13961404 paper_option = "-sPAPERSIZE=%s" % ptype
1397-
1405+
13981406 psfile = tmpfile + '.ps'
13991407 outfile = tmpfile + '.output'
14001408 dpi = rcParams ['ps.distiller.res' ]
@@ -1436,7 +1444,7 @@ def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None):
14361444
14371445 if eps : paper_option = "-dEPSCrop"
14381446 else : paper_option = "-sPAPERSIZE=%s" % ptype
1439-
1447+
14401448 command = 'ps2pdf -dAutoFilterColorImages=false \
14411449 -sColorImageFilter=FlateEncode %s "%s" "%s" > "%s"'% \
14421450(paper_option , tmpfile , pdffile , outfile )
0 commit comments