The font interface. More...
#include "murl_i_font.h"
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 | 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 | 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()
Set the font size.
- Parameters
-
size The font size.
- Returns
- true if successful.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ GetSize()
|
pure virtual |
Get the font size.
- Returns
- The font size.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ SetSpacing()
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
-
spacing The character spacing value.
- Returns
- true if successful.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ GetSpacing()
|
pure virtual |
Get the character spacing value.
- Returns
- The character spacing value.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ SetLeading()
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
-
leading The leading value.
- Returns
- true if successful.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ GetLeading()
|
pure virtual |
Get the font leading value.
- Returns
- The font leading value.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ SetEmbolding()
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
-
strength The embolding strength value.
- Returns
- true if successful.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ GetEmbolding()
|
pure virtual |
Get the embolding strength value.
- Returns
- The embolding strength value.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ SetBlur()
Set the blur strength value.
- Parameters
-
strength The positive blur strength value.
- Returns
- true if successful.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ GetBlur()
|
pure virtual |
Get the blur strength value.
- Returns
- The blur strength value.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ SetSpaceWidthFactor()
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
-
factor The space width factor.
- Returns
- true if successful.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ GetSpaceWidthFactor()
|
pure virtual |
Get the space width factor.
- Returns
- The space width factor.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ SetDigitWidthFactor()
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
-
factor The digit width factor.
- Returns
- true if successful.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ GetDigitWidthFactor()
|
pure virtual |
Get the digit width factor.
- Returns
- The digit width factor.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ SetSameDigitWidthEnabled()
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
-
enabled If true, all digits use the same horizontal advance value.
- Returns
- true if successful.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ IsSameDigitWidthEnabled()
|
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()
Enable/disable the legacy embolding algorithm.
- Parameters
-
enabled If true, legacy embolding is used.
- Returns
- true if successful.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ IsLegacyEmboldingEnabled()
|
pure virtual |
Check if the legacy embolding algorithm is used.
- Returns
- true if used.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ RenderText()
|
pure virtual |
Render a text into a video stream.
- Parameters
-
text The text to render. textColor The text color to render. backgroundColor The text background color to render. clearSurface If true, the output surface is cleared before rendering. enableWordWrap If true, word wrapping is enabled. containerPosX The horizontal text position in the video stream. containerPosY The vertical text position in the video stream. containerSizeX The horizontal size of the text rectangle, or 0 if the video stream's X size should be used containerSizeY The vertical size of the text rectangle, or 0 if the video stream's Y size should be used alignX The horizontal text alignment. alignY The vertical text alignment. surface The destination video surface.
- Returns
- true if successful.
Implemented in Murl::Util::FontCollection, and Murl::Util::Font.
◆ QueryTextSize()
|
pure virtual |
Query the pixel dimensions of a given text.
- Parameters
-
text The text to query. enableWordWrap If true, word wrapping is enabled. containerPosX The horizontal text position in the video stream. containerPosY The vertical text position in the video stream. containerSizeX The horizontal size of the text rectangle, or 0 if the video stream's X size should be used containerSizeY The vertical size of the text rectangle, or 0 if the video stream's Y size should be used textSizeX The text width return value. textSizeY The 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