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

Correctly detect OpenType font files with CFF data

Fixes 5334.
Fixes 215.
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1125614.

According to the specification, http://www.microsoft.com/typography/otspec/otff.htm, OpenType font files with CFF data should have `OTTO` in the header.
This commit is contained in:
Jonas Jenwald 2015-02-28 12:58:53 +01:00
parent 00ee6bd6b6
commit f81fc9091a
4 changed files with 10 additions and 3 deletions

View file

@ -2572,8 +2572,6 @@ var Font = (function FontClosure() {
if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
type = 'CIDFontType0';
}
// XXX: Temporarily change the type for open type so we trigger a warning.
// This should be removed when we add support for open type.
if (subtype === 'OpenType') {
type = 'OpenType';
}
@ -3980,7 +3978,8 @@ var Font = (function FontClosure() {
var isTrueType = !tables['CFF '];
if (!isTrueType) {
// OpenType font
if (!tables.head || !tables.hhea || !tables.maxp || !tables.post) {
if (header.version === 'OTTO' ||
!tables.head || !tables.hhea || !tables.maxp || !tables.post) {
// no major tables: throwing everything at CFFFont
cffFile = new Stream(tables['CFF '].data);
cff = new CFFFont(cffFile, properties);