File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
kernel/src/main/java/com/itextpdf/kernel/font Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -48,11 +48,15 @@ public class PdfType3Font extends PdfSimpleFont<Type3FontProgram> {
48
48
embedded = true ;
49
49
fontProgram = new Type3FontProgram (false );
50
50
fontEncoding = DocFontEncoding .createDocFontEncoding (fontDictionary .get (PdfName .Encoding ), null , false );
51
- Rectangle fontBBoxRec = getPdfObject ().getAsArray (PdfName .FontBBox ).toRectangle ();
52
51
PdfDictionary charProcsDic = getPdfObject ().getAsDictionary (PdfName .CharProcs );
53
52
PdfArray fontMatrixArray = getPdfObject ().getAsArray (PdfName .FontMatrix );
54
- fontProgram .getFontMetrics ().setBbox ((int ) fontBBoxRec .getLeft (), (int ) fontBBoxRec .getBottom (),
55
- (int ) fontBBoxRec .getRight (), (int ) fontBBoxRec .getTop ());
53
+ if (getPdfObject ().containsKey (PdfName .FontBBox )) {
54
+ PdfArray fontBBox = getPdfObject ().getAsArray (PdfName .FontBBox );
55
+ fontProgram .getFontMetrics ().setBbox (fontBBox .getAsInt (0 ), fontBBox .getAsInt (1 ),
56
+ fontBBox .getAsInt (2 ), fontBBox .getAsInt (3 ));
57
+ } else {
58
+ fontProgram .getFontMetrics ().setBbox (0 , 0 , 0 , 0 );
59
+ }
56
60
PdfNumber firstCharNumber = fontDictionary .getAsNumber (PdfName .FirstChar );
57
61
int firstChar = firstCharNumber != null ? Math .max (firstCharNumber .getIntValue (), 0 ) : 0 ;
58
62
int [] widths = FontUtils .convertSimpleWidthsArray (fontDictionary .getAsArray (PdfName .Widths ), firstChar );
You can’t perform that action at this time.
0 commit comments