|
CeresEngine 0.2.0
A game development framework
|
The representation of a font in the engine. More...
#include <CeresEngine/Text/Font.hpp>
Public Member Functions | |
| Font (const FilePath &fontFile, FontSize size) | |
| ~Font () override | |
| double | getPointSize () const |
| The point size of the font. | |
| bool | isFixedPitch () const |
| A Boolean value indicating whether all glyphs in the font have the same advancement. | |
| UInt32 | getNumberOfGlyphs () const |
| The number of glyphs in the font. Glyphs are numbered starting at 0. | |
| UInt32 | getControlGlyph () const |
| The reserved code for a control glyph. | |
| UInt32 | getNullGlyph () const |
| The reserved code for a null glyph. | |
| String | getDisplayName () const |
| The name of the font, including family and face names, to use when displaying the font information to the user. | |
| String | getFamilyName () const |
| The family name of the font—for example, "Times" or "Helvetica.". | |
| String | getFontName () const |
| The full name of the font, as used in PostScript language code—for example, "Times-Roman" or "Helvetica-Oblique.". | |
| FontRenderingMode | getRenderingMode () const |
| The rendering mode of the font. | |
| Size2 | getAdvancement (Glyph aGlyph) const |
| Returns the nominal spacing for the given glyph—the distance the current point moves after showing the glyph—accounting for the receiver’s size. | |
| Rect2 | getBoundingRect (Glyph aGlyph) const |
| Returns the bounding rectangle for the specified glyph, scaled to the receiver’s size. | |
| Rect2 | getUV (Glyph aGlyph) const |
| Vector< Size2 > | getAdvancements (const Span< Glyph > &glyphs) const |
| Returns an array of the advancements for the specified glyphs rendered by the receiver. | |
| void | getAdvancements (const Span< Glyph > &glyphs, TemporaryVector< Size2 > &advancements) |
| Vector< Size2 > | getPackedAdvancements (const Span< Glyph > &packedGlyphs) const |
| Returns an array of the advancements for the specified packed glyphs and rendered by the receiver. | |
| void | getPackedAdvancements (const Span< Glyph > &packedGlyphs, TemporaryVector< Size2 > &packedAdvancements) const |
| Vector< Rect2 > | getBoundingRects (const Span< Glyph > &glyphs) const |
| Returns an array of the bounding rectangles for the specified glyphs rendered by the receiver. | |
| void | getBoundingRects (const Span< Glyph > &glyphs, TemporaryVector< Rect2 > &boundingRects) const |
| Glyph | getGlyph (StringView glyphName) const |
Returns the named encoded glyph, or –1 if the receiver contains no such glyph. | |
| BezierPath | getPathForGlyph (Glyph glyph) const |
| void | prepareCharacterSet (StringView characterSet) |
| void | prepareCharacterSet (StringView characterSet, double pointSize, const AffineTransform &transform) |
Prepares the set of characters in characterSet for rendering. | |
Public Member Functions inherited from CeresEngine::TResource< Font > | |
| ResourceHandle< Font > | getResourceHandle () const noexcept |
| Generates a hash for the provided type. | |
| SPtr< Font > | getShared () noexcept |
| Gets a shared pointer to the resource. | |
| SPtr< const Font > | getShared () const noexcept |
| Gets a shared pointer to the resource. | |
| const ResourceTypeInfo & | getResourceType () const noexcept override |
| Returns the resource type information descriptor. | |
| TResource (ResourceData &data, InputStream &dataStream) | |
| void | serialize (OutputStream &dataStream) const override |
Serializes a resource by writing data to dataStream. | |
Public Member Functions inherited from CeresEngine::Resource | |
| Resource () | |
Default constructor for the Resource class. | |
| Resource (ResourceData &data) | |
Creates a new Resource instance by passing a ResourceData instance. | |
| virtual | ~Resource () noexcept=default |
Resource virtual destructor. | |
| ResourceManager * | getResourceManager () const noexcept |
| HResource | getResourceHandle () const noexcept |
| Generates a hash for the provided type. | |
| UUID | getResourceID () const noexcept |
| HResource | getParentResource () const noexcept |
| A parent resource to which this resource is attached to. | |
| SPtr< ResourceMetadata > | getResourceMetadata () const noexcept |
| A pointer to the user-defined resource metadata. | |
| const PackagePtr & | getPackage () const noexcept |
| The package from which the resource was loaded from. | |
| template<typename T = Resource> | |
| SPtr< T > | getShared () noexcept |
| Gets a shared pointer to the resource. | |
| template<typename T = Resource> | |
| SPtr< const T > | getShared () const noexcept |
| Gets a shared pointer to the resource. | |
| Resource (ResourceData &data, InputStream &dataStream) | |
Creates a new resource by reading data from dataStream. | |
Public Member Functions inherited from CeresEngine::IReflectable | |
| virtual | ~IReflectable () noexcept=default |
Public Attributes | |
| Map< Glyph, Rect2 > | uvMap |
| SPtr< Texture > | image |
Private Attributes | |
| FontSize | mSize |
| void * | handle |
| Vector2 | mFontUnitScale |
| FontProperties | mProperties |
Additional Inherited Members | |
Static Public Member Functions inherited from CeresEngine::Resource | |
| template<typename Processor > | |
| static constexpr void | reflect (Processor &&RTTI) |
| Executes the given processor for every field of the struct. | |
Protected Member Functions inherited from CeresEngine::Resource | |
| HResourceStream | createStream (const ResourceStreamFlags &flags=ResourceStreamFlag::Default) |
| Creates a new resource stream. | |
| void | destroyStream (HResourceStream &stream) |
| Destroys a stream. | |
| void | markAsDirty () |
| Marks the resource as dirty. | |
The representation of a font in the engine.
Font objects represent fonts in the engine, providing access to characteristics of the font and assistance in laying out glyphs relative to one another.
|
override |
| Size2 CeresEngine::Font::getAdvancement | ( | Glyph | aGlyph | ) | const |
Returns the nominal spacing for the given glyph—the distance the current point moves after showing the glyph—accounting for the receiver’s size.
This spacing is given according to the glyph’s movement direction, which is either strictly horizontal or strictly vertical.
| aGlyph | The glyph whose advancement is returned. |
Returns an array of the advancements for the specified glyphs rendered by the receiver.
Returns in advancements an array of the advancements for the glyphs specified by glyphs and rendered by the receiver.
| void CeresEngine::Font::getAdvancements | ( | const Span< Glyph > & | glyphs, |
| TemporaryVector< Size2 > & | advancements | ||
| ) |
| Rect2 CeresEngine::Font::getBoundingRect | ( | Glyph | aGlyph | ) | const |
Returns the bounding rectangle for the specified glyph, scaled to the receiver’s size.
Returns an array of the bounding rectangles for the specified glyphs rendered by the receiver.
Returns in bounds an array of the bounding rectangles for the glyphs specified by glyphs and rendered by the receiver.
| void CeresEngine::Font::getBoundingRects | ( | const Span< Glyph > & | glyphs, |
| TemporaryVector< Rect2 > & | boundingRects | ||
| ) | const |
| UInt32 CeresEngine::Font::getControlGlyph | ( | ) | const |
The reserved code for a control glyph.
| String CeresEngine::Font::getDisplayName | ( | ) | const |
The name of the font, including family and face names, to use when displaying the font information to the user.
| String CeresEngine::Font::getFamilyName | ( | ) | const |
The family name of the font—for example, "Times" or "Helvetica.".
The value in this property is intended for an application’s internal usage and not for display. To get a name that you can display to the user, use getDisplayName() instead.
| String CeresEngine::Font::getFontName | ( | ) | const |
The full name of the font, as used in PostScript language code—for example, "Times-Roman" or "Helvetica-Oblique.".
The value in this property is intended for an application’s internal usage and not for display. To get a name that you can display to the user, use getDisplayName() instead.
| Glyph CeresEngine::Font::getGlyph | ( | StringView | glyphName | ) | const |
Returns the named encoded glyph, or –1 if the receiver contains no such glyph.
Returns –1 if the glyph named glyphName isn’t encoded.
Glyph names in fonts do not always accurately identify the glyph. The layout manager, an instance of TextLayoutManager, finds the correspondence between characters and glyphs.
| glyphName | The name of the glyph. |
| UInt32 CeresEngine::Font::getNullGlyph | ( | ) | const |
The reserved code for a null glyph.
| UInt32 CeresEngine::Font::getNumberOfGlyphs | ( | ) | const |
The number of glyphs in the font. Glyphs are numbered starting at 0.
| Vector< Size2 > CeresEngine::Font::getPackedAdvancements | ( | const Span< Glyph > & | packedGlyphs | ) | const |
Returns an array of the advancements for the specified packed glyphs and rendered by the receiver.
Returns in advancements an array of the advancements for the packed glyphs specified by packedGlyphs and rendered by the receiver.
| void CeresEngine::Font::getPackedAdvancements | ( | const Span< Glyph > & | packedGlyphs, |
| TemporaryVector< Size2 > & | packedAdvancements | ||
| ) | const |
| BezierPath CeresEngine::Font::getPathForGlyph | ( | Glyph | glyph | ) | const |
| double CeresEngine::Font::getPointSize | ( | ) | const |
The point size of the font.
If the font has a nonstandard matrix, the point size is the effective vertical point size.
| FontRenderingMode CeresEngine::Font::getRenderingMode | ( | ) | const |
The rendering mode of the font.
For a list of valid rendering modes, see FontRenderingMode.
| Rect2 CeresEngine::Font::getUV | ( | Glyph | aGlyph | ) | const |
| bool CeresEngine::Font::isFixedPitch | ( | ) | const |
A Boolean value indicating whether all glyphs in the font have the same advancement.
The value of this property is true when all glyphs have the same advancement or false when they do not.
| void CeresEngine::Font::prepareCharacterSet | ( | StringView | characterSet | ) |
| void CeresEngine::Font::prepareCharacterSet | ( | StringView | characterSet, |
| double | pointSize, | ||
| const AffineTransform & | transform | ||
| ) |
Prepares the set of characters in characterSet for rendering.
| pointSize | The font sie, in points, as used in the layout calculation. |
| transform | A transform to be applied to the each character pointSize. |
|
private |
|
private |
|
private |
|
private |