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

Fallback in readCmapTable, instead of using error, for TrueType fonts with unsupported cmap formats (bug 1200096)

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1200096.

The problematic font has a `format 2` cmap, which we've never supported properly. Prior to PR 2606, we were able to fallback to a working state, despite not having proper support for that cmap format.

Obviously the best/correct solution would be to implement actual support for more cmap formats[1]. However, I'm hoping that a simple patch will be OK for now, given that:
 - `format 2` cmaps seem to be quite rare in practice, since this has been broken for 2.5 years before anyone noticed.
 - Having a simple patch will make potential uplifts a lot easier.

[1] See the specification at https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6cmap.html
This commit is contained in:
Jonas Jenwald 2015-09-01 13:31:02 +02:00
parent 0020f33873
commit 0fb31a4a9e
4 changed files with 15 additions and 1 deletions

View file

@ -3390,7 +3390,13 @@ var Font = (function FontClosure() {
});
}
} else {
error('cmap table has unsupported format: ' + format);
warn('cmap table has unsupported format: ' + format);
return {
platformId: -1,
encodingId: -1,
mappings: [],
hasShortCmap: false
};
}
// removing duplicate entries