Chemical Data Processing Library Python API - Version 1.2.0
|
Specifies a font for drawing text. More...
Public Member Functions | |
None | __init__ () |
Constructs a font object with an unspecified family name and a font size of 12.0. | |
None | __init__ (Font font) |
Initializes a copy of the Font instance font. More... | |
None | __init__ (str family, float size=12.0, bool bold=False, bool italic=False) |
Constructs a font object with the specified font family name and font size. More... | |
int | getObjectID () |
Returns the numeric identifier (ID) of the wrapped C++ class instance. More... | |
Font | assign (Font font) |
Replaces the current state of self with a copy of the state of the Font instance font. More... | |
None | setFamily (str family) |
Sets the font family name. More... | |
str | getFamily () |
Returns the font family name. More... | |
None | setSize (float size) |
Sets the font size. More... | |
float | getSize () |
Returns the font size. More... | |
None | setBold (bool flag) |
Sets or clears the flag specifying whether text should be rendered bold. More... | |
bool | isBold () |
Returns the flag specifying whether text is rendered bold. More... | |
None | setItalic (bool flag) |
Sets or clears the flag specifying whether text should be rendered italicized. More... | |
bool | isItalic () |
Returns the flag specifying whether text is rendered italicized. More... | |
None | setUnderlined (bool flag) |
Sets or clears the flag specifying whether text should be rendered underlined. More... | |
bool | isUnderlined () |
Returns the flag specifying whether text is rendered underlined. More... | |
None | setOverlined (bool flag) |
Sets or clears the flag specifying whether text should be rendered overlined. More... | |
bool | isOverlined () |
Returns the flag specifying whether text is rendered overlined. More... | |
None | setStrikedOut (bool flag) |
Sets or clears the flag specifying whether text should be rendered striked-out. More... | |
bool | isStrikedOut () |
Returns the flag specifying whether text is rendered striked-out. More... | |
None | setFixedPitch (bool flag) |
Sets or clears the fixed pitch flag. More... | |
bool | hasFixedPitch () |
Returns the fixed pitch flag. More... | |
bool | __eq__ (Font font) |
Equality comparison operator. More... | |
bool | __ne__ (Font font) |
Inequality comparison operator. More... | |
str | __str__ () |
Returns a string representation of the Font instance. More... | |
Properties | |
objectID = property(getObjectID) | |
family = property(getFamily, setFamily) | |
size = property(getSize, setSize) | |
bold = property(isBold, setBold) | |
italic = property(isItalic, setItalic) | |
underlined = property(isUnderlined, setUnderlined) | |
overlined = property(isOverlined, setOverlined) | |
strikedOut = property(isStrikedOut, setStrikedOut) | |
fixedPitch = property(hasFixedPitch, setFixedPitch) | |
Specifies a font for drawing text.
On creation of a Font
object one can specify various attributes the font should have. Attributes set in the constructor can also be set later, e.g. setFamily() and setSize(). Some attributes can only be specified after construction by the corresponding methods setUnderlined(), setOverlined(), setStrikedOut() and setFixedPitch(). The corresponding getter methods like getFamily() and getSize() return the values that were set, even though the values used may differ. Renderer2D implementations generally will use the font with the specified attributes, or if no exactly matching font exists, they will take the closest matching available font.
None CDPL.Vis.Font.__init__ | ( | Font | font | ) |
Initializes a copy of the Font instance font.
font | The Font instance to copy. |
None CDPL.Vis.Font.__init__ | ( | str | family, |
float | size = 12.0 , |
||
bool | bold = False , |
||
bool | italic = False |
||
) |
Constructs a font object with the specified font family name and font size.
If size is negative, the font size is set to zero.
family | The font family name. |
size | The font size. |
bold | True if text should be rendered bold, and False otherwise. |
italic | True if text should be rendered italicized, and False otherwise. |
int CDPL.Vis.Font.getObjectID | ( | ) |
Returns the numeric identifier (ID) of the wrapped C++ class instance.
Different Python Font instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b
thus cannot tell reliably whether the two Font instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID()
.
Replaces the current state of self with a copy of the state of the Font instance font.
font | The Font instance to copy. |
None CDPL.Vis.Font.setFamily | ( | str | family | ) |
Sets the font family name.
family | The font family name. |
str CDPL.Vis.Font.getFamily | ( | ) |
Returns the font family name.
None CDPL.Vis.Font.setSize | ( | float | size | ) |
Sets the font size.
If size is negative, the font size is set to zero.
size | The font size. |
float CDPL.Vis.Font.getSize | ( | ) |
Returns the font size.
None CDPL.Vis.Font.setBold | ( | bool | flag | ) |
Sets or clears the flag specifying whether text should be rendered bold.
flag | True if text should be rendered bold, and False otherwise. |
bool CDPL.Vis.Font.isBold | ( | ) |
Returns the flag specifying whether text is rendered bold.
True
if text is rendered bold, and False
otherwise. None CDPL.Vis.Font.setItalic | ( | bool | flag | ) |
Sets or clears the flag specifying whether text should be rendered italicized.
flag | True if text should be rendered italicized, and False otherwise. |
bool CDPL.Vis.Font.isItalic | ( | ) |
Returns the flag specifying whether text is rendered italicized.
True
if text is rendered italicized, and False
otherwise. None CDPL.Vis.Font.setUnderlined | ( | bool | flag | ) |
Sets or clears the flag specifying whether text should be rendered underlined.
flag | True if text should be rendered underlined, and False otherwise. |
bool CDPL.Vis.Font.isUnderlined | ( | ) |
Returns the flag specifying whether text is rendered underlined.
True
if text is rendered underlined, and False
otherwise. None CDPL.Vis.Font.setOverlined | ( | bool | flag | ) |
Sets or clears the flag specifying whether text should be rendered overlined.
flag | True if text should be rendered overlined, and False otherwise. |
bool CDPL.Vis.Font.isOverlined | ( | ) |
Returns the flag specifying whether text is rendered overlined.
True
if text is rendered overlined, and False
otherwise. None CDPL.Vis.Font.setStrikedOut | ( | bool | flag | ) |
Sets or clears the flag specifying whether text should be rendered striked-out.
flag | True if text should be rendered striked-out, and False otherwise. |
bool CDPL.Vis.Font.isStrikedOut | ( | ) |
Returns the flag specifying whether text is rendered striked-out.
True
if text is rendered striked-out, and False
otherwise. None CDPL.Vis.Font.setFixedPitch | ( | bool | flag | ) |
Sets or clears the fixed pitch flag.
flag | True if the font has a fixed pitch, and False otherwise. |
bool CDPL.Vis.Font.hasFixedPitch | ( | ) |
Returns the fixed pitch flag.
True
if the font has a fixed pitch, and False
otherwise. bool CDPL.Vis.Font.__eq__ | ( | Font | font | ) |
Equality comparison operator.
font | The other Font object to be compared with. |
True
if all font attributes compare equal, and False
otherwise. bool CDPL.Vis.Font.__ne__ | ( | Font | font | ) |
Inequality comparison operator.
The result is equivalent to !(self == font)
.
font | The other Font object to be compared with. |
True
if one of the font attributes compares non-equal, and False
otherwise. str CDPL.Vis.Font.__str__ | ( | ) |
Returns a string representation of the Font instance.