Make Type1Font
more class-like, by adding closure
*Note:* Ignoring whitespace should simplify reviewing a great deal.
This commit is contained in:
parent
447c48ea27
commit
c40df8a393
@ -3637,8 +3637,9 @@ var CFFStandardStrings = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Type1Font is also a CIDFontType0.
|
// Type1Font is also a CIDFontType0.
|
||||||
var Type1Font = function Type1Font(name, file, properties) {
|
var Type1Font = (function Type1FontClosure() {
|
||||||
// Some bad generators embed pfb file as is, we have to strip 6-byte headers.
|
function Type1Font(name, file, properties) {
|
||||||
|
// Some bad generators embed pfb file as is, we have to strip 6-byte header.
|
||||||
// Also, length1 and length2 might be off by 6 bytes as well.
|
// Also, length1 and length2 might be off by 6 bytes as well.
|
||||||
// http://www.math.ubc.ca/~cass/piscript/type1.pdf
|
// http://www.math.ubc.ca/~cass/piscript/type1.pdf
|
||||||
var PFB_HEADER_SIZE = 6;
|
var PFB_HEADER_SIZE = 6;
|
||||||
@ -3679,9 +3680,9 @@ var Type1Font = function Type1Font(name, file, properties) {
|
|||||||
this.data = this.wrap(name, type2Charstrings, this.charstrings,
|
this.data = this.wrap(name, type2Charstrings, this.charstrings,
|
||||||
subrs, properties);
|
subrs, properties);
|
||||||
this.seacs = this.getSeacs(data.charstrings);
|
this.seacs = this.getSeacs(data.charstrings);
|
||||||
};
|
}
|
||||||
|
|
||||||
Type1Font.prototype = {
|
Type1Font.prototype = {
|
||||||
get numGlyphs() {
|
get numGlyphs() {
|
||||||
return this.charstrings.length + 1;
|
return this.charstrings.length + 1;
|
||||||
},
|
},
|
||||||
@ -3762,7 +3763,8 @@ Type1Font.prototype = {
|
|||||||
return type2Subrs;
|
return type2Subrs;
|
||||||
},
|
},
|
||||||
|
|
||||||
wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
|
wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs,
|
||||||
|
properties) {
|
||||||
var cff = new CFF();
|
var cff = new CFF();
|
||||||
cff.header = new CFFHeader(1, 0, 4, 4);
|
cff.header = new CFFHeader(1, 0, 4, 4);
|
||||||
|
|
||||||
@ -3861,7 +3863,10 @@ Type1Font.prototype = {
|
|||||||
var compiler = new CFFCompiler(cff);
|
var compiler = new CFFCompiler(cff);
|
||||||
return compiler.compile();
|
return compiler.compile();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return Type1Font;
|
||||||
|
})();
|
||||||
|
|
||||||
var CFFFont = (function CFFFontClosure() {
|
var CFFFont = (function CFFFontClosure() {
|
||||||
function CFFFont(file, properties) {
|
function CFFFont(file, properties) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user