TextFont
Overview
TextFont is a class in Aspose.PDF FOSS for TypeScript.
This class declares 6 methods for TextFont objects in TypeScript programs.
Available methods include: constructor, decode, decodeGlyphs, decodeRun, encode, encodeChar.
All public members are accessible to any TypeScript application after installing the Aspose.PDF FOSS for TypeScript package.
Properties: bold, canEncode, cid, code, codeWidth, italic, and 4 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
codeWidth | : number | Read | The narrowest character code this font admits, in bytes: 1 for a simple font, 2 for Identity-H and most composite fonts. |
wmode | : 0 | 1 | Read | Writing mode from the /Encoding CMap: 0 horizontal, 1 vertical. |
name | : string | Read | The font’s /BaseFont name (subset prefix preserved), or undefined if absent. |
bold | : boolean | Read | True when the document declares this font bold / italic. |
italic | : boolean | Read | Gets the italic. |
type3 | : Type3Data | Read | Set for a Type 3 font: its glyph procedures and the space they draw in. |
code | : number | Read | Gets the code. |
cid | : number | Read | Gets the cid. |
len | : number | Read | Gets the len. |
canEncode | boolean | Read | Gets the can encode. |
Methods
| Signature | Description |
|---|---|
constructor(dict: PdfDict, resolve: Resolve, inflate: Inflate) | Calls constructor(dict, resolve, inflate) on this TextFont instance. |
decodeRun(bytes: Uint8Array) → RunMetrics | Decode bytes into text plus the run’s advance metrics. |
decode(bytes: Uint8Array) → string | Decode a show-string’s bytes into Unicode text. |
encodeChar(ch: string) → number | undefined | Map one Unicode character to its 1-byte code in this font’s encoding, or undefined if the font cannot represent it. |
encode(text: string) → Uint8Array | Encode text to show-string bytes in this font’s encoding. |
decodeGlyphs(bytes: Uint8Array) → Glyph[] | Decode bytes into one record per character code (positions, em-widths). |