Om
1.0.0
A universal framework for multimedia simulation
|
A class that acts as an interface to a single text style. More...
#include <omGraphicsGUIFont.h>
Public Member Functions | |
Font (const UTF8String &fontPath) | |
Create a new font object for the font file located at the specified path string. More... | |
Font (const FontID &fontID) | |
Create a new font object for the font described by the specified font information. More... | |
Font (const Data &fontData) | |
Create a new font object for a font file with the specified data. More... | |
Font (const UByte *fontData, Size dataSizeInBytes) | |
Create a new font object for a font file with the specified data. More... | |
Font (const Font &other) | |
Create a copy of another font object, obtaining a reference to its font. More... | |
~Font () | |
Destroy this font object and release all of its resources. More... | |
Font & | operator= (const Font &other) |
Copy the state of another Font object to this one. More... | |
const FontID & | getID () const |
Return a reference to an object that contains information about this font. More... | |
Bool | getMetrics (Float fontSize, const TextLayout &fontLayout, FontMetrics &metrics) const |
Get font metric information for the specified size and layout of this font. More... | |
Bool | getGlyphMetrics (Float fontSize, UTF32Char character, GlyphMetrics &metrics) const |
Get sizing metrics for the glyph with the specified character code and font size. More... | |
Bool | getGlyphImage (Float fontSize, UTF32Char character, Image &glyphImage, GlyphMetrics &metrics) const |
Render a bitmap for the glyph with the specified character code and font size. More... | |
Bool | getKerning (Float fontSize, const TextLayout &fontLayout, UTF32Char character1, UTF32Char character2, Vector2f &kerning) const |
Get the kerning advance vector in pixels between the origins for the specified two characters. More... | |
Bool | getGlyphLayout (const UTF8StringIterator &string, const TextStyle &textStyle, Vector2f &position, GlyphLayout &glyphLayout) const |
Get the glyph layout for a string drawn with the given starting position. More... | |
Bool | getGlyphLayout (const UTF8StringIterator &string, const TextStyle &textStyle, const AABB2f &parentBounds, const Origin &alignment, GlyphLayout &glyphLayout) const |
Get the glyph layout for a string drawn with the specified alignment in the given bounding box. More... | |
Bool | isValid () const |
Return whether or not this font object represents a valid font. More... | |
Bool | hasFontData () const |
Return whether or not this font has any encoded data. More... | |
const UByte * | getFontData () const |
Return a pointer to the raw encoded data for this font. More... | |
Size | getFontDataSize () const |
Return the size in bytes of the encoded data for this font. More... | |
Static Public Member Functions | |
static Font * | getDefault () |
Return a pointer to an object representing the default system font. More... | |
Static Public Attributes | |
static const om::resources::ResourceType | RESOURCE_TYPE |
The resource type for a font. More... | |
A class that acts as an interface to a single text style.
The class provides ways to access sizing metrics globally and for each glyph, glyph pair kerning, and can render bitmap images for each glyph that can be used to do various kinds of font rendering.
om::graphics::gui::fonts::Font::Font | ( | const UTF8String & | fontPath | ) |
Create a new font object for the font file located at the specified path string.
om::graphics::gui::fonts::Font::Font | ( | const FontID & | fontID | ) |
Create a new font object for the font described by the specified font information.
This constructor uses the font info's path string to load the font from a file.
om::graphics::gui::fonts::Font::Font | ( | const Data & | fontData | ) |
Create a new font object for a font file with the specified data.
This constructor creates a font which uses a memory-resident block of font data (previously read from a font file) to realize the font.
Create a new font object for a font file with the specified data.
This constructor creates a font which uses a memory-resident block of font data (previously read from a font file) to realize the font.
om::graphics::gui::fonts::Font::Font | ( | const Font & | other | ) |
Create a copy of another font object, obtaining a reference to its font.
om::graphics::gui::fonts::Font::~Font | ( | ) |
Destroy this font object and release all of its resources.
Copy the state of another Font object to this one.
|
inline |
Return a reference to an object that contains information about this font.
Bool om::graphics::gui::fonts::Font::getMetrics | ( | Float | fontSize, |
const TextLayout & | fontLayout, | ||
FontMetrics & | metrics | ||
) | const |
Get font metric information for the specified size and layout of this font.
If the method succeeds, the metrics object is updated to reflect the metrics for this font with the given size and layout and TRUE is returned. Otherwise, FALSE is returned indicating failure. The method can fail if an invalid size (i.e. negative) is specified.
Bool om::graphics::gui::fonts::Font::getGlyphMetrics | ( | Float | fontSize, |
UTF32Char | character, | ||
GlyphMetrics & | metrics | ||
) | const |
Get sizing metrics for the glyph with the specified character code and font size.
If the metrics are successfully retrieved, they are placed in the output metrics parameter and TRUE is returned. Otherwise, FALSE is returned and no metrics are set.
Bool om::graphics::gui::fonts::Font::getGlyphImage | ( | Float | fontSize, |
UTF32Char | character, | ||
Image & | glyphImage, | ||
GlyphMetrics & | metrics | ||
) | const |
Render a bitmap for the glyph with the specified character code and font size.
If the glyph's image is successfully rendered, it is placed in the output glyph image parameter and TRUE is returned. A glyph metrics object is initialized for the glyph too. If the method fails, FALSE is returned and no image or metrics are retrieved.
Bool om::graphics::gui::fonts::Font::getKerning | ( | Float | fontSize, |
const TextLayout & | fontLayout, | ||
UTF32Char | character1, | ||
UTF32Char | character2, | ||
Vector2f & | kerning | ||
) | const |
Get the kerning advance vector in pixels between the origins for the specified two characters.
This method uses the font's internal kerning information, scaled to the specified font point size, to determine how far to advance in pixels between the origins of the two specified characters. If the method succeeds, it places the kerning vector in the output parameter and returns TRUE. Otherwise, if the method fails, it returns FALSE.
Bool om::graphics::gui::fonts::Font::getGlyphLayout | ( | const UTF8StringIterator & | string, |
const TextStyle & | textStyle, | ||
Vector2f & | position, | ||
GlyphLayout & | glyphLayout | ||
) | const |
Get the glyph layout for a string drawn with the given starting position.
The method determines the layout of glyphs from this font with the given style when starting at the specified position. The position units should be consistent with the font size.
The method returns whether or not the layout was successfully computed.
Bool om::graphics::gui::fonts::Font::getGlyphLayout | ( | const UTF8StringIterator & | string, |
const TextStyle & | textStyle, | ||
const AABB2f & | parentBounds, | ||
const Origin & | alignment, | ||
GlyphLayout & | glyphLayout | ||
) | const |
Get the glyph layout for a string drawn with the specified alignment in the given bounding box.
The method determines the layout of glyphs from this font with the given style and alignment within the specified parent bounding box. All glyph coordinates are specified in the same coordinate system as the parent bounding box, and these units should be consistent with the font size.
The method returns whether or not the layout was successfully computed.
Bool om::graphics::gui::fonts::Font::isValid | ( | ) | const |
Return whether or not this font object represents a valid font.
Bool om::graphics::gui::fonts::Font::hasFontData | ( | ) | const |
Return whether or not this font has any encoded data.
const UByte* om::graphics::gui::fonts::Font::getFontData | ( | ) | const |
Return a pointer to the raw encoded data for this font.
If the returned pointer is NULL, there is no encoded font data for this font.
Size om::graphics::gui::fonts::Font::getFontDataSize | ( | ) | const |
Return the size in bytes of the encoded data for this font.
If the returned size is 0, there is no encoded font data for this font.
|
static |
Return a pointer to an object representing the default system font.
|
static |
The resource type for a font.