PixelLightAPI
.
|
Abstract renderer font resource base class. More...
#include <Font.h>
Public Types | |
enum | EDrawFlags { CenterText = 1<<0, UnderlineText = 1<<1, CrossoutText = 1<<2, Mipmapping = 1<<3 } |
Public Member Functions | |
virtual PLRENDERER_API | ~Font () |
Destructor. | |
FontManager & | GetFontManager () const |
Returns the creating font manager. | |
PLCore::String | GetFilename () const |
Returns the filename of the font file the data came from. | |
PLCore::uint32 | GetSize () const |
Returns the nominal font size in points (72 points per inch) | |
PLCore::uint32 | GetResolution () const |
Returns the horizontal and vertical resolution in DPI. | |
PLCore::uint32 | GetSizeInPixels () const |
Returns the font size in pixels. | |
PLCore::uint32 | GetHeightInPixels () const |
Returns the font (line) height in pixels. | |
virtual PLRENDERER_API bool | SetSize (PLCore::uint32 nSize=12, PLCore::uint32 nResolution=96) |
Sets the font size. | |
virtual bool | IsValid () const =0 |
Returns whether or not this font is valid. | |
virtual float | GetAscender () const =0 |
Returns the ascender in font units. | |
virtual float | GetDescender () const =0 |
Returns the descender in font units. | |
virtual float | GetHeight () const =0 |
Returns the height in font units. | |
virtual PLRENDERER_API float | GetTextWidth (const PLCore::String &sText) |
Returns the width of a text (in font units) drawn with this font. | |
virtual void | Draw (const PLCore::String &sText, const PLGraphics::Color4 &cColor, const PLMath::Matrix4x4 &mObjectSpaceToClipSpace, const PLMath::Vector2 &vScale=PLMath::Vector2::One, const PLMath::Vector2 &vBias=PLMath::Vector2::Zero, PLCore::uint32 nFlags=0)=0 |
Draws a text. | |
Protected Member Functions | |
PLRENDERER_API | Font (FontManager &cFontManager, const PLCore::String &sFilename) |
Default. | |
Font (const Font &cSource) | |
Copy constructor. | |
Font & | operator= (const Font &cSource) |
Copy operator. | |
PLRENDERER_API void | DestroyGlyphs () |
Destroys the currently active glyphs. | |
Protected Attributes | |
FontManager * | m_pFontManager |
PLCore::String | m_sFilename |
PLCore::uint32 | m_nSize |
PLCore::uint32 | m_nResolution |
PLCore::Array< FontGlyph * > | m_lstGlyphs |
Abstract renderer font resource base class.
Height Ascender Internal leading | | | | | | | | | | | | | | |----| | | | | | | | 0 |___|____|___|_____________|___ Baseline |0 | | | | | Descender Size
Term definitions:
virtual PLRENDERER_API PLRenderer::Font::~Font | ( | ) | [virtual] |
Destructor.
PLRENDERER_API PLRenderer::Font::Font | ( | FontManager & | cFontManager, |
const PLCore::String & | sFilename | ||
) | [protected] |
Default.
[in] | cFontManager | Creating font manager |
[in] | sFilename | Filename of the font file the data came from, used to reference the new font by filename |
PLRenderer::Font::Font | ( | const Font & | cSource | ) | [protected] |
Copy constructor.
[in] | cSource | Source to copy from |
FontManager & PLRenderer::Font::GetFontManager | ( | ) | const [inline] |
Returns the creating font manager.
PLCore::String PLRenderer::Font::GetFilename | ( | ) | const [inline] |
Returns the filename of the font file the data came from.
PLCore::uint32 PLRenderer::Font::GetSize | ( | ) | const [inline] |
Returns the nominal font size in points (72 points per inch)
Returns the font size in points (72 points per inch)
PLCore::uint32 PLRenderer::Font::GetResolution | ( | ) | const [inline] |
Returns the horizontal and vertical resolution in DPI.
PLCore::uint32 PLRenderer::Font::GetSizeInPixels | ( | ) | const [inline] |
PLCore::uint32 PLRenderer::Font::GetHeightInPixels | ( | ) | const [inline] |
Returns the font (line) height in pixels.
Returns the font height in pixels.
virtual PLRENDERER_API bool PLRenderer::Font::SetSize | ( | PLCore::uint32 | nSize = 12 , |
PLCore::uint32 | nResolution = 96 |
||
) | [virtual] |
Sets the font size.
[in] | nSize | Nominal font size in points, for example 12 (72 points per inch) |
[in] | nResolution | The horizontal and vertical resolution in DPI, for example 96 |
virtual bool PLRenderer::Font::IsValid | ( | ) | const [pure virtual] |
Returns whether or not this font is valid.
virtual float PLRenderer::Font::GetAscender | ( | ) | const [pure virtual] |
Returns the ascender in font units.
virtual float PLRenderer::Font::GetDescender | ( | ) | const [pure virtual] |
Returns the descender in font units.
virtual float PLRenderer::Font::GetHeight | ( | ) | const [pure virtual] |
Returns the height in font units.
virtual PLRENDERER_API float PLRenderer::Font::GetTextWidth | ( | const PLCore::String & | sText | ) | [virtual] |
Returns the width of a text (in font units) drawn with this font.
[in] | sText | Text to 'draw' |
virtual void PLRenderer::Font::Draw | ( | const PLCore::String & | sText, |
const PLGraphics::Color4 & | cColor, | ||
const PLMath::Matrix4x4 & | mObjectSpaceToClipSpace, | ||
const PLMath::Vector2 & | vScale = PLMath::Vector2::One , |
||
const PLMath::Vector2 & | vBias = PLMath::Vector2::Zero , |
||
PLCore::uint32 | nFlags = 0 |
||
) | [pure virtual] |
Draws a text.
[in] | sText | Text to draw |
[in] | cColor | Text color |
[in] | mObjectSpaceToClipSpace | Object space to clip space matrix |
[in] | vScale | Font scale, there are situations were it's more comfortable to have a special scale variable as just mObjectSpaceToClipSpace with all build in |
[in] | vBias | Font bias (position offset), there are situations were it's more comfortable to have a special bias variable as just mObjectSpaceToClipSpace with all build in |
[in] | nFlags | Draw flags, see EDrawFlags |
Copy operator.
[in] | cSource | Source to copy from |
PLRENDERER_API void PLRenderer::Font::DestroyGlyphs | ( | ) | [protected] |
Destroys the currently active glyphs.
FontManager* PLRenderer::Font::m_pFontManager [protected] |
Creating font manager, always valid!
PLCore::String PLRenderer::Font::m_sFilename [protected] |
The filename of the font file the data came from
PLCore::uint32 PLRenderer::Font::m_nSize [protected] |
Font size in points, for example 12 (72 points per inch)
PLCore::uint32 PLRenderer::Font::m_nResolution [protected] |
The horizontal and vertical resolution in DPI, for example 96
PLCore::Array<FontGlyph*> PLRenderer::Font::m_lstGlyphs [protected] |
List of currently active glyphs ("character code -> glyph instance")
|