Merge pull request #435 from vingtetun/master
Fix for #427 and nit of #422
This commit is contained in:
commit
89440ebef9
25
fonts.js
25
fonts.js
@ -9,6 +9,10 @@ var isWorker = (typeof window == 'undefined');
|
|||||||
*/
|
*/
|
||||||
var kMaxWaitForFontFace = 1000;
|
var kMaxWaitForFontFace = 1000;
|
||||||
|
|
||||||
|
// Unicode Private Use Area
|
||||||
|
var kCmapGlyphOffset = 0xE000;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hold a map of decoded fonts and of the standard fourteen Type1
|
* Hold a map of decoded fonts and of the standard fourteen Type1
|
||||||
* fonts and their acronyms.
|
* fonts and their acronyms.
|
||||||
@ -797,9 +801,6 @@ var Font = (function Font() {
|
|||||||
encoding: null,
|
encoding: null,
|
||||||
|
|
||||||
checkAndRepair: function font_checkAndRepair(name, font, properties) {
|
checkAndRepair: function font_checkAndRepair(name, font, properties) {
|
||||||
// offset glyphs to the Unicode Private Use Area
|
|
||||||
var kCmapGlyphOffset = 0xE000;
|
|
||||||
|
|
||||||
function readTableEntry(file) {
|
function readTableEntry(file) {
|
||||||
var tag = file.getBytes(4);
|
var tag = file.getBytes(4);
|
||||||
tag = String.fromCharCode(tag[0]) +
|
tag = String.fromCharCode(tag[0]) +
|
||||||
@ -879,16 +880,23 @@ var Font = (function Font() {
|
|||||||
var index = font.getByte();
|
var index = font.getByte();
|
||||||
if (index) {
|
if (index) {
|
||||||
deltas.push(index);
|
deltas.push(index);
|
||||||
glyphs.push({ unicode: j });
|
|
||||||
|
var code = encoding[index];
|
||||||
|
for (var glyph in properties.glyphs) {
|
||||||
|
if (properties.glyphs[glyph] == code)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
glyphs.push({ glyph: glyph, unicode: j });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties.firstChar < 0x20) {
|
if (properties.firstChar < 0x20) {
|
||||||
var code = 0;
|
|
||||||
for (var j = 0; j < glyphs.length; j++) {
|
for (var j = 0; j < glyphs.length; j++) {
|
||||||
var glyph = glyphs[j];
|
var glyph = glyphs[j];
|
||||||
glyphs[j].unicode += 0x1F;
|
var code = glyph.unicode + kCmapGlyphOffset;
|
||||||
properties.glyphs[glyph.glyph] = encoding[++code] = glyph.unicode;
|
properties.glyphs[glyph.glyph] = encoding[glyph.unicode] = code;
|
||||||
|
glyph.unicode = code;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1458,7 +1466,7 @@ var Type1Parser = function() {
|
|||||||
charstring.push('drop');
|
charstring.push('drop');
|
||||||
|
|
||||||
// If the flex mechanism is not used in a font program, Adobe
|
// If the flex mechanism is not used in a font program, Adobe
|
||||||
// state that that entries 0, 1 and 2 can simply be replace by
|
// states that entries 0, 1 and 2 can simply be replaced by
|
||||||
// {}, which means that we can simply ignore them.
|
// {}, which means that we can simply ignore them.
|
||||||
if (index < 3) {
|
if (index < 3) {
|
||||||
continue;
|
continue;
|
||||||
@ -2235,7 +2243,6 @@ var Type2CFF = (function() {
|
|||||||
var nominalWidth = privDict['nominalWidthX'];
|
var nominalWidth = privDict['nominalWidthX'];
|
||||||
|
|
||||||
var charstrings = [];
|
var charstrings = [];
|
||||||
var kCmapGlyphOffset = 0xE000;
|
|
||||||
var differences = properties.differences;
|
var differences = properties.differences;
|
||||||
var index = 0;
|
var index = 0;
|
||||||
for (var i = 1; i < charsets.length; i++) {
|
for (var i = 1; i < charsets.length; i++) {
|
||||||
|
1
pdf.js
1
pdf.js
@ -4304,7 +4304,6 @@ var PartialEvaluator = (function() {
|
|||||||
var index = GlyphsUnicode[glyph] || i;
|
var index = GlyphsUnicode[glyph] || i;
|
||||||
glyphsMap[glyph] = encodingMap[i] = index;
|
glyphsMap[glyph] = encodingMap[i] = index;
|
||||||
|
|
||||||
var kCmapGlyphOffset = 0xE000;
|
|
||||||
if (index <= 0x1f || (index >= 127 && index <= 255))
|
if (index <= 0x1f || (index >= 127 && index <= 255))
|
||||||
glyphsMap[glyph] = encodingMap[i] += kCmapGlyphOffset;
|
glyphsMap[glyph] = encodingMap[i] += kCmapGlyphOffset;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user