12. Overview Fonts

Fonts contain attributes like font name, size, color etc. Fonts can be used for text objects, axes titles etc.

Example

The following example sets the font for the diagram axes and titles to 12pt, “Times New Roman” in red.

// Create sinus curve
x = linspace(0,2*PI,100)
y = sin(x)
h = plot(x, y)
// plot returns a vector with three elements.
// The second element is the diagram handle.
// Retrieve x axis font:
hFont = LayerGetAxisTitleFont(h[2], "X");
// Set attributes:
FontSetHeight(hFont, 12);
FontSetFaceName(hFont, "Times New Roman");
FontSetColorRGB(hFont, [255,0,0]);
// Set font
LayerSetAxisTitleFont(h[2], "X", hFont);
LayerSetAxisTitleFont(h[2], "Y", hFont);
LayerSetAxisLabelFont(h[2], "X", hFont);
LayerSetAxisLabelFont(h[2], "Y", hFont);
// Destroy font
// LayerGetAxisTitleFont returned a copy of a font.
FontDestroy(hFont)

Create and Destroy

FontCreate

FontCreate creates a font object.

FontDialog

FontDialog displays a font dialog box.

FontDestroy

FontDestroy destroys the given font and frees any memory the font occupied.

Set Functions

FontItalic

FontItalic specifies an italic font.

FontSetAngle

FontSetAngle sets the font angle.

FontSetColorRGB

FontSetColorRGB sets the font color.

FontSetFaceName

FontSetFaceName sets the font face name.

FontSetHeight

FontSetHeight specifies the height of the font.

FontSetPitchAndFamily

FontSetPitchAndFamily specifies the pitch and family of the font.

FontSetProps

FontSetProps sets the font properties.

FontSetWeight

FontSetWeight Specifies the weight of the font, in the range 0 through 1000 (for example, 400 is normal and 700 is bold).

FontStrikeOut

FontStrikeOut specifies a strikeout font.

FontUnderline

FontUnderline specifies an underlined font.

Get Functions

FontGetAngle

FontGetAngle gets the font angle

FontGetColorRGB

FontGetColorRGB gets the font color.

FontGetFaceName

FontGetFaceName gets the font face name.

FontGetHeight

FontGetHeight gets the font height in points (pt).

FontGetPitchAndFamily

FontGetPitchAndFamily gets the font pitch and family.

FontGetProps

FontGetProps gets the font properties.

FontGetWeight

FontGetWeight gets the font weight.

FontIsItalic

FontIsItalic checks if the font has the italic flag set.

FontIsStrikeOut

FontIsStrikeOut checks if the given font has the strike out flag set.

FontIsUnderline

FontIsUnderline checks if the given font has the underline flag set.

id-186060