@@ -4313,12 +4313,9 @@ class PartialEvaluator {
4313
4313
4314
4314
if ( ! descriptor ) {
4315
4315
if ( isType3Font ) {
4316
- const bbox = lookupNormalRect ( dict . getArray ( "FontBBox" ) , [ 0 , 0 , 0 , 0 ] ) ;
4317
4316
// FontDescriptor is only required for Type3 fonts when the document
4318
- // is a tagged pdf. Create a barbebones one to get by.
4319
- descriptor = new Dict ( null ) ;
4320
- descriptor . set ( "FontName" , Name . get ( type ) ) ;
4321
- descriptor . set ( "FontBBox" , bbox ) ;
4317
+ // is a tagged pdf.
4318
+ descriptor = Dict . empty ;
4322
4319
} else {
4323
4320
// Before PDF 1.5 if the font was one of the base 14 fonts, having a
4324
4321
// FontDescriptor was not required.
@@ -4422,8 +4419,8 @@ class PartialEvaluator {
4422
4419
const baseFontStr = baseFont ?. name ;
4423
4420
if ( isType3Font ) {
4424
4421
if ( ! fontNameStr ) {
4425
- // The Type3 font has a /FontDescriptor, however it's incomplete, hence
4426
- // why we didn't create a barbebones one above (fixes issue19954.pdf).
4422
+ // Since the /FontDescriptor is optional in Type3 fonts, ensure that we
4423
+ // always have a "valid" /FontName (fixes issue19954.pdf).
4427
4424
fontName = Name . get ( type ) ;
4428
4425
}
4429
4426
} else if ( fontNameStr !== baseFontStr ) {
@@ -4444,8 +4441,8 @@ class PartialEvaluator {
4444
4441
) {
4445
4442
fontName = null ;
4446
4443
}
4444
+ fontName ||= baseFont ;
4447
4445
}
4448
- fontName ||= baseFont ;
4449
4446
4450
4447
if ( ! ( fontName instanceof Name ) ) {
4451
4448
throw new FormatError ( "invalid font name" ) ;
@@ -4523,7 +4520,7 @@ class PartialEvaluator {
4523
4520
) ;
4524
4521
const bbox = lookupNormalRect (
4525
4522
descriptor . getArray ( "FontBBox" ) || dict . getArray ( "FontBBox" ) ,
4526
- undefined
4523
+ isType3Font ? [ 0 , 0 , 0 , 0 ] : undefined
4527
4524
) ;
4528
4525
let ascent = descriptor . get ( "Ascent" ) ;
4529
4526
if ( typeof ascent !== "number" ) {
@@ -4711,9 +4708,9 @@ class TranslatedFont {
4711
4708
const fontResources = this . dict . get ( "Resources" ) || resources ;
4712
4709
const charProcOperatorList = Object . create ( null ) ;
4713
4710
4714
- const fontBBox = Util . normalizeRect ( font . bbox || [ 0 , 0 , 0 , 0 ] ) ,
4715
- width = fontBBox [ 2 ] - fontBBox [ 0 ] ,
4716
- height = fontBBox [ 3 ] - fontBBox [ 1 ] ;
4711
+ const [ x0 , y0 , x1 , y1 ] = font . bbox ,
4712
+ width = x1 - x0 ,
4713
+ height = y1 - y0 ;
4717
4714
const fontBBoxSize = Math . hypot ( width , height ) ;
4718
4715
4719
4716
for ( const key of charProcs . getKeys ( ) ) {
0 commit comments