1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Propagate the translated font name to TextContentItems.

This allows font data for system fonts to be looked up in the
PDFObjects.
This commit is contained in:
Samuel Yuan 2022-11-03 16:19:23 -07:00
parent eda51d1dcc
commit 36fb5c1e2b
2 changed files with 10 additions and 4 deletions

View file

@ -2244,7 +2244,7 @@ page 1 / 3`);
const pdfPage = await pdfDoc.getPage(1);
const { items, styles } = await pdfPage.getTextContent();
expect(items.length).toEqual(1);
// Font name will a random object id.
// Font name will be a random object id.
const fontName = items[0].fontName;
expect(Object.keys(styles)).toEqual([fontName]);
@ -2266,6 +2266,11 @@ page 1 / 3`);
vertical: false,
});
// Wait for font data to be loaded so we can check that the font names
// match.
await pdfPage.getOperatorList();
expect(pdfPage.commonObjs.has(fontName)).toEqual(true);
await loadingTask.destroy();
});