mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Next try for windows
This commit is contained in:
parent
61da963dae
commit
0783f3a896
1 changed files with 23 additions and 13 deletions
36
fonts.js
36
fonts.js
|
@ -189,7 +189,7 @@ var Font = (function () {
|
||||||
return String.fromCharCode(byte ^ 0xff) +
|
return String.fromCharCode(byte ^ 0xff) +
|
||||||
String.fromCharCode(value & 0xff);
|
String.fromCharCode(value & 0xff);
|
||||||
} else if (signed) {
|
} else if (signed) {
|
||||||
return String.fromCharCode((value >> 7) & 0xff) +
|
return String.fromCharCode((value >> 8) & 0xff) +
|
||||||
String.fromCharCode(value & 0xff);
|
String.fromCharCode(value & 0xff);
|
||||||
}
|
}
|
||||||
return String.fromCharCode((value >> 8) & 0xff) +
|
return String.fromCharCode((value >> 8) & 0xff) +
|
||||||
|
@ -741,8 +741,13 @@ var Font = (function () {
|
||||||
*/
|
*/
|
||||||
hmtx = "\x01\xF4\x00\x00"; // Fake .notdef
|
hmtx = "\x01\xF4\x00\x00"; // Fake .notdef
|
||||||
var width = 0, lsb = 0;
|
var width = 0, lsb = 0;
|
||||||
for (var i = 0; i < charstrings.length; i++)
|
for (var i = 0; i < charstrings.length; i++) {
|
||||||
hmtx += string16(charstrings[i].width) + string16(charstrings[i].lsb);
|
var charstring = charstrings[i];
|
||||||
|
if (fontCount == 1) {
|
||||||
|
log(charstring.width + "::" + charstring.lsb);
|
||||||
|
}
|
||||||
|
hmtx += string16(charstring.width) + string16(charstring.lsb, true);
|
||||||
|
}
|
||||||
hmtx = stringToArray(hmtx);
|
hmtx = stringToArray(hmtx);
|
||||||
createTableEntry(otf, offsets, "hmtx", hmtx);
|
createTableEntry(otf, offsets, "hmtx", hmtx);
|
||||||
|
|
||||||
|
@ -1010,12 +1015,12 @@ var Type1Parser = function() {
|
||||||
|
|
||||||
var kEscapeCommand = 12;
|
var kEscapeCommand = 12;
|
||||||
|
|
||||||
function decodeCharString(array) {
|
function decodeCharString(array, glyph) {
|
||||||
var charstring = [];
|
var charstring = [];
|
||||||
var lsb = 0;
|
var lsb = 0;
|
||||||
var width = 0;
|
var width = 0;
|
||||||
|
var used = false;
|
||||||
|
|
||||||
var z = 0;
|
|
||||||
var value = "";
|
var value = "";
|
||||||
var count = array.length;
|
var count = array.length;
|
||||||
for (var i = 0; i < count; i++) {
|
for (var i = 0; i < count; i++) {
|
||||||
|
@ -1056,24 +1061,26 @@ var Type1Parser = function() {
|
||||||
if (value == 13) {
|
if (value == 13) {
|
||||||
width = charstring[1];
|
width = charstring[1];
|
||||||
lsb = charstring[0];
|
lsb = charstring[0];
|
||||||
//charstring.push(lsb, "hmoveto");
|
charstring.push(lsb, "hmoveto");
|
||||||
charstring.splice(0, 1);
|
charstring.splice(0, 1);
|
||||||
|
used = true;
|
||||||
continue;
|
continue;
|
||||||
} else if (0 && lsb && value == 1) { // hstem
|
} else if (!used && lsb && value == 1) { // hstem
|
||||||
charstring[Gindex] += lsb;
|
charstring[Gindex] += lsb;
|
||||||
lsb = 0;
|
used = true;
|
||||||
} else if (0 && lsb && value == 22) { // hmoveto
|
} else if (!used && lsb && value == 22) { // hmoveto
|
||||||
error("hmoveto: " + charstring[Gindex]);
|
error("hmoveto: " + charstring[Gindex]);
|
||||||
charstring[Gindex] += lsb;
|
charstring[Gindex] += lsb;
|
||||||
lsb = 0;
|
used = true;
|
||||||
} else if (0 && lsb && value == 14) { // enchar
|
} else if (!used && lsb && value == 14) { // enchar
|
||||||
|
log(glyph);
|
||||||
var p = charstring[Gindex];
|
var p = charstring[Gindex];
|
||||||
if (IsNum(p)) {
|
if (IsNum(p)) {
|
||||||
charstring[Gindex] += lsb;
|
charstring[Gindex] += lsb;
|
||||||
} else {
|
} else {
|
||||||
charstring.splice(Gindex + 1, 0, lsb);
|
charstring.splice(Gindex + 1, 0, lsb);
|
||||||
}
|
}
|
||||||
lsb = 0;
|
used = true;
|
||||||
}
|
}
|
||||||
var Gindex = charstring.length;
|
var Gindex = charstring.length;
|
||||||
|
|
||||||
|
@ -1105,6 +1112,9 @@ var Type1Parser = function() {
|
||||||
charstring.push(value);
|
charstring.push(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!used && lsb)
|
||||||
|
error("lsb has not been reported in " + fontName + " for charstring: " + charstring);
|
||||||
|
|
||||||
return { charstring: charstring, width: width, lsb: lsb };
|
return { charstring: charstring, width: width, lsb: lsb };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1140,7 +1150,7 @@ var Type1Parser = function() {
|
||||||
length = parseInt(length);
|
length = parseInt(length);
|
||||||
var data = eexecString.slice(i + 3, i + 3 + length);
|
var data = eexecString.slice(i + 3, i + 3 + length);
|
||||||
var encodedCharstring = decrypt(data, kCharStringsEncryptionKey, 4);
|
var encodedCharstring = decrypt(data, kCharStringsEncryptionKey, 4);
|
||||||
var str = decodeCharString(encodedCharstring);
|
var str = decodeCharString(encodedCharstring, glyph);
|
||||||
|
|
||||||
glyphs.push({
|
glyphs.push({
|
||||||
glyph: glyph,
|
glyph: glyph,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue