Convert src/core/cff_font.js
to use standard classes
This commit is contained in:
parent
542ee0d798
commit
e803584fe7
@ -17,9 +17,8 @@ import { CFFCompiler, CFFParser } from "./cff_parser.js";
|
|||||||
import { SEAC_ANALYSIS_ENABLED, type1FontGlyphMapping } from "./fonts_utils.js";
|
import { SEAC_ANALYSIS_ENABLED, type1FontGlyphMapping } from "./fonts_utils.js";
|
||||||
import { warn } from "../shared/util.js";
|
import { warn } from "../shared/util.js";
|
||||||
|
|
||||||
const CFFFont = (function CFFFontClosure() {
|
class CFFFont {
|
||||||
// eslint-disable-next-line no-shadow
|
constructor(file, properties) {
|
||||||
function CFFFont(file, properties) {
|
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
|
|
||||||
const parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
|
const parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
|
||||||
@ -38,14 +37,15 @@ const CFFFont = (function CFFFontClosure() {
|
|||||||
this._createBuiltInEncoding();
|
this._createBuiltInEncoding();
|
||||||
}
|
}
|
||||||
|
|
||||||
CFFFont.prototype = {
|
|
||||||
get numGlyphs() {
|
get numGlyphs() {
|
||||||
return this.cff.charStrings.count;
|
return this.cff.charStrings.count;
|
||||||
},
|
}
|
||||||
getCharset: function CFFFont_getCharset() {
|
|
||||||
|
getCharset() {
|
||||||
return this.cff.charset.charset;
|
return this.cff.charset.charset;
|
||||||
},
|
}
|
||||||
getGlyphMapping: function CFFFont_getGlyphMapping() {
|
|
||||||
|
getGlyphMapping() {
|
||||||
const cff = this.cff;
|
const cff = this.cff;
|
||||||
const properties = this.properties;
|
const properties = this.properties;
|
||||||
const charsets = cff.charset.charset;
|
const charsets = cff.charset.charset;
|
||||||
@ -77,10 +77,11 @@ const CFFFont = (function CFFFontClosure() {
|
|||||||
const encoding = cff.encoding ? cff.encoding.encoding : null;
|
const encoding = cff.encoding ? cff.encoding.encoding : null;
|
||||||
charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
|
charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
|
||||||
return charCodeToGlyphId;
|
return charCodeToGlyphId;
|
||||||
},
|
}
|
||||||
hasGlyphId: function CFFFont_hasGlyphID(id) {
|
|
||||||
|
hasGlyphId(id) {
|
||||||
return this.cff.hasGlyphId(id);
|
return this.cff.hasGlyphId(id);
|
||||||
},
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@ -106,10 +107,7 @@ const CFFFont = (function CFFFontClosure() {
|
|||||||
if (map.length > 0) {
|
if (map.length > 0) {
|
||||||
this.properties.builtInEncoding = map;
|
this.properties.builtInEncoding = map;
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
return CFFFont;
|
|
||||||
})();
|
|
||||||
|
|
||||||
export { CFFFont };
|
export { CFFFont };
|
||||||
|
Loading…
Reference in New Issue
Block a user