Murl::IFont Interface Referenceabstract

The font interface. More...

#include "murl_i_font.h"

Inheritance diagram for Murl::IFont:

Public Member Functions

virtual Bool SetSize (Real size)=0
 Set the font size. More...
 
virtual Real GetSize () const =0
 Get the font size. More...
 
virtual Bool SetAscent (Real ascent)=0
 Set the ascent value. More...
 
virtual Real GetAscent () const =0
 Get the font leading value. More...
 
virtual Bool SetDescent (Real descent)=0
 Set the descent value. More...
 
virtual Real GetDescent () const =0
 Get the font leading value. More...
 
virtual Bool SetSpacing (Real spacing)=0
 Set the character spacing value. More...
 
virtual Real GetSpacing () const =0
 Get the character spacing value. More...
 
virtual Bool SetLeading (Real leading)=0
 Set the leading value. More...
 
virtual Real GetLeading () const =0
 Get the font leading value. More...
 
virtual Bool SetOffset (Real offsetX, Real offsetY)=0
 Set horizontal and vertical offsets. More...
 
virtual Bool SetOffsetX (Real offsetX)=0
 Set the horizontal offset. More...
 
virtual Bool SetOffsetY (Real offsetY)=0
 Set the vertical offset. More...
 
virtual Real GetOffsetX () const =0
 Get the horizontal offset. More...
 
virtual Real GetOffsetY () const =0
 Get the vertical offset. More...
 
virtual Bool SetRaster (Real rasterX, Real rasterY)=0
 Set horizontal and vertical raster values. More...
 
virtual Bool SetRasterX (Real rasterX)=0
 Set the horizontal raster value. More...
 
virtual Bool SetRasterY (Real rasterY)=0
 Set the vertical raster value. More...
 
virtual Real GetRasterX () const =0
 Get the horizontal raster value. More...
 
virtual Real GetRasterY () const =0
 Get the vertical raster value. More...
 
virtual Bool SetEmbolding (Real strength)=0
 Set the embolding strength value. More...
 
virtual Real GetEmbolding () const =0
 Get the embolding strength value. More...
 
virtual Bool SetBlur (Real strength)=0
 Set the blur strength value. More...
 
virtual Real GetBlur () const =0
 Get the blur strength value. More...
 
virtual Bool SetSpaceWidthFactor (Real factor)=0
 Set the space width factor. More...
 
virtual Real GetSpaceWidthFactor () const =0
 Get the space width factor. More...
 
virtual Bool SetDigitWidthFactor (Real factor)=0
 Set the digit width factor. More...
 
virtual Real GetDigitWidthFactor () const =0
 Get the digit width factor. More...
 
virtual Bool SetSameDigitWidthEnabled (Bool enabled)=0
 Enable/disable unified digit width. More...
 
virtual Bool IsSameDigitWidthEnabled () const =0
 Check if unified digit width is enabled. More...
 
virtual Bool SetLegacyEmboldingEnabled (Bool enabled)=0
 Enable/disable the legacy embolding algorithm. More...
 
virtual Bool IsLegacyEmboldingEnabled () const =0
 Check if the legacy embolding algorithm is used. More...
 
virtual Bool RenderText (const String &text, const Color &textColor, const Color &backgroundColor, Bool clearSurface, Bool enableWordWrap, Real containerPosX, Real containerPosY, Real containerSizeX, Real containerSizeY, IEnums::TextAlignmentX alignX, IEnums::TextAlignmentY alignY, IVideoSurface *surface) const =0
 Render a text into a video stream. More...
 
virtual Bool QueryTextSize (const String &text, Bool enableWordWrap, Real containerPosX, Real containerPosY, Real containerSizeX, Real containerSizeY, Real &textSizeX, Real &textSizeY) const =0
 Query the pixel dimensions of a given text. More...
 

Detailed Description

The font interface.

Member Function Documentation

◆ SetSize()

virtual Bool Murl::IFont::SetSize ( Real  size)
pure virtual

Set the font size.

Parameters
sizeThe font size.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetSize()

virtual Real Murl::IFont::GetSize ( ) const
pure virtual

Get the font size.

Returns
The font size.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetAscent()

virtual Bool Murl::IFont::SetAscent ( Real  ascent)
pure virtual

Set the ascent value.

This method sets the ascent value used for output, i.e. the vertical distance between the top of a text line and its base line. The given ascent value adds to the default value specified in the font used for rendering this text; a value of 0.0 represents the font's original ascent, a positive value increases the vertical size above the base line, and a negative value decreases it.

Parameters
ascentThe ascent value.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetAscent()

virtual Real Murl::IFont::GetAscent ( ) const
pure virtual

Get the font leading value.

Returns
The font leading value.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetDescent()

virtual Bool Murl::IFont::SetDescent ( Real  descent)
pure virtual

Set the descent value.

This method sets the descent value used for output, i.e. the vertical distance between the base line and the bottom of a text line. The given descent value adds to the default value specified in the font used for rendering this text; a value of 0.0 represents the font's original descent, a positive value increases the vertical size below the base line, and a negative value decreases it.

Parameters
descentThe descent value.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetDescent()

virtual Real Murl::IFont::GetDescent ( ) const
pure virtual

Get the font leading value.

Returns
The font leading value.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetSpacing()

virtual Bool Murl::IFont::SetSpacing ( Real  spacing)
pure virtual

Set the character spacing value.

This method sets the character spacing used for output, i.e. the horizontal distance between neighbored characters. The given spacing value adds to the default value specified in the font used for rendering this text; a value of 0.0 represents the font's original spacing, a positive value increases the horizontal distance between characters, and a negative value decreases it.

Note: The given spacing value is not scaled by the font used; if e.g. a positive value is used for a large font, the same value used with a smaller version of that same font will result in a (relatively) larger distance between characters. It is however influenced by a possible additional scaling operation performed by a text rendering object.

Note also that not all types of fonts allow setting a custom spacing value. If not supported, this method returns false.

Parameters
spacingThe character spacing value.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetSpacing()

virtual Real Murl::IFont::GetSpacing ( ) const
pure virtual

Get the character spacing value.

Returns
The character spacing value.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetLeading()

virtual Bool Murl::IFont::SetLeading ( Real  leading)
pure virtual

Set the leading value.

This method sets the leading value used for output, i.e. the vertical distance between subsequent text lines. The given leading value adds to the default value specified in the font used for rendering this text; a value of 0.0 represents the font's original leading, a positive value increases the vertical distance between lines, and a negative value decreases it.

Note: The given leading value is not scaled by the font used; if e.g. a positive value is used for a large font, the same value used with a smaller version of that same font will result in a (relatively) larger distance between lines. It is however influenced by a possible additional scaling operation performed by a text rendering object.

Parameters
leadingThe leading value.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetLeading()

virtual Real Murl::IFont::GetLeading ( ) const
pure virtual

Get the font leading value.

Returns
The font leading value.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetOffset()

virtual Bool Murl::IFont::SetOffset ( Real  offsetX,
Real  offsetY 
)
pure virtual

Set horizontal and vertical offsets.

Parameters
offsetXThe horizontal offset.
offsetYThe vertical offset.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetOffsetX()

virtual Bool Murl::IFont::SetOffsetX ( Real  offsetX)
pure virtual

Set the horizontal offset.

Parameters
offsetXThe horizontal offset.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetOffsetY()

virtual Bool Murl::IFont::SetOffsetY ( Real  offsetY)
pure virtual

Set the vertical offset.

Parameters
offsetYThe vertical offset.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetOffsetX()

virtual Real Murl::IFont::GetOffsetX ( ) const
pure virtual

Get the horizontal offset.

Returns
The horizontal offset.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetOffsetY()

virtual Real Murl::IFont::GetOffsetY ( ) const
pure virtual

Get the vertical offset.

Returns
The vertical offset.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetRaster()

virtual Bool Murl::IFont::SetRaster ( Real  rasterX,
Real  rasterY 
)
pure virtual

Set horizontal and vertical raster values.

Parameters
rasterXThe horizontal raster value.
rasterYThe vertical raster value.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetRasterX()

virtual Bool Murl::IFont::SetRasterX ( Real  rasterX)
pure virtual

Set the horizontal raster value.

Parameters
rasterXThe horizontal raster value.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetRasterY()

virtual Bool Murl::IFont::SetRasterY ( Real  rasterY)
pure virtual

Set the vertical raster value.

Parameters
rasterYThe vertical raster value.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetRasterX()

virtual Real Murl::IFont::GetRasterX ( ) const
pure virtual

Get the horizontal raster value.

Returns
The horizontal raster value.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetRasterY()

virtual Real Murl::IFont::GetRasterY ( ) const
pure virtual

Get the vertical raster value.

Returns
The vertical raster value.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetEmbolding()

virtual Bool Murl::IFont::SetEmbolding ( Real  strength)
pure virtual

Set the embolding strength value.

The embolding strength determines the "boldness" or "weight" of the font's rendered glyphs. Positive values result in thicker lines, and negative values can be used to make the font "thinner". Useful values are in the range from -1 to +1, but can also lie beyond that range.

Note that not all types of fonts allow glyph embolding. If not supported, this method returns false.

Parameters
strengthThe embolding strength value.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetEmbolding()

virtual Real Murl::IFont::GetEmbolding ( ) const
pure virtual

Get the embolding strength value.

Returns
The embolding strength value.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetBlur()

virtual Bool Murl::IFont::SetBlur ( Real  strength)
pure virtual

Set the blur strength value.

Parameters
strengthThe positive blur strength value.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetBlur()

virtual Real Murl::IFont::GetBlur ( ) const
pure virtual

Get the blur strength value.

Returns
The blur strength value.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetSpaceWidthFactor()

virtual Bool Murl::IFont::SetSpaceWidthFactor ( Real  factor)
pure virtual

Set the space width factor.

This method sets a factor used to control the actual width of the white space character. In some cases, it is useful to manually control the space character's width, when a font's default space width produces too small or too big a distance between subsequent words. A space width factor of 1.0 represents the original width defined by the font used for rendering.

Note that not all types of fonts allow setting a custom space width factor. If not supported, this method returns false.

Parameters
factorThe space width factor.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetSpaceWidthFactor()

virtual Real Murl::IFont::GetSpaceWidthFactor ( ) const
pure virtual

Get the space width factor.

Returns
The space width factor.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetDigitWidthFactor()

virtual Bool Murl::IFont::SetDigitWidthFactor ( Real  factor)
pure virtual

Set the digit width factor.

This method sets a factor used to control the horizontal advance of all digit characters of a font ('0'-'9'). A digit width factor of 1.0 represents the original width defined by the font used for rendering.

Note, that this value only influences distance and not visual width; a value of e.g. 0.1 will result in overlapping digits without actually scaling them.

Note also that not all types of fonts allow setting a custom digit width value. If not supported, this method returns false.

Parameters
factorThe digit width factor.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ GetDigitWidthFactor()

virtual Real Murl::IFont::GetDigitWidthFactor ( ) const
pure virtual

Get the digit width factor.

Returns
The digit width factor.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetSameDigitWidthEnabled()

virtual Bool Murl::IFont::SetSameDigitWidthEnabled ( Bool  enabled)
pure virtual

Enable/disable unified digit width.

For certain use cases, such as a score counter in an action game, it is useful to set a common width for all digits ('0'-'9'); doing so prevents the counter from jittering due to different digit widths. Note that not all types of fonts allow a common digit width. If not supported, this method returns false.

Parameters
enabledIf true, all digits use the same horizontal advance value.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ IsSameDigitWidthEnabled()

virtual Bool Murl::IFont::IsSameDigitWidthEnabled ( ) const
pure virtual

Check if unified digit width is enabled.

Returns
true if all digits use the same horizontal advance value.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ SetLegacyEmboldingEnabled()

virtual Bool Murl::IFont::SetLegacyEmboldingEnabled ( Bool  enabled)
pure virtual

Enable/disable the legacy embolding algorithm.

Parameters
enabledIf true, legacy embolding is used.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ IsLegacyEmboldingEnabled()

virtual Bool Murl::IFont::IsLegacyEmboldingEnabled ( ) const
pure virtual

Check if the legacy embolding algorithm is used.

Returns
true if used.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ RenderText()

virtual Bool Murl::IFont::RenderText ( const String text,
const Color textColor,
const Color backgroundColor,
Bool  clearSurface,
Bool  enableWordWrap,
Real  containerPosX,
Real  containerPosY,
Real  containerSizeX,
Real  containerSizeY,
IEnums::TextAlignmentX  alignX,
IEnums::TextAlignmentY  alignY,
IVideoSurface surface 
) const
pure virtual

Render a text into a video stream.

Parameters
textThe text to render.
textColorThe text color to render.
backgroundColorThe text background color to render.
clearSurfaceIf true, the output surface is cleared before rendering.
enableWordWrapIf true, word wrapping is enabled.
containerPosXThe horizontal text position in the video stream.
containerPosYThe vertical text position in the video stream.
containerSizeXThe horizontal size of the text rectangle, or 0 if the video stream's X size should be used
containerSizeYThe vertical size of the text rectangle, or 0 if the video stream's Y size should be used
alignXThe horizontal text alignment.
alignYThe vertical text alignment.
surfaceThe destination video surface.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.

◆ QueryTextSize()

virtual Bool Murl::IFont::QueryTextSize ( const String text,
Bool  enableWordWrap,
Real  containerPosX,
Real  containerPosY,
Real  containerSizeX,
Real  containerSizeY,
Real textSizeX,
Real textSizeY 
) const
pure virtual

Query the pixel dimensions of a given text.

Parameters
textThe text to query.
enableWordWrapIf true, word wrapping is enabled.
containerPosXThe horizontal text position in the video stream.
containerPosYThe vertical text position in the video stream.
containerSizeXThe horizontal size of the text rectangle, or 0 if the video stream's X size should be used
containerSizeYThe vertical size of the text rectangle, or 0 if the video stream's Y size should be used
textSizeXThe text width return value.
textSizeYThe text height return value.
Returns
true if successful.

Implemented in Murl::Util::FontCollection, and Murl::Util::Font.


The documentation for this interface was generated from the following file:
  • murl_i_font.h


Copyright © 2011-2025 Spraylight GmbH.