API Documentation for Font

NoPoDoFo Font

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
}

Constructors


To construct a new Font object use Document.createFont.

Properties


object

Get the underlying font Object

size

Get or set the font size

scale

Get or set the font scale

charSpace

Get or set font character spacing

wordSpace

Get or set font word spacing

underline

Enable or disable underline

strikeOut

Enable or disable strikeout

identifier

Get the font identifier

Methods


isBold

isBold(): boolean

Get bold flag as boolean

isItalic

isItalic(): boolean

Get italic flag as boolean

getEncoding

getEncoding(): Encoding

Get the font Encoding

getMetrics

getMetrics(): NPDFFontMetrics

Get the font metrics as NPDFFontMetrics

stringWidth

stringWidth(v: string): number

Calculate the width of a string using the font

write

write(content: string, stream: Stream): void

Write contents to a stream

embed

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

isSubsetting(): boolean

Check if this is a subset font

embedSubsetFont

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.

results matching ""

    No results matching ""