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

Detailed Description

FontStyleDefinition provides a collection of font characteristics.

Since
Kanzi 3.8.0

Constructor & Destructor Documentation

◆ FontStyleDefinition() [1/2]

kanzi::FontStyleDefinition::FontStyleDefinition ( )
explicitdefault

Constructor.

◆ FontStyleDefinition() [2/2]

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

Copy constructor.

Member Function Documentation

◆ operator=()

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

Assignment operation.

◆ operator==()

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

Compares values with another FontStyleDefinition object.

◆ operator!=()

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

Compares values with another FontStyleDefinition object.

◆ getSize()

float kanzi::FontStyleDefinition::getSize ( ) const

Gets the size of the font in pixels.

Returns
Size of the font in pixels.

◆ setSize()

void kanzi::FontStyleDefinition::setSize ( float size)

Sets the size of the font in pixels.

Parameters
sizeSize of the font in pixels.

◆ getStyle()

FontStyle kanzi::FontStyleDefinition::getStyle ( ) const

Gets the style of the font.

Returns
Style of the font.

◆ setStyle()

void kanzi::FontStyleDefinition::setStyle ( FontStyle style)

Sets the style of the font.

Parameters
styleStyle of the font.

◆ getWeight()

FontWeight kanzi::FontStyleDefinition::getWeight ( ) const

Gets the weight of the font.

Returns
Weight of the font.

◆ setWeight()

void kanzi::FontStyleDefinition::setWeight ( FontWeight weight)

Sets the weight of the font.

Parameters
weightWeight of the font.

◆ getCharacterSpacing()

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.

◆ setCharacterSpacing()

void kanzi::FontStyleDefinition::setCharacterSpacing ( float characterSpacing)

Sets the character spacing in pixels.

Parameters
characterSpacingCharacter spacing in pixels.

◆ getFixedCharacterWidth()

float kanzi::FontStyleDefinition::getFixedCharacterWidth ( ) const

Gets the fixed character width.

Returns
Fixed width of character in pixels.

◆ setFixedCharacterWidth()

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.

◆ isShapingEnabled()

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.

◆ setShapingEnabled()

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.

◆ getLineSpacing()

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.

◆ setLineSpacing()

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.

◆ isFractionalCharacterWidthEnabled()

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

◆ enableFractionalCharacterWidth()

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

◆ isSnapCharacterToPixelEnabled()

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

◆ enableSnapCharacterToPixel()

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

◆ setHintingPreference()

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

◆ getHintingPreference()

FontHintingPreference kanzi::FontStyleDefinition::getHintingPreference ( ) const

Gets the hinting preference of the font.

Returns
The hinting preference of the font.
Since
Kanzi 3.9.0

◆ getHash()

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: