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

Include and use the 14 standard fonts files.

This commit is contained in:
Brendan Dahl 2020-12-10 17:32:18 -08:00
parent 3456ed271b
commit 4c1dd47e65
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.
}
@ -928,7 +932,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;
@ -967,7 +971,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];
@ -1086,7 +1090,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) {