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

Merge pull request #9938 from Snuffleupagus/issue-9915

Ensure that Type0, i.e. composite, OpenType fonts with `CFF ` tables are *not* treated as CFF fonts if their glyph mapping is non-default (issue 9915)
This commit is contained in:
Tim van der Meij 2018-08-02 00:11:18 +02:00 committed by GitHub
commit 716acf63d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 7 deletions

View file

@ -16,8 +16,8 @@
import {
AbortException, assert, CMapCompressionType, createPromiseCapability,
FONT_IDENTITY_MATRIX, FormatError, getLookupTableFactory, IDENTITY_MATRIX,
info, isNum, isString, NativeImageDecoding, OPS, TextRenderingMode,
UNSUPPORTED_FEATURES, Util, warn
info, isNum, isString, NativeImageDecoding, OPS, stringToPDFString,
TextRenderingMode, UNSUPPORTED_FEATURES, Util, warn
} from '../shared/util';
import { CMapFactory, IdentityCMap } from './cmap';
import { DecodeStream, Stream } from './stream';
@ -1871,8 +1871,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var cidSystemInfo = dict.get('CIDSystemInfo');
if (isDict(cidSystemInfo)) {
properties.cidSystemInfo = {
registry: cidSystemInfo.get('Registry'),
ordering: cidSystemInfo.get('Ordering'),
registry: stringToPDFString(cidSystemInfo.get('Registry')),
ordering: stringToPDFString(cidSystemInfo.get('Ordering')),
supplement: cidSystemInfo.get('Supplement'),
};
}

View file

@ -35,6 +35,7 @@ import {
getUnicodeForGlyph, getUnicodeRangeFor, mapSpecialUnicodeValues
} from './unicode';
import { FontRendererFactory } from './font_renderer';
import { IdentityCMap } from './cmap';
import { Stream } from './stream';
import { Type1Parser } from './type1_parser';
@ -2308,9 +2309,11 @@ var Font = (function FontClosure() {
var isTrueType = !tables['CFF '];
if (!isTrueType) {
// OpenType font (skip composite fonts with non-default CID to GID map).
if ((header.version === 'OTTO' &&
!(properties.composite && properties.cidToGidMap)) ||
const isComposite = properties.composite &&
((properties.cidToGidMap || []).length > 0 ||
!(properties.cMap instanceof IdentityCMap));
// OpenType font (skip composite fonts with non-default glyph mapping).
if ((header.version === 'OTTO' && !isComposite) ||
!tables['head'] || !tables['hhea'] || !tables['maxp'] ||
!tables['post']) {
// No major tables: throwing everything at `CFFFont`.