Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/core/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,7 @@ class ExtendedCatalog extends Catalog {
let actualFont = fontObj;
let cidFontType = null;
let normalizedSubtype = null;
let descendantRef = null;
let baseFont = null;
let cidBaseFont = null;
let encoding = null;
Expand All @@ -2078,7 +2079,7 @@ class ExtendedCatalog extends Catalog {

if (Array.isArray(descendantFonts) && descendantFonts.length > 0) {
const cidFont = this.xref.fetchIfRef(descendantFonts[0]);

descendantRef = descendantFonts[0];
if (cidFont instanceof Dict) {
actualFont = cidFont;

Expand Down Expand Up @@ -2135,6 +2136,7 @@ class ExtendedCatalog extends Catalog {
return {
cidFontType,
normalizedSubtype,
descendantRef,
baseFont,
cidBaseFont,
encoding,
Expand All @@ -2148,6 +2150,7 @@ class ExtendedCatalog extends Catalog {
return {
cidFontType: null,
normalizedSubtype: null,
descendantRef: null,
baseFont: null,
cidBaseFont: null,
encoding: null,
Expand Down Expand Up @@ -2200,6 +2203,7 @@ class ExtendedCatalog extends Catalog {
const {
cidFontType,
normalizedSubtype,
descendantRef,
baseFont,
encoding,
isComposite,
Expand All @@ -2218,23 +2222,32 @@ class ExtendedCatalog extends Catalog {
if (seenFonts.has(fontIdentity)) {
const existing = seenFonts.get(fontIdentity);
if (
!existing.refs.some(
!fontRef || !existing.refs.some(
r =>
r &&
fontRef &&
r.num === fontRef.num &&
r.gen === fontRef.gen
)
) {
existing.refs.push(fontRef);
}
if (
descendantRef && !existing.descendantRefs.some(
r =>
r.num === descendantRef.num &&
r.gen === descendantRef.gen
)
) {
existing.descendantRefs.push(descendantRef);
}
existing.names[pageIndex] = fontName;
continue;
}

const fontInfo = {
names: { [pageIndex]: fontName },
refs: [fontRef instanceof Ref ? fontRef : null],
descendantRefs: descendantRef instanceof Ref ? [descendantRef] : [],
type: isComposite ? "Type0" : normalizedSubtype,
subtype: normalizedSubtype,
cidFontType,
Expand Down
Loading