OEFont

class OEFont

The OEFont class encapsulates properties that determine the display style of texts.

Currently the OEFont class stores the following properties:

Property

Get method

Set method

Corresponding namespace/class/type

alignment

GetAlignment

SetAlignment

OEAlignment

color

GetColor

SetColor

OEColor

font family

GetFamily

SetFamily

OEFontFamily

font size

GetSize

SetSize

None

font style

GetStyle

SetStyle

OEFontStyle

hyperlink

GetHyperlink / HasHyperlink

SetHyperlink

string

rotation angle

GetRotationAngle

SetRotationAngle

floating point number in range of \([0.0^{\circ}, 360.0^{\circ}]\)

See also

Constructors

OEFont() -> OEFont

Default constructor that initializes an OEFont object with the following properties: See example in Figure: Example of drawing text with default OEFont object.

Default parameters of OEFont

Property

Default value

alignment

OEAlignment_Default

color

OEBlack = OEColor(0,0,0)

font family

OEFontFamily_Default

font size

12

hyperlink

empty string (i.e. no hyperlink)

font style

OEFontStyle_Default

rotation angles

0.0 (i.e. no rotation)

../../_images/OEFont_Default.png

Example of drawing text with default OEFont object

OEFont(color: OEColor) -> OEFont

Constructor that initializes an OEFont object with the default parameters and the given OEColor.

OEFont(family: int, style: int, size: int, align: int,
       color: OEColor, rotangle: float = 0.0) -> OEFont

Constructor that initializes an OEFont object with the given parameters.

family

The family of the font. This value has to be from the OEFontFamily namespace. See also OEFont.SetFamily method.

style

The style of the font. This value has to be from the OEFontStyle namespace. See also OEFont.SetSize method.

size

The size of the font. See also OEFont.SetSize method.

align

The alignment of the text. This value has to be from the OEAlignment namespace. See also OEFont.SetAlignment method.

color

The color of the font. See also OEFont.SetColor method.

rotangle

The rotation angle of the text. The default value is 0.0 which means no rotation is applied i.e. the text using the OEFont object is rendered horizontally. See also OEFont.SetRotationAngle method.

OEFont(arg2: OEFont) -> OEFont

Copy constructors.

GetAlignment

GetAlignment() -> int

Returns the alignment property of the OEFont object. The returned value is taken from the OEAlignment namespace.

See also

GetColor

GetColor() -> OEColor

Returns the color of the OEFont object.

See also

GetFamily

GetFamily() -> int

Returns the font family property of the OEFont object. The returned value is taken from the OEFontFamily namespace.

See also

GetRotationAngle

GetRotationAngle() -> float

Returns the angle of the rotation that is used to render a text when using the OEFont object.

See also

GetSize

GetSize() -> int

Returns the size of the OEFont object.

See also

GetStyle

GetStyle() -> int

Returns the font style property of the OEFont object. The returned value is taken from the OEFontStyle namespace.

See also

SetAlignment

SetAlignment(arg2: int) -> None

Sets the alignment property of the OEFont object.

align

This value has to be from the OEAlignment namespace.

Example (Figure: Example of using the SetAlignment method)

font = oedepict.OEFont()
font.SetAlignment(oedepict.OEAlignment_Right)
../../_images/OEFont_SetAlignment.png

Example of using the SetAlignment method

See also

SetColor

SetColor(color: OEColor) -> None

Sets the color of the OEFont object.

Example (Figure: Example of using the SetColor method)

font = oedepict.OEFont()
font.SetColor(oechem.OERed)
../../_images/OEFont_SetColor.png

Example of using the SetColor method

See also

SetFamily

SetFamily(arg2: int) -> None

Sets the font family property of the OEFont object.

family

This value has to be from the OEFontFamily namespace.

Example (Figure: Example of using the SetFamily method)

font = oedepict.OEFont()
font.SetFamily(oedepict.OEFontFamily_Times)
../../_images/OEFont_SetFamily.png

Example of using the SetFamily method

See also

SetRotationAngle

SetRotationAngle(arg2: float) -> None

Sets the rotation angle of the OEFont object.

angle

The rotation angle of the text (in degrees). The value of the angle has to be in a range of \([0.0^{\circ}, 360.0^{\circ}]\).

Example (Figure: Example of using the SetRotationAngle method)

font = oedepict.OEFont()
font.SetRotationAngle(180.0)
../../_images/OEFont_SetRotationAngle.png

Example of using the SetRotationAngle method

Note

The angles are interpreted in an anti-clockwise direction. The \(0.0^{\circ}\) and \(360.0^{\circ}\) degrees are at the 3 o’clock position i.e. the text is rendered horizontally. While the \(180.0^{\circ}\) degrees corresponds to rendering the text upside down. See examples in Figure: Example of drawing texts with various rotation angle.

../../_images/OEImageBase-DrawText-Rotations.png

Example of drawing texts with various rotation angles

See also

SetSize

SetSize(arg2: int) -> None

Sets the size of the OEFont object.

Example (Figure: Example of using the SetSize method)

font = oedepict.OEFont()
font.SetSize(30)
../../_images/OEFont_SetSize.png

Example of using the SetSize method

See also

SetStyle

SetStyle(arg2: int) -> None

Sets the font style property (such as bold, italic etc.) of the OEFont object.

style

This value has to be from the OEFontStyle namespace.

Example (Figure: Example of using the SetStyle method)

font = oedepict.OEFont()
font.SetStyle(oedepict.OEFontStyle_Bold | oedepict.OEFontStyle_Italic)
../../_images/OEFont_SetStyle.png

Example of using the SetStyle method

See also