[]
        
(Showing Draft Content)

Font

DsPdfJS API v9.1.0


DsPdfJS API / Font

Class: Font

Represents a TrueType or OpenType font.

Extends

Accessors

avgCharWidth

Get Signature

get avgCharWidth(): number

The Average Character Width parameter specifies the arithmetic average of the escapement (width) of all non-zero width glyphs in the font.

Returns

number


bold

Get Signature

get bold(): boolean

The value of the Bold flag from the OS/2 font table data.

Returns

boolean


canEmbed

Get Signature

get canEmbed(): boolean

Indicates whether this font can be embedded.

Returns

boolean


canSubset

Get Signature

get canSubset(): boolean

Indicates whether this font can be serialized as a subset of the source font data.

Returns

boolean


capHeight

Get Signature

get capHeight(): number

The metric specifying the distance between the baseline and the approximate height of uppercase letters.

Returns

number


copyrightNotice

Get Signature

get copyrightNotice(): string

The Copyright notice of the font.

Returns

string


enableHinting

Get Signature

get enableHinting(): boolean

Gets or sets a value indicating if the TrueType glyph hinting instructions can be executed.

Returns

boolean

Set Signature

set enableHinting(value): void

Gets or sets a value indicating if the TrueType glyph hinting instructions can be executed.

Parameters
value

boolean

Returns

void


fontFamily

Get Signature

get fontFamily(): string

The font family name. Up to four faces can share the same font family name.

Returns

string


fullFontName

Get Signature

get fullFontName(): string

The full font name that reflects all family and relevant subfamily descriptors.

Returns

string


hasLinkedFonts

Get Signature

get hasLinkedFonts(): boolean

Indicates whether the current font has linked fonts.

Returns

boolean


hollow

Get Signature

get hollow(): boolean

Indicates if characters are hollow (outlined), otherwise they are solid.

Returns

boolean


horizontalAscender

Get Signature

get horizontalAscender(): number

The typographic or legacy ascender for this font.

Returns

number


horizontalDescender

Get Signature

get horizontalDescender(): number

The typographic or legacy descender for this font.

Returns

number


horizontalLineGap

Get Signature

get horizontalLineGap(): number

The typographic or legacy line gap for this font.

Returns

number


id

Get Signature

get id(): number

Gets the reference to the object.

Returns

number

Inherited from

ObjectBase.id


isCollection

Get Signature

get isCollection(): boolean

Indicates if the font was loaded from .ttc or .otc font collection.

Returns

boolean


isColorFont

Get Signature

get isColorFont(): boolean

Indicates if this font contains color glyphs.

Returns

boolean


isCompressed

Get Signature

get isCompressed(): boolean

Indicates if the font is in WOFF format.

Returns

boolean


isFixedPitch

Get Signature

get isFixedPitch(): boolean

False if the font is proportionally spaced, True if the font is not proportionally spaced (i.e. monospaced).

Returns

boolean


isOrnamentalFont

Get Signature

get isOrnamentalFont(): boolean

Indicates whether the font-family design reflects the ISO Ornamental Class and the ISO Blackletter Class.

Returns

boolean


isPostScript

Get Signature

get isPostScript(): boolean

Indicates if the current font contains PostScript outlines.

Returns

boolean


isSansSerif

Get Signature

get isSansSerif(): boolean

Indicates whether the font-family design reflects the ISO Sans Serif Class.

Returns

boolean


isScriptFont

Get Signature

get isScriptFont(): boolean

Indicates whether the font-family design reflects the ISO Script Class and Uncial Class.

Returns

boolean


isSerifFont

Get Signature

get isSerifFont(): boolean

Indicates whether the font-family design reflects any of the Serif classes, except Sans Serif.

Returns

boolean


isSymbolicFont

Get Signature

get isSymbolicFont(): boolean

Indicates whether this is a symbolic font suitable for Pi and special characters (icons, dingbats, technical symbols, etc.)

Returns

boolean


isVerticalFont

Get Signature

get isVerticalFont(): boolean

Indicates if this is a vertical font.

Returns

boolean


italic

Get Signature

get italic(): boolean

The value of the Italic flag from the OS/2 font table data.

Returns

boolean


italicAngle

Get Signature

get italicAngle(): number

The italic angle in counter-clockwise degrees from the vertical. Zero for upright text, negative for text that leans to the right (forward).

Returns

number


lastResort

Get Signature

get lastResort(): boolean

Indicates if the glyphs encoded in the cmap subtables are simply generic symbolic representations of code point ranges and don't truly represent support for those code points.

Returns

boolean


licenseDescription

Get Signature

get licenseDescription(): string

The description of the license or licenses under which the font is provided.

Returns

string


licenseInfoURL

Get Signature

get licenseInfoURL(): string

The URL where additional licensing information can be found.

Returns

string


negative

Get Signature

get negative(): boolean

Indicates if characters have their foreground and background reversed.

Returns

boolean


numGlyphs

Get Signature

get numGlyphs(): number

The number of glyphs in this font.

Returns

number


oblique

Get Signature

get oblique(): boolean

The value of the Oblique flag from the OS/2 font table data.

Returns

boolean


om

Get Signature

get om(): ObjectManager

Gets the owner ObjectManager instance.

Returns

ObjectManager

Inherited from

ObjectBase.om


permissionToEmbedGranted

Get Signature

get permissionToEmbedGranted(): boolean

Gets or sets a value indicating that the developer of the software has obtained explicit permission from the legal owner of the font to embed it in documents produced by the software.

Returns

boolean

Set Signature

set permissionToEmbedGranted(value): void

Gets or sets a value indicating that the developer of the software has obtained explicit permission from the legal owner of the font to embed it in documents produced by the software.

Parameters
value

boolean

Returns

void


postScriptName

Get Signature

get postScriptName(): string

The PostScript name of the font.

Returns

string


revision

Get Signature

get revision(): number

The revision number set by font manufacturer.

Returns

number


smallXHeight

Get Signature

get smallXHeight(): number

The metric specifying the distance between the baseline and the approximate height of non-ascending lowercase letters.

Returns

number


strikeout

Get Signature

get strikeout(): boolean

Indicates if characters are overstruck.

Returns

boolean


typographicFamilyName

Get Signature

get typographicFamilyName(): string

The typographic family grouping name.

Returns

string


underscore

Get Signature

get underscore(): boolean

Indicates if characters are underscored.

Returns

boolean


unitsPerEm

Get Signature

get unitsPerEm(): number

The design units per Em, valid range is from 16 to 16384.

Returns

number


useBitmapCache

Get Signature

get useBitmapCache(): boolean

Gets or sets a value indicating if the Bitmap Glyph Cache is enabled.

Returns

boolean

Set Signature

set useBitmapCache(value): void

Gets or sets a value indicating if the Bitmap Glyph Cache is enabled.

Parameters
value

boolean

Returns

void


version

Get Signature

get version(): string

The version set by font manufacturer.

Returns

string


verticalAscender

Get Signature

get verticalAscender(): number

The vertical typographic ascender for this font.

Returns

number


verticalDescender

Get Signature

get verticalDescender(): number

The vertical typographic descender for this font.

Returns

number


verticalLineGap

Get Signature

get verticalLineGap(): number

The vertical typographic gap for this font.

Returns

number


weightClass

Get Signature

get weightClass(): number

The visual weight (degree of blackness or thickness of strokes) of the characters in the font. Values from 1 to 1000 are valid.

Returns

number


widthClass

Get Signature

get widthClass(): number

Indicates a relative change from the normal aspect ratio (width to height ratio) for the glyphs in a font. Values from 1 (Ultra Condensed) to 9 (Ultra Expanded) are expected.

Returns

number

Methods

getPdfFont()

Call Signature

static getPdfFont(standardPdfFont): Font

Returns an instance of the standard PDF font.

Parameters
standardPdfFont

StandardPdfFont

Specifies one of the standard PDF fonts.

Returns

Font

A new instance of the Font.

Call Signature

static getPdfFont(om, standardPdfFont): Font

Returns an instance of the standard PDF font.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the Font object.

standardPdfFont

StandardPdfFont

Specifies one of the standard PDF fonts.

Returns

Font

A new instance of the Font.


load()

Call Signature

static load(fontBytes): Font

Creates a Font instance from a byte array.

Parameters
fontBytes

Uint8Array

The binary data of the font.

Returns

Font

A new instance of the Font.

Call Signature

static load(om, fontBytes): Font

Creates a Font instance from a byte array.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the Font object.

fontBytes

Uint8Array

The binary data of the font.

Returns

Font

A new instance of the Font.


loadCollection()

Call Signature

static loadCollection(fontBytes): Font[]

Loads all Fonts from a byte array containing single font or a font collection.

Parameters
fontBytes

Uint8Array

The byte array with the font data.

Returns

Font[]

The array of loaded Fonts.

Call Signature

static loadCollection(om, fontBytes): Font[]

Loads all Fonts from a byte array containing single font or a font collection.

Parameters
om

ObjectManager

An object manager that controls the lifetime of the Font objects.

fontBytes

Uint8Array

The byte array with the font data.

Returns

Font[]

The array of loaded Fonts.


addLinkedFont()

addLinkedFont(font, scaleFactor?): void

Adds a linked font to the current font.

Parameters

font

Font

The Font to be added as linked font.

scaleFactor?

The scale factor applied to size of the base font when the linked font is used instead.

number | null

Returns

void


clearLinkedFonts()

clearLinkedFonts(): void

Clears the list of linked fonts.

Returns

void


containsCodePoint()

containsCodePoint(codePoint): boolean

Returns a value indicating whether the font can map the specified UTF-32 character to a glyph.

Parameters

codePoint

number

The UTF-32 characer (code point) to check.

Returns

boolean

true if the font can map the character to a glyph, false otherwise.


free()

free(): void

Detaches the object from the ObjectManager and deallocates its memory, if possible.

Returns

void

Inherited from

ObjectBase.free


rebind()

rebind(omTo): void

Rebinds the object from the current ObjectManager to the specified one.

Parameters

omTo

ObjectManager

The new ObjectManager for the object.

Returns

void

Inherited from

ObjectBase.rebind


removeLinkedFont()

removeLinkedFont(font): void

Removes a linked font from the current font.

Parameters

font

Font

The Font to be removed from the list of linked fonts.

Returns

void