mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Overwrite glyphs contour count if it's less than -1.
The test pdf has a contour count of -70, but OTS doesn't like values less than -1. Fixes issue #7562.
This commit is contained in:
parent
56c14e27e6
commit
17037b5e51
4 changed files with 17 additions and 2 deletions
|
@ -649,6 +649,11 @@ var Font = (function FontClosure() {
|
|||
return (b0 << 8) + b1;
|
||||
}
|
||||
|
||||
function writeSignedInt16(bytes, index, value) {
|
||||
bytes[index + 1] = value;
|
||||
bytes[index] = value >>> 8;
|
||||
}
|
||||
|
||||
function signedInt16(b0, b1) {
|
||||
var value = (b0 << 8) + b1;
|
||||
return value & (1 << 15) ? value - 0x10000 : value;
|
||||
|
@ -1577,8 +1582,11 @@ var Font = (function FontClosure() {
|
|||
return glyphProfile;
|
||||
}
|
||||
var glyf = source.subarray(sourceStart, sourceEnd);
|
||||
var contoursCount = (glyf[0] << 8) | glyf[1];
|
||||
if (contoursCount & 0x8000) {
|
||||
var contoursCount = signedInt16(glyf[0], glyf[1]);
|
||||
if (contoursCount < 0) {
|
||||
// OTS doesn't like contour count to be less than -1.
|
||||
contoursCount = -1;
|
||||
writeSignedInt16(glyf, 0, contoursCount);
|
||||
// complex glyph, writing as is
|
||||
dest.set(glyf, destStart);
|
||||
glyphProfile.length = glyf.length;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue