Before you can draw (see Painter) on a page, you must first create and set a font object. A font object can be reused as often as you want.
class Font {
readonly object: Object
size: number
scale: number
charSpace: number
wordSpace: number
underline: boolean
strikeOut: boolean
readonly identifier: string
isBold(): boolean
isItalic(): boolean
getEncoding(): Encoding
getMetrics(): NPDFFontMetrics
stringWidth(v: string): number
write(content: string, stream: Stream): void
embed(): void
isSubsetting(): boolean
embedSubsetFont(): void
}
To construct a new Font object use Document.createFont.
Get the underlying font Object
Get or set the font size
Get or set the font scale
Get or set font character spacing
Get or set font word spacing
Enable or disable underline
Enable or disable strikeout
Get the font identifier
isBold(): boolean
Get bold flag as boolean
isItalic(): boolean
Get italic flag as boolean
getEncoding(): Encoding
Get the font Encoding
getMetrics(): NPDFFontMetrics
Get the font metrics as NPDFFontMetrics
stringWidth(v: string): number
Calculate the width of a string using the font
write(content: string, stream: Stream): void
Write contents to a stream
embed(): void
Embed the font in the document. It is highly recommended to embed fonts, if a font is not embedded and the viewer's machine does not have the font installed locally, the contents may not render (some viewers will use a fallback font)
isSubsetting(): boolean
Check if this is a subset font
embedSubsetFont(): void
Embed subset-font into the Page. Call isSubsetting to assert this is a subset font before embedding as an exception will be thrown if the font is not a subset.