@@ -3309,6 +3309,46 @@ describe("api", function () {
33093309 await loadingTask . destroy ( ) ;
33103310 } ) ;
33113311 } ) ;
3312+
3313+ describe ( "Fonts" , function ( ) {
3314+ it ( "set black/bold/italic properties to translated fonts" , async function ( ) {
3315+ const loadingTask = getDocument (
3316+ buildGetDocumentParams ( "translated_fonts_weight.pdf" )
3317+ ) ;
3318+ const pdfDoc = await loadingTask . promise ;
3319+ const page = await pdfDoc . getPage ( 1 ) ;
3320+ await page . getOperatorList ( ) ;
3321+
3322+ const fontsMap = Array . from ( page . commonObjs ) ;
3323+ const fonts = fontsMap . map ( entry => entry [ 1 ] ) ;
3324+
3325+ expect ( fonts [ 0 ] . black ) . toEqual ( undefined ) ;
3326+ expect ( fonts [ 0 ] . bold ) . toEqual ( undefined ) ;
3327+ expect ( fonts [ 0 ] . italic ) . toEqual ( undefined ) ;
3328+
3329+ expect ( fonts [ 1 ] . black ) . toEqual ( undefined ) ;
3330+ expect ( fonts [ 1 ] . bold ) . toEqual ( true ) ;
3331+ expect ( fonts [ 1 ] . italic ) . toEqual ( undefined ) ;
3332+
3333+ expect ( fonts [ 2 ] . black ) . toEqual ( undefined ) ;
3334+ expect ( fonts [ 2 ] . bold ) . toEqual ( undefined ) ;
3335+ expect ( fonts [ 2 ] . italic ) . toEqual ( true ) ;
3336+
3337+ expect ( fonts [ 3 ] . black ) . toEqual ( undefined ) ;
3338+ expect ( fonts [ 3 ] . bold ) . toEqual ( true ) ;
3339+ expect ( fonts [ 3 ] . italic ) . toEqual ( true ) ;
3340+
3341+ expect ( fonts [ 4 ] . black ) . toEqual ( true ) ;
3342+ expect ( fonts [ 4 ] . bold ) . toEqual ( undefined ) ;
3343+ expect ( fonts [ 4 ] . italic ) . toEqual ( undefined ) ;
3344+
3345+ expect ( fonts [ 5 ] . black ) . toEqual ( true ) ;
3346+ expect ( fonts [ 5 ] . bold ) . toEqual ( undefined ) ;
3347+ expect ( fonts [ 5 ] . italic ) . toEqual ( true ) ;
3348+
3349+ await loadingTask . destroy ( ) ;
3350+ } ) ;
3351+ } ) ;
33123352 } ) ;
33133353
33143354 describe ( "Page" , function ( ) {
0 commit comments