cleanup
This commit is contained in:
parent
5f133a8c07
commit
173c68ef86
21
fonts.js
21
fonts.js
@ -394,7 +394,7 @@ var Font = (function() {
|
|||||||
|
|
||||||
var subtype = file.dict.get('Subtype');
|
var subtype = file.dict.get('Subtype');
|
||||||
if (subtype && subtype.name === 'Type1C') {
|
if (subtype && subtype.name === 'Type1C') {
|
||||||
var cff = new ActualCFF(file);
|
var cff = new Type2CFF(file);
|
||||||
} else {
|
} else {
|
||||||
var cff = new CFF(name, file, properties);
|
var cff = new CFF(name, file, properties);
|
||||||
}
|
}
|
||||||
@ -416,13 +416,6 @@ var Font = (function() {
|
|||||||
warn('Font ' + properties.type + ' is not supported');
|
warn('Font ' + properties.type + ' is not supported');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
file.reset();
|
|
||||||
var bytes = file.getBytes();
|
|
||||||
var fileArr = [];
|
|
||||||
for (var i = 0, ii = bytes.length; i < ii; ++i)
|
|
||||||
fileArr.push(bytes[i]);
|
|
||||||
writeToFile(data, '/tmp/' + name);
|
|
||||||
writeToFile(fileArr, '/tmp/' + name + 'file');
|
|
||||||
|
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.type = properties.type;
|
this.type = properties.type;
|
||||||
@ -2004,12 +1997,13 @@ CFF.prototype = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var ActualCFF = (function() {
|
var Type2CFF = (function() {
|
||||||
|
|
||||||
function constructor(file) {
|
function constructor(file) {
|
||||||
var bytes = file.getBytes();
|
var bytes = file.getBytes();
|
||||||
this.bytes = bytes;
|
this.bytes = bytes;
|
||||||
|
|
||||||
|
// Other classes expect this.data to be a Javascript array
|
||||||
var data = []
|
var data = []
|
||||||
for (var i = 0, ii = bytes.length; i < ii; ++i)
|
for (var i = 0, ii = bytes.length; i < ii; ++i)
|
||||||
data.push(bytes[i]);
|
data.push(bytes[i]);
|
||||||
@ -2047,11 +2041,10 @@ var ActualCFF = (function() {
|
|||||||
var charset = this.parseCharsets(topDict['charset'], charStrings.length,
|
var charset = this.parseCharsets(topDict['charset'], charStrings.length,
|
||||||
strings);
|
strings);
|
||||||
|
|
||||||
|
// charstrings contains info about glyphs (one element per glyph
|
||||||
|
// containing mappings for {unicode, width}
|
||||||
this.charstrings = this.getCharStrings(encoding, charset, charStrings,
|
this.charstrings = this.getCharStrings(encoding, charset, charStrings,
|
||||||
privDict);
|
privDict);
|
||||||
|
|
||||||
// var dict = dictIndex.get(0);
|
|
||||||
log('blah');
|
|
||||||
},
|
},
|
||||||
getCharStrings: function cff_charstrings(encoding, charsets, charStrings,
|
getCharStrings: function cff_charstrings(encoding, charsets, charStrings,
|
||||||
privDict) {
|
privDict) {
|
||||||
@ -2067,8 +2060,6 @@ var ActualCFF = (function() {
|
|||||||
var charString = this.parseCharString(charStrings.get(i),
|
var charString = this.parseCharString(charStrings.get(i),
|
||||||
defaultWidth, nominalWidth);
|
defaultWidth, nominalWidth);
|
||||||
charstrings.push({unicode: charCode, width: charString.width});
|
charstrings.push({unicode: charCode, width: charString.width});
|
||||||
} else {
|
|
||||||
charstrings.push({unicode: 0, width: 0});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return charstrings;
|
return charstrings;
|
||||||
|
Loading…
Reference in New Issue
Block a user