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 creates a font object. |
|
FontDialog displays a font dialog box. |
|
FontDestroy destroys the given font and frees any memory the font occupied. |
Set Functions |
|
---|---|
FontItalic specifies an italic font. |
|
FontSetAngle sets the font angle. |
|
FontSetColorRGB sets the font color. |
|
FontSetFaceName sets the font face name. |
|
FontSetHeight specifies the height of the font. |
|
FontSetPitchAndFamily specifies the pitch and family of the font. |
|
FontSetProps sets the font properties. |
|
FontSetWeight Specifies the weight of the font, in the range 0 through 1000 (for example, 400 is normal and 700 is bold). |
|
FontStrikeOut specifies a strikeout font. |
|
FontUnderline specifies an underlined font. |
Get Functions |
|
---|---|
FontGetAngle gets the font angle |
|
FontGetColorRGB gets the font color. |
|
FontGetFaceName gets the font face name. |
|
FontGetHeight gets the font height in points (pt). |
|
FontGetPitchAndFamily gets the font pitch and family. |
|
FontGetProps gets the font properties. |
|
FontGetWeight gets the font weight. |
|
FontIsItalic checks if the font has the italic flag set. |
|
FontIsStrikeOut checks if the given font has the strike out flag set. |
|
FontIsUnderline checks if the given font has the underline flag set. |
See also
id-186060