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

NameTypeAccessDescription
codeWidth: numberReadThe narrowest character code this font admits, in bytes: 1 for a simple font, 2 for Identity-H and most composite fonts.
wmode: 0 | 1ReadWriting mode from the /Encoding CMap: 0 horizontal, 1 vertical.
name: stringReadThe font’s /BaseFont name (subset prefix preserved), or undefined if absent.
bold: booleanReadTrue when the document declares this font bold / italic.
italic: booleanReadGets the italic.
type3: Type3DataReadSet for a Type 3 font: its glyph procedures and the space they draw in.
code: numberReadGets the code.
cid: numberReadGets the cid.
len: numberReadGets the len.
canEncodebooleanReadGets the can encode.

Methods

SignatureDescription
constructor(dict: PdfDict, resolve: Resolve, inflate: Inflate)Calls constructor(dict, resolve, inflate) on this TextFont instance.
decodeRun(bytes: Uint8Array)RunMetricsDecode bytes into text plus the run’s advance metrics.
decode(bytes: Uint8Array)stringDecode a show-string’s bytes into Unicode text.
encodeChar(ch: string)number | undefinedMap one Unicode character to its 1-byte code in this font’s encoding, or undefined if the font cannot represent it.
encode(text: string)Uint8ArrayEncode 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).