Documentation/D2DFont
classWORKERCLONEABLE

D2DFont

js/d2d.js:284
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

propertyWORKERreadonly

Height

js/d2d.js:298
Height: number

Example

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

Name

js/d2d.js:308
Name: string

Example

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

Size

js/d2d.js:318
Size: float

Example

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

Style

js/d2d.js:328
Style: number

See FontStyle flags for value interpretation.

Example

console.log(my_font.Style);
propertyWORKERreadonly

Weight

js/d2d.js:340
Weight: number

Font weight. Common values follow Win32 font weights, for example 400 for normal and 700 for bold.