add a closure around Font so we can hide helper functions in it
This commit is contained in:
parent
7bb098dfc7
commit
f6e85f00cb
13
fonts.js
13
fonts.js
@ -84,7 +84,8 @@ var Fonts = {
|
|||||||
* var type1Font = new Font("MyFontName", binaryFile, propertiesObject);
|
* var type1Font = new Font("MyFontName", binaryFile, propertiesObject);
|
||||||
* type1Font.bind();
|
* type1Font.bind();
|
||||||
*/
|
*/
|
||||||
var Font = function(aName, aFile, aProperties) {
|
var Font = (function () {
|
||||||
|
var constructor = function(aName, aFile, aProperties) {
|
||||||
this.name = aName;
|
this.name = aName;
|
||||||
|
|
||||||
// If the font has already been decoded simply return it
|
// If the font has already been decoded simply return it
|
||||||
@ -135,10 +136,10 @@ var Font = function(aName, aFile, aProperties) {
|
|||||||
|
|
||||||
// Attach the font to the document
|
// Attach the font to the document
|
||||||
this.bind();
|
this.bind();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A bunch of the OpenType code is duplicate between this class and the
|
* A bunch of the OpenType code is duplicate between this class and the
|
||||||
* TrueType code, this is intentional and will merge in a future version
|
* TrueType code, this is intentional and will merge in a future version
|
||||||
* where all the code relative to OpenType will probably have its own
|
* where all the code relative to OpenType will probably have its own
|
||||||
@ -146,7 +147,7 @@ var Font = function(aName, aFile, aProperties) {
|
|||||||
* But at the moment it allows to develop around the TrueType rewriting
|
* But at the moment it allows to develop around the TrueType rewriting
|
||||||
* on the fly without messing up with the 'regular' Type1 to OTF conversion.
|
* on the fly without messing up with the 'regular' Type1 to OTF conversion.
|
||||||
*/
|
*/
|
||||||
Font.prototype = {
|
constructor.prototype = {
|
||||||
name: null,
|
name: null,
|
||||||
font: null,
|
font: null,
|
||||||
mimetype: null,
|
mimetype: null,
|
||||||
@ -564,8 +565,10 @@ Font.prototype = {
|
|||||||
fontData.push(otf[i]);
|
fontData.push(otf[i]);
|
||||||
return fontData;
|
return fontData;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return constructor;
|
||||||
|
})();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FontsUtils is a static class dedicated to hold codes that are not related
|
* FontsUtils is a static class dedicated to hold codes that are not related
|
||||||
|
Loading…
x
Reference in New Issue
Block a user