dist/bundle.js
/**
 * A Font represents a loaded OpenType font file.
 * It contains a set of glyphs and methods to draw text on a drawing context,
 * or to get a path representing the text.
 * @exports opentype.Font
 * @class
 * @param {FontOptions}
 * @constructor
 */
A Font represents a loaded OpenType font file.
It contains a set of glyphs and methods to draw text on a drawing context,
or to get a path representing the text.
@exports opentype.Font
@class
@param {FontOptions}
@constructor
A Font represents a loaded OpenType font file . It contains a set of glyphs and methods to draw text on a drawing context or to get a path representing the text . @exports opentype . Font @class @param { FontOptions } @constructor
function Font(options) {
    options = options || {};
    if (!options.empty) {
        util.checkArgument(options.familyName, 'When creating a new Font object, familyName is required.');
        util.checkArgument(options.styleName, 'When creating a new Font object, styleName is required.');
        util.checkArgument(options.unitsPerEm, 'When creating a new Font object, unitsPerEm is required.');
        util.checkArgument(options.ascender, 'When creating a new Font object, ascender is required.');
        util.checkArgument(options.descender, 'When creating a new Font object, descender is required.');
        util.checkArgument(options.descender < 0, 'Descender should be negative (e.g. -512).');
        this.names = {
            fontFamily: {en: options.familyName || ' '},
            fontSubfamily: {en: options.styleName || ' '},
            fullName: {en: options.fullName || options.familyName + ' ' + options.styleName},
            postScriptName: {en: options.postScriptName || options.familyName + options.styleName},
            designer: {en: options.designer || ' '},
            designerURL: {en: options.designerURL || ' '},
            manufacturer: {en: options.manufacturer || ' '},
            manufacturerURL: {en: options.manufacturerURL || ' '},
            license: {en: options.license || ' '},
            licenseURL: {en: options.licenseURL || ' '},
            version: {en: options.version || 'Version 0.1'},
            description: {en: options.description || ' '},
            copyright: {en: options.copyright || ' '},
            trademark: {en: options.trademark || ' '}
        };
        this.unitsPerEm = options.unitsPerEm || 1000;
        this.ascender = options.ascender;
        this.descender = options.descender;
        this.createdTimestamp = options.createdTimestamp;
        this.tables = { os2: {
            usWeightClass: options.weightClass || this.usWeightClasses.MEDIUM,
            usWidthClass: options.widthClass || this.usWidthClasses.MEDIUM,
            fsSelection: options.fsSelection || this.fsSelectionValues.REGULAR
        } };
    }
    this.supported = true; 
    this.glyphs = new glyphset.GlyphSet(this, options.glyphs || []);
    this.encoding = new encoding.DefaultEncoding(this);
    this.substitution = new substitution(this);
    this.tables = this.tables || {};
}
function Font ( options ) { options = options || { } ; if ( ! options . empty ) { util . checkArgument ( options . familyName , 'When creating a new Font object, familyName is required.' ) ; util . checkArgument ( options . styleName , 'When creating a new Font object, styleName is required.' ) ; util . checkArgument ( options . unitsPerEm , 'When creating a new Font object, unitsPerEm is required.' ) ; util . checkArgument ( options . ascender , 'When creating a new Font object, ascender is required.' ) ; util . checkArgument ( options . descender , 'When creating a new Font object, descender is required.' ) ; util . checkArgument ( options . descender < 0 , 'Descender should be negative (e.g. -512).' ) ; this . names = { fontFamily : { en : options . familyName || ' ' } , fontSubfamily : { en : options . styleName || ' ' } , fullName : { en : options . fullName || options . familyName + ' ' + options . styleName } , postScriptName : { en : options . postScriptName || options . familyName + options . styleName } , designer : { en : options . designer || ' ' } , designerURL : { en : options . designerURL || ' ' } , manufacturer : { en : options . manufacturer || ' ' } , manufacturerURL : { en : options . manufacturerURL || ' ' } , license : { en : options . license || ' ' } , licenseURL : { en : options . licenseURL || ' ' } , version : { en : options . version || 'Version 0.1' } , description : { en : options . description || ' ' } , copyright : { en : options . copyright || ' ' } , trademark : { en : options . trademark || ' ' } } ; this . unitsPerEm = options . unitsPerEm || 1000 ; this . ascender = options . ascender ; this . descender = options . descender ; this . createdTimestamp = options . createdTimestamp ; this . tables = { os2 : { usWeightClass : options . weightClass || this . usWeightClasses . MEDIUM , usWidthClass : options . widthClass || this . usWidthClasses . MEDIUM , fsSelection : options . fsSelection || this . fsSelectionValues . REGULAR } } ; } this . supported = true ; this . glyphs = new glyphset . GlyphSet ( this , options . glyphs || [ ] ) ; this . encoding = new encoding . DefaultEncoding ( this ) ; this . substitution = new substitution ( this ) ; this . tables = this . tables || { } ; }
A Font represents a loaded OpenType font file.
A Font represents a loaded OpenType font file .
// Check that we've provided the minimum set of names. // OS X will complain if the names are empty, so we put a single space everywhere by default. // Deprecated: parseBuffer will throw an error if font is not supported.