EmbeddedFont

Overview

EmbeddedFont is a class in Aspose.PDF FOSS for TypeScript.

An opaque handle to a font program registered with {@link Document.AddFont}.

This class declares 7 methods for EmbeddedFont objects in TypeScript programs. Available methods include: constructor, driver, encode, measure, measureShaped, probe, shapeRuns. All public members are accessible to any TypeScript application after installing the Aspose.PDF FOSS for TypeScript package. Properties: objNum, sfnt, shape, toUnicode, usedGids.

Properties

NameTypeAccessDescription
sfnt: SfntFontRead@internal parsed font program.
usedGids``Read@internal original GIDs (= CIDs) drawn with this font, across all pages.
objNum: number | undefinedRead/Write@internal object number of the Type0 font dict, reserved on first draw and filled by the document’s finalize pass at Save (undefined until then).
shape``Read/Write@internal default shaping flag, from {@link Document.AddFont}({ shape }).
toUnicode``Read@internal gid → source text, for /ToUnicode of shaped/ligated/RTL glyphs.

Methods

SignatureDescription
constructor(sfnt: SfntFont)@internal Construct via {@link Document.AddFont}.
measure(text: string, fontSize: number)number@internal Width of text in points at fontSize; chars absent from the font’s cmap are dropped (no recording).
encode(text: string)Uint8Array@internal Encode text to 2-byte Identity-H glyph codes (CID = original GID), recording each used GID for subsetting.
probe(text: string)number@internal Count of cmappable chars in text, without recording glyphs.
driver()FontDriver@internal A {@link FontDriver} view for the layout/stamping engine.
shapeRuns(text: string, opts: ShapeOpts)ShapedRun[]@internal Shape text into visual runs, recording used gids and, for each final gid, the source code points of its cluster (for /ToUnicode).
measureShaped(text: string, fontSize: number, opts: ShapeOpts)number@internal Shaped width of text in points at fontSize.