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

Merge pull request #15659 from sxyuan/system-font-name-fix

[api-minor] Propagate the translated font name to TextContentItem for system fonts
This commit is contained in:
Jonas Jenwald 2022-11-08 21:56:49 +01:00 committed by GitHub
commit f7449563ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -2425,8 +2425,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);
@ -2539,6 +2538,7 @@ class PartialEvaluator {
});
})
.then(function (translated) {
textState.loadedName = translated.loadedName;
textState.font = translated.font;
textState.fontMatrix =
translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
@ -2872,7 +2872,7 @@ class PartialEvaluator {
width: 0,
height: 0,
transform: getCurrentTextTransform(),
fontName: textState.font.loadedName,
fontName: textState.loadedName,
hasEOL: true,
});
}
@ -4602,6 +4602,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();