Browse Source

Make `Type1Font` more class-like, by adding closure

*Note:* Ignoring whitespace should simplify reviewing a great deal.
Jonas Jenwald 9 years ago
parent
commit
c40df8a393
  1. 13
      src/core/fonts.js

13
src/core/fonts.js

@ -3637,8 +3637,9 @@ var CFFStandardStrings = [ @@ -3637,8 +3637,9 @@ var CFFStandardStrings = [
];
// Type1Font is also a CIDFontType0.
var Type1Font = function Type1Font(name, file, properties) {
// Some bad generators embed pfb file as is, we have to strip 6-byte headers.
var Type1Font = (function Type1FontClosure() {
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.
// http://www.math.ubc.ca/~cass/piscript/type1.pdf
var PFB_HEADER_SIZE = 6;
@ -3679,7 +3680,7 @@ var Type1Font = function Type1Font(name, file, properties) { @@ -3679,7 +3680,7 @@ var Type1Font = function Type1Font(name, file, properties) {
this.data = this.wrap(name, type2Charstrings, this.charstrings,
subrs, properties);
this.seacs = this.getSeacs(data.charstrings);
};
}
Type1Font.prototype = {
get numGlyphs() {
@ -3762,7 +3763,8 @@ Type1Font.prototype = { @@ -3762,7 +3763,8 @@ Type1Font.prototype = {
return type2Subrs;
},
wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs,
properties) {
var cff = new CFF();
cff.header = new CFFHeader(1, 0, 4, 4);
@ -3863,6 +3865,9 @@ Type1Font.prototype = { @@ -3863,6 +3865,9 @@ Type1Font.prototype = {
}
};
return Type1Font;
})();
var CFFFont = (function CFFFontClosure() {
function CFFFont(file, properties) {
this.properties = properties;

Loading…
Cancel
Save