@@ -508,6 +508,7 @@ def embedTTFType3(font, characters, descriptor):
508508 charprocsObject = self .reserveObject ('character procs' )
509509 differencesArray = []
510510 firstchar , lastchar = 0 , 255
511+ bbox = [cvt (x , nearest = False ) for x in font .bbox ]
511512
512513 fontdict = {
513514 'Type' : Name ('Font' ),
@@ -517,7 +518,7 @@ def embedTTFType3(font, characters, descriptor):
517518 'FontDescriptor' : fontdescObject ,
518519 'Subtype' : Name ('Type3' ),
519520 'Name' : descriptor ['FontName' ],
520- 'FontBBox' : [ cvt ( x , nearest = False ) for x in font . bbox ] ,
521+ 'FontBBox' : bbox ,
521522 'FontMatrix' : [ .001 , 0 , 0 , .001 , 0 , 0 ],
522523 'CharProcs' : charprocsObject ,
523524 'Encoding' : {
@@ -575,15 +576,18 @@ def get_char_width(charcode):
575576 charprocs = {}
576577 charprocsRef = {}
577578 for charname , stream in rawcharprocs .items ():
579+ charprocDict = { 'Length' : len (stream ) }
580+ # The 2-byte characters are used as XObjects, so they
581+ # need extra info in their dictionary
582+ if charname in two_byte_chars :
583+ charprocDict ['Type' ] = Name ('XObject' )
584+ charprocDict ['Subtype' ] = Name ('Form' )
585+ charprocDict ['BBox' ] = bbox
578586 charprocObject = self .reserveObject ('charProc for %s' % name )
579- self .beginStream (charprocObject .id ,
580- None ,
581- {'Length' : len (stream ),
582- 'Type' : Name ('XObject' ),
583- 'Subtype' : Name ('Form' ),
584- 'BBox' : [cvt (x , nearest = False ) for x in font .bbox ]})
587+ self .beginStream (charprocObject .id , None , charprocDict )
585588 self .currentstream .write (stream )
586589 self .endStream ()
590+
587591 # Send the glyphs with ccode > 255 to the XObject dictionary,
588592 # and the others to the font itself
589593 if charname in two_byte_chars :
0 commit comments