DsPdfJS API - v9.1.0
    Preparing search index...

    Class Font

    Represents a TrueType or OpenType font.

    Hierarchy (View Summary)

    Index

    Accessors

    • 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

    • get bold(): boolean

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

      Returns boolean

    • get canEmbed(): boolean

      Indicates whether this font can be embedded.

      Returns boolean

    • get canSubset(): boolean

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

      Returns boolean

    • get capHeight(): number

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

      Returns number

    • get copyrightNotice(): string

      The Copyright notice of the font.

      Returns string

    • get enableHinting(): boolean

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

      Returns boolean

    • set enableHinting(value: boolean): void

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

      Parameters

      • value: boolean

      Returns void

    • get fontFamily(): string

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

      Returns string

    • get fullFontName(): string

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

      Returns string

    • get hasLinkedFonts(): boolean

      Indicates whether the current font has linked fonts.

      Returns boolean

    • get hollow(): boolean

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

      Returns boolean

    • get horizontalAscender(): number

      The typographic or legacy ascender for this font.

      Returns number

    • get horizontalDescender(): number

      The typographic or legacy descender for this font.

      Returns number

    • get horizontalLineGap(): number

      The typographic or legacy line gap for this font.

      Returns number

    • get id(): number

      Gets the reference to the object.

      Returns number

    • get isCollection(): boolean

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

      Returns boolean

    • get isColorFont(): boolean

      Indicates if this font contains color glyphs.

      Returns boolean

    • get isCompressed(): boolean

      Indicates if the font is in WOFF format.

      Returns boolean

    • get isFixedPitch(): boolean

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

      Returns boolean

    • get isOrnamentalFont(): boolean

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

      Returns boolean

    • get isPostScript(): boolean

      Indicates if the current font contains PostScript outlines.

      Returns boolean

    • get isSansSerif(): boolean

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

      Returns boolean

    • get isScriptFont(): boolean

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

      Returns boolean

    • get isSerifFont(): boolean

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

      Returns boolean

    • get isSymbolicFont(): boolean

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

      Returns boolean

    • get isVerticalFont(): boolean

      Indicates if this is a vertical font.

      Returns boolean

    • get italic(): boolean

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

      Returns boolean

    • 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

    • 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

    • get licenseDescription(): string

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

      Returns string

    • get licenseInfoURL(): string

      The URL where additional licensing information can be found.

      Returns string

    • get negative(): boolean

      Indicates if characters have their foreground and background reversed.

      Returns boolean

    • get numGlyphs(): number

      The number of glyphs in this font.

      Returns number

    • get oblique(): boolean

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

      Returns boolean

    • 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 permissionToEmbedGranted(value: boolean): 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

    • get postScriptName(): string

      The PostScript name of the font.

      Returns string

    • get revision(): number

      The revision number set by font manufacturer.

      Returns number

    • get smallXHeight(): number

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

      Returns number

    • get strikeout(): boolean

      Indicates if characters are overstruck.

      Returns boolean

    • get typographicFamilyName(): string

      The typographic family grouping name.

      Returns string

    • get underscore(): boolean

      Indicates if characters are underscored.

      Returns boolean

    • get unitsPerEm(): number

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

      Returns number

    • get useBitmapCache(): boolean

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

      Returns boolean

    • set useBitmapCache(value: boolean): void

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

      Parameters

      • value: boolean

      Returns void

    • get version(): string

      The version set by font manufacturer.

      Returns string

    • get verticalAscender(): number

      The vertical typographic ascender for this font.

      Returns number

    • get verticalDescender(): number

      The vertical typographic descender for this font.

      Returns number

    • get verticalLineGap(): number

      The vertical typographic gap for this font.

      Returns number

    • 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

    • 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

    • 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.

    • 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.

    • 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.

    • 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.

    • Adds a linked font to the current font.

      Parameters

      • font: Font

        The Font to be added as linked font.

      • OptionalscaleFactor: number | null

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

      Returns void

    • Clears the list of linked fonts.

      Returns void

    • 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.

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

      Returns 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