mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Merge branch 'master' of github.com:mozilla/pdf.js into fallback-ui
Conflicts: extensions/firefox/components/PdfStreamConverter.js
This commit is contained in:
commit
2da12930a6
43 changed files with 1052 additions and 179 deletions
29
src/fonts.js
29
src/fonts.js
|
@ -1976,9 +1976,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;
|
||||
|
@ -3477,7 +3477,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 {
|
||||
|
@ -3568,7 +3568,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;
|
||||
|
@ -3623,6 +3623,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() {
|
||||
|
@ -4221,9 +4236,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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue