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

@ -2430,8 +2430,7 @@ class PartialEvaluator {
if (textContentItem.initialized) {
return textContentItem;
}
const font = textState.font,
loadedName = font.loadedName;
const { font, loadedName } = textState;
if (!seenStyles.has(loadedName)) {
seenStyles.add(loadedName);
@ -2544,6 +2543,7 @@ class PartialEvaluator {
});
})
.then(function (translated) {
textState.loadedName = translated.loadedName;
textState.font = translated.font;
textState.fontMatrix =
translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
@ -2877,7 +2877,7 @@ class PartialEvaluator {
width: 0,
height: 0,
transform: getCurrentTextTransform(),
fontName: textState.font.loadedName,
fontName: textState.loadedName,
hasEOL: true,
});
}
@ -4607,6 +4607,7 @@ class TextState {
this.ctm = new Float32Array(IDENTITY_MATRIX);
this.fontName = null;
this.fontSize = 0;
this.loadedName = null;
this.font = null;
this.fontMatrix = FONT_IDENTITY_MATRIX;
this.textMatrix = IDENTITY_MATRIX.slice();