mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-03 04:47:21 +02:00
Compare commits
No commits in common. "ea18e73de28c89f16c7498332b3bc822348ed38c" and "25c7d9eaace0438316714aff7033dd5f4c1a542e" have entirely different histories.
ea18e73de2
...
25c7d9eaac
@ -4664,22 +4664,9 @@ class PartialEvaluator {
|
|||||||
throw new FormatError("invalid font name");
|
throw new FormatError("invalid font name");
|
||||||
}
|
}
|
||||||
|
|
||||||
let fontFile, fontFileN, subtype, length1, length2, length3;
|
let fontFile, subtype, length1, length2, length3;
|
||||||
try {
|
try {
|
||||||
fontFile = descriptor.get("FontFile");
|
fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
|
||||||
if (fontFile) {
|
|
||||||
fontFileN = 1;
|
|
||||||
} else {
|
|
||||||
fontFile = descriptor.get("FontFile2");
|
|
||||||
if (fontFile) {
|
|
||||||
fontFileN = 2;
|
|
||||||
} else {
|
|
||||||
fontFile = descriptor.get("FontFile3");
|
|
||||||
if (fontFile) {
|
|
||||||
fontFileN = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fontFile) {
|
if (fontFile) {
|
||||||
if (!(fontFile instanceof BaseStream)) {
|
if (!(fontFile instanceof BaseStream)) {
|
||||||
@ -4789,7 +4776,6 @@ class PartialEvaluator {
|
|||||||
name: fontName.name,
|
name: fontName.name,
|
||||||
subtype,
|
subtype,
|
||||||
file: fontFile,
|
file: fontFile,
|
||||||
fontFileN,
|
|
||||||
length1,
|
length1,
|
||||||
length2,
|
length2,
|
||||||
length3,
|
length3,
|
||||||
|
|||||||
@ -2682,23 +2682,10 @@ class Font {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isTrueType = !tables["CFF "];
|
const isTrueType = !tables["CFF "];
|
||||||
let parsedCff = null;
|
|
||||||
if (!isTrueType) {
|
if (!isTrueType) {
|
||||||
try {
|
|
||||||
parsedCff = new CFFParser(
|
|
||||||
new Stream(tables["CFF "].data),
|
|
||||||
properties,
|
|
||||||
SEAC_ANALYSIS_ENABLED
|
|
||||||
).parse();
|
|
||||||
} catch {
|
|
||||||
warn("Failed to parse font " + properties.loadedName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// OpenType font (skip composite fonts with non-default glyph mapping).
|
// OpenType font (skip composite fonts with non-default glyph mapping).
|
||||||
if (
|
if (
|
||||||
(header.version === "OTTO" &&
|
(header.version === "OTTO" && !properties.composite) ||
|
||||||
(!properties.composite ||
|
|
||||||
(properties.fontFileN === 3 && parsedCff?.isCIDFont))) ||
|
|
||||||
!tables.head ||
|
!tables.head ||
|
||||||
!tables.hhea ||
|
!tables.hhea ||
|
||||||
!tables.maxp ||
|
!tables.maxp ||
|
||||||
@ -2738,11 +2725,19 @@ class Font {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let numGlyphsFromCFF;
|
let numGlyphsFromCFF;
|
||||||
if (parsedCff) {
|
if (!isTrueType) {
|
||||||
try {
|
try {
|
||||||
parsedCff.duplicateFirstGlyph();
|
// Trying to repair CFF file
|
||||||
tables["CFF "].data = new CFFCompiler(parsedCff).compile();
|
const parser = new CFFParser(
|
||||||
numGlyphsFromCFF = parsedCff.charStringCount;
|
new Stream(tables["CFF "].data),
|
||||||
|
properties,
|
||||||
|
SEAC_ANALYSIS_ENABLED
|
||||||
|
);
|
||||||
|
const cff = parser.parse();
|
||||||
|
cff.duplicateFirstGlyph();
|
||||||
|
const compiler = new CFFCompiler(cff);
|
||||||
|
tables["CFF "].data = compiler.compile();
|
||||||
|
numGlyphsFromCFF = cff.charStringCount;
|
||||||
} catch {
|
} catch {
|
||||||
warn("Failed to compile font " + properties.loadedName);
|
warn("Failed to compile font " + properties.loadedName);
|
||||||
}
|
}
|
||||||
|
|||||||
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -921,4 +921,3 @@
|
|||||||
!operator_list_cycle.pdf
|
!operator_list_cycle.pdf
|
||||||
!knockout_groups_test.pdf
|
!knockout_groups_test.pdf
|
||||||
!issue18032.pdf
|
!issue18032.pdf
|
||||||
!Embedded_font.pdf
|
|
||||||
|
|||||||
Binary file not shown.
@ -14260,12 +14260,5 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq",
|
"type": "eq",
|
||||||
"about": "Non-isolated knockout group with a nested non-isolated subgroup over existing text."
|
"about": "Non-isolated knockout group with a nested non-isolated subgroup over existing text."
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "Embedded_font.pdf",
|
|
||||||
"file": "pdfs/Embedded_font.pdf",
|
|
||||||
"md5": "b68dd5a3e6833d1af94e295fe1d60285",
|
|
||||||
"rounds": 1,
|
|
||||||
"type": "eq"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user