[]
        
(Showing Draft Content)

SvgDocument

Class: SvgDocument

Represents an SVG document.

Extends

Accessors

cursiveFont

Get Signature

get cursiveFont(): Font;

Gets or sets the font belonging to the Cursive font family.

Returns

Font

Set Signature

set cursiveFont(font): void;

Gets or sets the font belonging to the Cursive font family.

Parameters
font

Font

Returns

void


description

Get Signature

get description(): string;

Gets the description of the SVG document.

Returns

string


fantasyFont

Get Signature

get fantasyFont(): Font;

Gets or sets the font belonging to the Fantasy font family.

Returns

Font

Set Signature

set fantasyFont(font): void;

Gets or sets the font belonging to the Fantasy font family.

Parameters
font

Font

Returns

void


fontCollection

Get Signature

get fontCollection(): FontCollection;

Gets or sets the custom FontCollection used for searching fonts and font fallbacks.

Returns

FontCollection

Set Signature

set fontCollection(coll): void;

Gets or sets the custom FontCollection used for searching fonts and font fallbacks.

Parameters
coll

FontCollection

Returns

void


fontFallbackScope

Get Signature

get fontFallbackScope(): FontFallbackScope;

Gets or sets a value specifying the scope for searching fallback fonts for the glyphs missing in the mentioned type faces.

Returns

FontFallbackScope

Set Signature

set fontFallbackScope(fallbackScope): void;

Gets or sets a value specifying the scope for searching fallback fonts for the glyphs missing in the mentioned type faces.

Parameters
fallbackScope

FontFallbackScope

Returns

void


id

Get Signature

get id(): number;

Gets the reference to the object.

Returns

number

Inherited from

ObjectBase.id


monospaceFont

Get Signature

get monospaceFont(): Font;

Gets or sets the font belonging to the Monospace font family.

Returns

Font

Set Signature

set monospaceFont(font): void;

Gets or sets the font belonging to the Monospace font family.

Parameters
font

Font

Returns

void


om

Get Signature

get om(): ObjectManager;

Gets the owner ObjectManager instance.

Returns

ObjectManager

Inherited from

ObjectBase.om


restrictedFontLookup

Get Signature

get restrictedFontLookup(): boolean;

Gets or sets a value indicating whether the fonts should be searched in the custom collection only, if any specified. The default is false.

Returns

boolean

Set Signature

set restrictedFontLookup(value): void;

Gets or sets a value indicating whether the fonts should be searched in the custom collection only, if any specified. The default is false.

Parameters
value

boolean

Returns

void


sansSerifFont

Get Signature

get sansSerifFont(): Font;

Gets or sets the font belonging to the SansSerif font family.

Returns

Font

Set Signature

set sansSerifFont(font): void;

Gets or sets the font belonging to the SansSerif font family.

Parameters
font

Font

Returns

void


serifFont

Get Signature

get serifFont(): Font;

Gets or sets the font belonging to the Serif font family.

Returns

Font

Set Signature

set serifFont(font): void;

Gets or sets the font belonging to the Serif font family.

Parameters
font

Font

Returns

void


title

Get Signature

get title(): string;

Gets the title of the SVG document.

Returns

string

Methods

load()

Call Signature

static load(svgBytes): SvgDocument;

Loads a SvgDocument from a byte array.

Parameters
svgBytes

Uint8Array

The binary data of the SVG document.

Returns

SvgDocument

A new instance of the SVG document.

Call Signature

static load(om, svgBytes): SvgDocument;

Loads a SvgDocument from a byte array.

Parameters
om

ObjectManager

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

svgBytes

Uint8Array

The binary data of the SVG document.

Returns

SvgDocument

A new instance of the SVG document.


loadGz()

Call Signature

static loadGz(gzSvgBytes): SvgDocument;

Loads a SvgDocument from a byte array with gzipped SVG data.

Parameters
gzSvgBytes

Uint8Array

The binary data of the gzipped SVG document.

Returns

SvgDocument

A new instance of the SVG document.

Call Signature

static loadGz(om, gzSvgBytes): SvgDocument;

Loads a SvgDocument from a byte array with gzipped SVG data.

Parameters
om

ObjectManager

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

gzSvgBytes

Uint8Array

The binary data of the gzipped SVG document.

Returns

SvgDocument

A new instance of the SVG document.


addCursiveFont()

addCursiveFont(font): void;

Adds a font belonging to the Cursive font family.

Parameters

font

Font

Returns

void


addFantasyFont()

addFantasyFont(font): void;

Adds a font belonging to the Fantasy font family.

Parameters

font

Font

Returns

void


addMonospaceFont()

addMonospaceFont(font): void;

Adds a font belonging to the Monospace font family.

Parameters

font

Font

Returns

void


addSansSerifFont()

addSansSerifFont(font): void;

Adds a font belonging to the SansSerif font family.

Parameters

font

Font

Returns

void


addSerifFont()

addSerifFont(font): void;

Adds a font belonging to the Serif font family.

Parameters

font

Font

Returns

void


clearCursiveFonts()

clearCursiveFonts(): void;

Clears the list of fonts belonging to the Cursive font family.

Returns

void


clearFantasyFonts()

clearFantasyFonts(): void;

Clears the list of fonts belonging to the Fantasy font family.

Returns

void


clearMonospaceFonts()

clearMonospaceFonts(): void;

Clears the list of fonts belonging to the Monospace font family.

Returns

void


clearSansSerifFonts()

clearSansSerifFonts(): void;

Clears the list of fonts belonging to the SansSerif font family.

Returns

void


clearSerifFonts()

clearSerifFonts(): void;

Clears the list of fonts belonging to the Serif font family.

Returns

void


free()

free(): void;

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

Returns

void

Inherited from

ObjectBase.free


getIntrinsicSize()

getIntrinsicSize(): Size;

Gets the intrinsic size of SVG viewport.

Returns

Size

The intrinsic size of SVG viewport, or null if the size is undefined.


measure()

measure(x, y): Rect;

Calculates the content bounds of an SVG document when its viewport is drawn at a specified point.

Parameters

x

number

The X coordinate of SVG viewport.

y

number

The Y coordinate of SVG viewport.

Returns

Rect

The content rectangle of the resulting image.


measureToRect()

Call Signature

measureToRect(
   x, 
   y, 
   width, 
   height): Rect;

Calculates the content bounds of an SVG document, resizing the SVG viewport to fit into a specified rectangle.

Parameters
x

number

The X coordinate of the target rectangle for SVG viewport.

y

number

The Y coordinate of the target rectangle for SVG viewport.

width

number

The width of the target rectangle for SVG viewport.

height

number

The height of the target rectangle for SVG viewport.

Returns

Rect

The content rectangle of the resulting image.

Call Signature

measureToRect(bounds): Rect;

Calculates the content bounds of an SVG document, resizing the SVG viewport to fit into a specified rectangle.

Parameters
bounds

Bounds

The target rectangle for SVG viewport.

Returns

Rect

The content rectangle of the resulting image.


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


save()

save(options?): Uint8Array;

Saves the current SvgDocument to a byte array.

Parameters

options?

SaveSvgOptions

The settings for saving the document.

Returns

Uint8Array

A byte array with UTF8-encoded SVG data.


saveGz()

saveGz(): Uint8Array;

Saves the current SvgDocument to a byte array in SVG.GZ format.

Returns

Uint8Array


setCurrentColor()

setCurrentColor(color): void;

Sets the 'currentColor' value used by the SVG renderer.

Parameters

color

Color

Returns

void


setLanguageTags()

setLanguageTags(langTags): void;

Sets the list of cultures to match values of the 'systemLanguage' attribute of SVG elements.

Parameters

langTags

string[]

Returns

void