nits, picked

This commit is contained in:
Adil Allawi 2011-07-13 17:46:48 +01:00
parent 8dbbbbb589
commit 06986bb15f
2 changed files with 9 additions and 10 deletions

View File

@ -411,7 +411,7 @@ var Font = (function() {
break; break;
} }
this.data = data; this.data = data;
this.type = properties.type; // Use the type to test if the string is single or multi-byte this.type = properties.type;
this.id = Fonts.registerFont(name, data, properties); this.id = Fonts.registerFont(name, data, properties);
this.loadedName = 'pdfFont' + this.id; this.loadedName = 'pdfFont' + this.id;
this.compositeFont = properties.compositeFont; this.compositeFont = properties.compositeFont;
@ -924,13 +924,12 @@ var Font = (function() {
// Replace the old CMAP table with a shiny new one // Replace the old CMAP table with a shiny new one
if (properties.type == 'CIDFontType2') { if (properties.type == 'CIDFontType2') {
// Type2 composite fonts map charcters directly to glyphs so the cmap // Type2 composite fonts map characters directly to glyphs so the cmap
// table must be replaced. // table must be replaced.
var glyphs = []; var glyphs = [];
var charset = properties.charset; var charset = properties.charset;
if (charset.length == 0) if (!charset.length) {
{
// PDF did not contain a GIDMap for the font so create an identity cmap // PDF did not contain a GIDMap for the font so create an identity cmap
// First get the number of glyphs from the maxp table // First get the number of glyphs from the maxp table
@ -939,16 +938,17 @@ var Font = (function() {
var numGlyphs = int16(font.getBytes(2)); var numGlyphs = int16(font.getBytes(2));
// Now create an identity mapping // Now create an identity mapping
for (var i=1; i < numGlyphs; i++) { for (var i = 1; i < numGlyphs; i++) {
glyphs.push({ glyphs.push({
unicode: i unicode: i
}); });
} }
} else { } else {
for (var i=1; i < charset.length; i++) { for (var i = 1; i < charset.length; i++) {
if (charset.indexOf(i) != -1) { var index = charset.indexOf(i);
if (index != -1) {
glyphs.push({ glyphs.push({
unicode: charset.indexOf(i) unicode: index
}); });
} else { } else {
break; break;

3
pdf.js
View File

@ -3634,8 +3634,7 @@ var PartialEvaluator = (function() {
// - get the descendant font // - get the descendant font
// - set the type according to the descendant font // - set the type according to the descendant font
// - get the FontDescriptor from the descendant font // - get the FontDescriptor from the descendant font
if (subType.name == 'Type0') if (subType.name == 'Type0') {
{
var df = fontDict.get('DescendantFonts'); var df = fontDict.get('DescendantFonts');
if (!df) if (!df)
return null; return null;