Kanzi  3.9.9
Kanzi Engine C++ API
kanzi::FontStyleDefinition Class Reference

FontStyleDefinition provides a collection of font characteristics. More...

#include <kanzi/core.ui/font/font_style_definition.hpp>

Public Member Functions

void enableFractionalCharacterWidth (bool enable)
 Sets whether Kanzi uses fractional or rounded character widths to lay out text. More...
 
void enableSnapCharacterToPixel (bool enable)
 Sets whether text rendering snaps character to pixel. More...
 
 FontStyleDefinition ()=default
 Constructor. More...
 
 FontStyleDefinition (const FontStyleDefinition &origin)=default
 Copy constructor. More...
 
float getCharacterSpacing () const
 Gets the character spacing used with the font. More...
 
float getFixedCharacterWidth () const
 Gets the fixed character width. More...
 
size_t getHash () const
 Gets a hash value calculated from the current values of the font style definition. More...
 
FontHintingPreference getHintingPreference () const
 Gets the hinting preference of the font. More...
 
float getLineSpacing () const
 Gets the line spacing used with the font. More...
 
float getSize () const
 Gets the size of the font in pixels. More...
 
FontStyle getStyle () const
 Gets the style of the font. More...
 
FontWeight getWeight () const
 Gets the weight of the font. More...
 
bool isFractionalCharacterWidthEnabled () const
 Returns whether Kanzi uses fractional or rounded character widths to lay out text. More...
 
bool isShapingEnabled () const
 Indicates whether bidirectional text and text shaping are enabled for the font. More...
 
bool isSnapCharacterToPixelEnabled () const
 Returns whether text rendering snaps character to pixel. More...
 
bool operator!= (const FontStyleDefinition &other) const
 Compares values with another FontStyleDefinition object. More...
 
FontStyleDefinitionoperator= (const FontStyleDefinition &origin)=default
 Assignment operation. More...
 
bool operator== (const FontStyleDefinition &other) const
 Compares values with another FontStyleDefinition object. More...
 
void setCharacterSpacing (float characterSpacing)
 Sets the character spacing in pixels. More...
 
void setFixedCharacterWidth (float fixedCharacterWidth)
 Sets the fixed character width in pixels. More...
 
void setHintingPreference (FontHintingPreference hintingPreference)
 Sets the hinting preference of the font. More...
 
void setLineSpacing (float lineSpacing)
 Sets the line spacing. More...
 
void setShapingEnabled (bool shapingEnabled)
 Sets support for complex scripts. More...
 
void setSize (float size)
 Sets the size of the font in pixels. More...
 
void setStyle (FontStyle style)
 Sets the style of the font. More...
 
void setWeight (FontWeight weight)
 Sets the weight of the font. More...
 

Detailed Description

FontStyleDefinition provides a collection of font characteristics.

Since
Kanzi 3.8.0

Constructor & Destructor Documentation

kanzi::FontStyleDefinition::FontStyleDefinition ( )
explicitdefault

Constructor.

kanzi::FontStyleDefinition::FontStyleDefinition ( const FontStyleDefinition origin)
default

Copy constructor.

Member Function Documentation

FontStyleDefinition& kanzi::FontStyleDefinition::operator= ( const FontStyleDefinition origin)
default

Assignment operation.

bool kanzi::FontStyleDefinition::operator== ( const FontStyleDefinition other) const

Compares values with another FontStyleDefinition object.

bool kanzi::FontStyleDefinition::operator!= ( const FontStyleDefinition other) const

Compares values with another FontStyleDefinition object.

float kanzi::FontStyleDefinition::getSize ( ) const

Gets the size of the font in pixels.

Returns
Size of the font in pixels.
void kanzi::FontStyleDefinition::setSize ( float  size)

Sets the size of the font in pixels.

Parameters
sizeSize of the font in pixels.
FontStyle kanzi::FontStyleDefinition::getStyle ( ) const

Gets the style of the font.

Returns
Style of the font.
void kanzi::FontStyleDefinition::setStyle ( FontStyle  style)

Sets the style of the font.

Parameters
styleStyle of the font.
FontWeight kanzi::FontStyleDefinition::getWeight ( ) const

Gets the weight of the font.

Returns
Weight of the font.
void kanzi::FontStyleDefinition::setWeight ( FontWeight  weight)

Sets the weight of the font.

Parameters
weightWeight of the font.
float kanzi::FontStyleDefinition::getCharacterSpacing ( ) const

Gets the character spacing used with the font.

Character spacing is additional spacing in pixels that is added between each character.

Returns
Character spacing in pixels.
void kanzi::FontStyleDefinition::setCharacterSpacing ( float  characterSpacing)

Sets the character spacing in pixels.

Parameters
characterSpacingCharacter spacing in pixels.
float kanzi::FontStyleDefinition::getFixedCharacterWidth ( ) const

Gets the fixed character width.

Returns
Fixed width of character in pixels.
void kanzi::FontStyleDefinition::setFixedCharacterWidth ( float  fixedCharacterWidth)

Sets the fixed character width in pixels.

To disable fixed character width, use a negative value.

Parameters
fixedCharacterWidthFixed width of character to use.
bool kanzi::FontStyleDefinition::isShapingEnabled ( ) const

Indicates whether bidirectional text and text shaping are enabled for the font.

When disabled, basic layouting is used.

Returns
If bidirectional text and text shaping are enabled, true, otherwise false.
void kanzi::FontStyleDefinition::setShapingEnabled ( bool  shapingEnabled)

Sets support for complex scripts.

This includes support for bidirectional text, and languages that require ligatures or glyph substitution.

Parameters
shapingEnabledTrue to enable shaping.
float kanzi::FontStyleDefinition::getLineSpacing ( ) const

Gets the line spacing used with the font.

Returned line spacing is in multiples of line height.

Returns
Line spacing used with the font.
void kanzi::FontStyleDefinition::setLineSpacing ( float  lineSpacing)

Sets the line spacing.

The value is relative to the font height. For example, 1 is normal spacing and 2 is double spacing.

Parameters
lineSpacingLine spacing to use.
bool kanzi::FontStyleDefinition::isFractionalCharacterWidthEnabled ( ) const

Returns whether Kanzi uses fractional or rounded character widths to lay out text.

Returns
If the text layouting uses fractional character widths, true, otherwise false.
Since
Kanzi 3.9.0
void kanzi::FontStyleDefinition::enableFractionalCharacterWidth ( bool  enable)

Sets whether Kanzi uses fractional or rounded character widths to lay out text.

Parameters
enableTo use fractional character widths, set to true. To use rounded character widths, set to false.
Since
Kanzi 3.9.0
bool kanzi::FontStyleDefinition::isSnapCharacterToPixelEnabled ( ) const

Returns whether text rendering snaps character to pixel.

Returns
If the text rendering snaps character to pixel, true, otherwise false.
Since
Kanzi 3.9.0
void kanzi::FontStyleDefinition::enableSnapCharacterToPixel ( bool  enable)

Sets whether text rendering snaps character to pixel.

Parameters
enableTo snap character to pixel, set to true.
Since
Kanzi 3.9.0
void kanzi::FontStyleDefinition::setHintingPreference ( FontHintingPreference  hintingPreference)

Sets the hinting preference of the font.

Parameters
hintingPreferenceThe hinting preference of the font.
Since
Kanzi 3.9.0
FontHintingPreference kanzi::FontStyleDefinition::getHintingPreference ( ) const

Gets the hinting preference of the font.

Returns
The hinting preference of the font.
Since
Kanzi 3.9.0
size_t kanzi::FontStyleDefinition::getHash ( ) const

Gets a hash value calculated from the current values of the font style definition.

Returns
A hash value calculated from the current values of the font style definition.

The documentation for this class was generated from the following file: