Documentation/GdiFont
classWORKERCLONEABLE

GdiFont

jsdoc/objects/gdi.js:262
GdiFont(name, size_px, style)

Constructor may fail if font is not present.

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

Parameters

NameTypeDescription
namestring
size_pxnumber

See Point2Pixel function for conversions

style = 0optionalnumber

See FontStyle flags

propertyWORKERreadonly

Height

jsdoc/objects/gdi.js:276
Height: number

Example

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

Name

jsdoc/objects/gdi.js:286
Name: string

Example

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

Size

jsdoc/objects/gdi.js:296
Size: float

Example

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

Style

jsdoc/objects/gdi.js:306
Style: number

See FontStyle flags for value interpretation.

Example

console.log(my_font.Style);
propertyWORKERreadonly

Weight

jsdoc/objects/gdi.js:318
Weight: number

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