Fix another seac regression (issue 4801)
This commit is contained in:
parent
faa9020119
commit
f13c217b25
@ -4110,18 +4110,28 @@ var Font = (function FontClosure() {
|
|||||||
this.toFontChar = newMapping.toFontChar;
|
this.toFontChar = newMapping.toFontChar;
|
||||||
var numGlyphs = font.numGlyphs;
|
var numGlyphs = font.numGlyphs;
|
||||||
|
|
||||||
function getCharCode(charCodeToGlyphId, glyphId, addMap) {
|
function getCharCodes(charCodeToGlyphId, glyphId) {
|
||||||
|
var charCodes = null;
|
||||||
|
for (var charCode in charCodeToGlyphId) {
|
||||||
|
if (glyphId === charCodeToGlyphId[charCode]) {
|
||||||
|
if (!charCodes) {
|
||||||
|
charCodes = [];
|
||||||
|
}
|
||||||
|
charCodes.push(charCode | 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return charCodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createCharCode(charCodeToGlyphId, glyphId) {
|
||||||
for (var charCode in charCodeToGlyphId) {
|
for (var charCode in charCodeToGlyphId) {
|
||||||
if (glyphId === charCodeToGlyphId[charCode]) {
|
if (glyphId === charCodeToGlyphId[charCode]) {
|
||||||
return charCode | 0;
|
return charCode | 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (addMap) {
|
newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] =
|
||||||
newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] =
|
glyphId;
|
||||||
glyphId;
|
return newMapping.nextAvailableFontCharCode++;
|
||||||
return newMapping.nextAvailableFontCharCode++;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var seacs = font.seacs;
|
var seacs = font.seacs;
|
||||||
@ -4144,24 +4154,27 @@ var Font = (function FontClosure() {
|
|||||||
y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
|
y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
|
||||||
};
|
};
|
||||||
|
|
||||||
var charCode = getCharCode(mapping, glyphId);
|
var charCodes = getCharCodes(mapping, glyphId);
|
||||||
if (charCode === null) {
|
if (!charCodes) {
|
||||||
// There's no point in mapping it if the char code was never mapped
|
// There's no point in mapping it if the char code was never mapped
|
||||||
// to begin with.
|
// to begin with.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Find a fontCharCode that maps to the base and accent glyphs. If one
|
for (var i = 0, ii = charCodes.length; i < ii; i++) {
|
||||||
// doesn't exists, create it.
|
var charCode = charCodes[i];
|
||||||
var charCodeToGlyphId = newMapping.charCodeToGlyphId;
|
// Find a fontCharCode that maps to the base and accent glyphs.
|
||||||
var baseFontCharCode = getCharCode(charCodeToGlyphId, baseGlyphId,
|
// If one doesn't exists, create it.
|
||||||
true);
|
var charCodeToGlyphId = newMapping.charCodeToGlyphId;
|
||||||
var accentFontCharCode = getCharCode(charCodeToGlyphId, accentGlyphId,
|
var baseFontCharCode = createCharCode(charCodeToGlyphId,
|
||||||
true);
|
baseGlyphId);
|
||||||
seacMap[charCode] = {
|
var accentFontCharCode = createCharCode(charCodeToGlyphId,
|
||||||
baseFontCharCode: baseFontCharCode,
|
accentGlyphId);
|
||||||
accentFontCharCode: accentFontCharCode,
|
seacMap[charCode] = {
|
||||||
accentOffset: accentOffset
|
baseFontCharCode: baseFontCharCode,
|
||||||
};
|
accentFontCharCode: accentFontCharCode,
|
||||||
|
accentOffset: accentOffset
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
properties.seacMap = seacMap;
|
properties.seacMap = seacMap;
|
||||||
}
|
}
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -81,3 +81,4 @@
|
|||||||
!issue4246.pdf
|
!issue4246.pdf
|
||||||
!issue4461.pdf
|
!issue4461.pdf
|
||||||
!issue4573.pdf
|
!issue4573.pdf
|
||||||
|
!issue4801.pdf
|
||||||
|
BIN
test/pdfs/issue4801.pdf
Normal file
BIN
test/pdfs/issue4801.pdf
Normal file
Binary file not shown.
@ -547,6 +547,13 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue4801",
|
||||||
|
"file": "pdfs/issue4801.pdf",
|
||||||
|
"md5": "7f32764717447a8b5c8eac08c9ab8380",
|
||||||
|
"link": false,
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "glyph_accent",
|
{ "id": "glyph_accent",
|
||||||
"file": "pdfs/glyph_accent.pdf",
|
"file": "pdfs/glyph_accent.pdf",
|
||||||
"md5": "1526e4edaa3ec439ebf156d0a0b385aa",
|
"md5": "1526e4edaa3ec439ebf156d0a0b385aa",
|
||||||
|
Loading…
Reference in New Issue
Block a user