Chemical Data Processing Library Python API - Version 1.1.1
Public Member Functions | Properties | List of all members
CDPL.Vis.Font Class Reference

Specifies a font for drawing text. More...

+ Inheritance diagram for CDPL.Vis.Font:

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)
 

Detailed Description

Specifies a font for drawing text.

On creation of a Font object one can specify various attributes the font should have. The attributes set in the constructor can also be set later, e.g. setFamily() and setSize(). The remaining attributes must be set after construction, e.g. setBold(), setItalic(), 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.

Constructor & Destructor Documentation

◆ __init__() [1/2]

None CDPL.Vis.Font.__init__ ( Font  font)

Initializes a copy of the Font instance font.

Parameters
fontThe Font instance to copy.

◆ __init__() [2/2]

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.

Parameters
familyThe font family name.
sizeThe font size.
boldTrue if text should be rendered bold, and False otherwise.
italicTrue if text should be rendered italicized, and False otherwise.
Since
1.1

Member Function Documentation

◆ getObjectID()

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().

Returns
The numeric ID of the internally referenced C++ class instance.

◆ assign()

Font CDPL.Vis.Font.assign ( Font  font)

Replaces the current state of self with a copy of the state of the Font instance font.

Parameters
fontThe Font instance to copy.
Returns
self

◆ setFamily()

None CDPL.Vis.Font.setFamily ( str  family)

Sets the font family name.

Parameters
familyThe font family name.

◆ getFamily()

str CDPL.Vis.Font.getFamily ( )

Returns the font family name.

Returns
The font family name.

◆ setSize()

None CDPL.Vis.Font.setSize ( float  size)

Sets the font size.

If size is negative, the font size is set to zero.

Parameters
sizeThe font size.

◆ getSize()

float CDPL.Vis.Font.getSize ( )

Returns the font size.

Returns
The font size.

◆ setBold()

None CDPL.Vis.Font.setBold ( bool  flag)

Sets or clears the flag specifying whether text should be rendered bold.

Parameters
flagTrue if text should be rendered bold, and False otherwise.

◆ isBold()

bool CDPL.Vis.Font.isBold ( )

Returns the flag specifying whether text is rendered bold.

Returns
True if text is rendered bold, and False otherwise.

◆ setItalic()

None CDPL.Vis.Font.setItalic ( bool  flag)

Sets or clears the flag specifying whether text should be rendered italicized.

Parameters
flagTrue if text should be rendered italicized, and False otherwise.

◆ isItalic()

bool CDPL.Vis.Font.isItalic ( )

Returns the flag specifying whether text is rendered italicized.

Returns
True if text is rendered italicized, and False otherwise.

◆ setUnderlined()

None CDPL.Vis.Font.setUnderlined ( bool  flag)

Sets or clears the flag specifying whether text should be rendered underlined.

Parameters
flagTrue if text should be rendered underlined, and False otherwise.

◆ isUnderlined()

bool CDPL.Vis.Font.isUnderlined ( )

Returns the flag specifying whether text is rendered underlined.

Returns
True if text is rendered underlined, and False otherwise.

◆ setOverlined()

None CDPL.Vis.Font.setOverlined ( bool  flag)

Sets or clears the flag specifying whether text should be rendered overlined.

Parameters
flagTrue if text should be rendered overlined, and False otherwise.

◆ isOverlined()

bool CDPL.Vis.Font.isOverlined ( )

Returns the flag specifying whether text is rendered overlined.

Returns
True if text is rendered overlined, and False otherwise.

◆ setStrikedOut()

None CDPL.Vis.Font.setStrikedOut ( bool  flag)

Sets or clears the flag specifying whether text should be rendered striked-out.

Parameters
flagTrue if text should be rendered striked-out, and False otherwise.

◆ isStrikedOut()

bool CDPL.Vis.Font.isStrikedOut ( )

Returns the flag specifying whether text is rendered striked-out.

Returns
True if text is rendered striked-out, and False otherwise.

◆ setFixedPitch()

None CDPL.Vis.Font.setFixedPitch ( bool  flag)

Sets or clears the fixed pitch flag.

Parameters
flagTrue if the font has a fixed pitch, and False otherwise.

◆ hasFixedPitch()

bool CDPL.Vis.Font.hasFixedPitch ( )

Returns the fixed pitch flag.

Returns
True if the font has a fixed pitch, and False otherwise.

◆ __eq__()

bool CDPL.Vis.Font.__eq__ ( Font  font)

Equality comparison operator.

Parameters
fontThe other Font object to be compared with.
Returns
True if all font attributes compare equal, and False otherwise.

◆ __ne__()

bool CDPL.Vis.Font.__ne__ ( Font  font)

Inequality comparison operator.

The result is equivalent to !(self == font).

Parameters
fontThe other Font object to be compared with.
Returns
True if one of the font attributes compares non-equal, and False otherwise.

◆ __str__()

str CDPL.Vis.Font.__str__ ( )

Returns a string representation of the Font instance.

Returns
The generated string representation.