Documentation/D2DFont
class

D2DFont

js/d2d.js:191
D2DFont(name, size_px, style)

Constructor may fail if font is not present.

Performance note: try caching and reusing D2DFont objects, since the maximum amount of such objects is hard-limited by Windows. D2DFont creation will fail after reaching this limit.

Parameters

NameTypeDescription
namestring
size_pxnumber

See Point2Pixel function for conversions

style = 0optionalnumber

See FontStyle flags

propertyreadonly

Height

js/d2d.js:204
Height: number

Example

console.log(my_font.Height); // 15
propertyreadonly

Name

js/d2d.js:213
Name: string

Example

console.log(my_font.Name); // Segoe UI
propertyreadonly

Size

js/d2d.js:222
Size: float

Example

console.log(my_font.Size); // 12
propertyreadonly

Style

js/d2d.js:231
Style: number

See FontStyle flags for value interpretation.

Example

console.log(my_font.Style);