UNPKG

nehan

Version:

Html layout engine for paged-media written in Typescript

28 lines 760 B
import { LogicalSize, } from "./public-api"; export class Char { constructor(str) { this.text = str; this.size = new LogicalSize({ measure: 0, extent: 0 }); this.kerning = false; this.spacing = 0; this.charCount = 1; } setMetrics(opts) { this.size.measure = opts.font.size; this.size.extent = opts.font.size; this.empha = opts.empha; if (opts.empha) { this.size.extent = opts.font.size * 2; } } toString() { return this.text; } acceptEvaluator(visitor) { if (this.empha) { return visitor.visitCharEmpha(this, this.empha); } return visitor.visitChar(this); } } //# sourceMappingURL=char.js.map