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

merge upstream

This commit is contained in:
Artur Adib 2012-05-29 11:54:11 -04:00
commit 9597efb3f4
48 changed files with 1194 additions and 230 deletions

View file

@ -2706,9 +2706,9 @@ var Font = (function FontClosure() {
this.isSymbolicFont = false;
}
// heuristics: if removed more than 2 glyphs encoding WinAnsiEncoding
// does not set properly
if (glyphsRemoved > 2) {
// heuristics: if removed more than 10 glyphs encoding WinAnsiEncoding
// does not set properly (broken PDFs have about 100 removed glyphs)
if (glyphsRemoved > 10) {
warn('Switching TrueType encoding to MacRomanEncoding for ' +
this.name + ' font');
encoding = Encodings.MacRomanEncoding;
@ -4208,7 +4208,7 @@ var CFFFont = (function CFFFontClosure() {
this.properties = properties;
var parser = new CFFParser(file, properties);
var cff = parser.parse();
var cff = parser.parse(true);
var compiler = new CFFCompiler(cff);
this.readExtra(cff);
try {
@ -4299,7 +4299,7 @@ var CFFParser = (function CFFParserClosure() {
this.properties = properties;
}
CFFParser.prototype = {
parse: function CFFParser_parse() {
parse: function CFFParser_parse(normalizeCIDData) {
var properties = this.properties;
var cff = new CFF();
this.cff = cff;
@ -4354,6 +4354,21 @@ var CFFParser = (function CFFParserClosure() {
cff.charset = charset;
cff.encoding = encoding;
if (!cff.isCIDFont || !normalizeCIDData)
return cff;
// DirectWrite does not like CID fonts data. Trying to convert/flatten
// the font data and remove CID properties.
if (cff.fdArray.length !== 1)
error('Unable to normalize CID font in CFF data');
var fontDict = cff.fdArray[0];
fontDict.setByKey(17, topDict.getByName('CharStrings'));
cff.topDict = fontDict;
cff.isCIDFont = false;
delete cff.fdArray;
delete cff.fdSelect;
return cff;
},
parseHeader: function CFFParser_parseHeader() {
@ -4364,7 +4379,7 @@ var CFFParser = (function CFFParserClosure() {
++offset;
if (offset != 0) {
warn('cff data is shifted');
info('cff data is shifted');
bytes = bytes.subarray(offset);
this.bytes = bytes;
}
@ -4952,9 +4967,9 @@ var CFFPrivateDict = (function CFFPrivateDictClosure() {
[[12, 17], 'LanguageGroup', 'num', 0],
[[12, 18], 'ExpansionFactor', 'num', 0.06],
[[12, 19], 'initialRandomSeed', 'num', 0],
[19, 'Subrs', 'offset', null],
[20, 'defaultWidthX', 'num', 0],
[21, 'nominalWidthX', 'num', 0]
[21, 'nominalWidthX', 'num', 0],
[19, 'Subrs', 'offset', null]
];
var tables = null;
function CFFPrivateDict(strings) {