1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Merge pull request #12726 from brendandahl/standard-fonts

[api-minor] Include and use the 14 standard font files.
This commit is contained in:
Jonas Jenwald 2021-06-08 10:09:40 +02:00 committed by GitHub
commit e7dc822e74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 463 additions and 80 deletions

View file

@ -30,6 +30,7 @@ import {
FontFlags,
getFontType,
MacStandardGlyphOrdering,
normalizeFontName,
recoverGlyphName,
SEAC_ANALYSIS_ENABLED,
} from "./fonts_utils.js";
@ -130,6 +131,9 @@ function adjustWidths(properties) {
}
function adjustToUnicode(properties, builtInEncoding) {
if (properties.isInternalFont) {
return;
}
if (properties.hasIncludedToUnicodeMap) {
return; // The font dictionary has a `ToUnicode` entry.
}
@ -932,7 +936,7 @@ class Font {
}
this.data = data;
this.fontType = getFontType(type, subtype);
this.fontType = getFontType(type, subtype, properties.isStandardFont);
// Transfer some properties again that could change during font conversion
this.fontMatrix = properties.fontMatrix;
@ -971,7 +975,7 @@ class Font {
const name = this.name;
const type = this.type;
const subtype = this.subtype;
let fontName = name.replace(/[,_]/g, "-").replace(/\s/g, "");
let fontName = normalizeFontName(name);
const stdFontMap = getStdFontMap(),
nonStdFontMap = getNonStdFontMap();
const isStandardFont = !!stdFontMap[fontName];
@ -1090,7 +1094,7 @@ class Font {
this.toFontChar = map;
}
this.loadedName = fontName.split("-")[0];
this.fontType = getFontType(type, subtype);
this.fontType = getFontType(type, subtype, properties.isStandardFont);
}
checkAndRepair(name, font, properties) {