xoreos
0.0.5
|
An abstract font. More...
#include <font.h>
Public Member Functions | |
Font () | |
virtual | ~Font () |
virtual float | getWidth (uint32 c) const =0 |
Return the width of a character. More... | |
virtual float | getHeight () const =0 |
Return the height of a character. More... | |
virtual float | getLineSpacing () const |
Return the size of space between lines. More... | |
size_t | getLineCount (const Common::UString &text, float maxWidth=0.0f, float maxHeight=0.0f) const |
Return the number of lines this text spans. More... | |
float | getWidth (const Common::UString &text, float maxWidth=0.0f) const |
Return the width this string would take. More... | |
float | getHeight (const Common::UString &text, float maxWidth=0.0f, float maxHeight=0.0f) const |
Return the height this string would take. More... | |
float | getLineWidth (const Common::UString &text) const |
Return the width of this string. More... | |
virtual void | buildChars (const Common::UString &str) |
Build all necessary characters to display this string. More... | |
virtual void | draw (uint32 c) const =0 |
Draw this character. More... | |
virtual void | renderBind (const glm::mat4 &transform) const |
virtual void | render (uint32 c, float &x, float &y, float *rgba) const |
virtual void | renderUnbind () const |
float | split (const Common::UString &line, std::vector< Common::UString > &lines, float maxWidth=0.0f, float maxHeight=0.0f, bool trim=true) const |
float | split (Common::UString &line, float maxWidth, float maxHeight=0.0f, bool trim=true) const |
float | split (const Common::UString &line, Common::UString &lines, float maxWidth, float maxHeight=0.0f, bool trim=true) const |
Private Member Functions | |
bool | addLine (std::vector< Common::UString > &lines, const Common::UString &newLine, float maxHeight) const |
|
private |
Definition at line 266 of file font.cpp.
References getHeight().
Referenced by split().
|
virtual |
Build all necessary characters to display this string.
Reimplemented in Graphics::Aurora::TTFFont.
Definition at line 66 of file font.cpp.
Referenced by Graphics::Aurora::Text::set(), and Graphics::Aurora::Text::setText().
|
pure virtual |
Draw this character.
Implemented in Graphics::Aurora::TextureFont, Graphics::Aurora::TTFFont, Graphics::Aurora::ABCFont, and Graphics::Aurora::NFTRFont.
Referenced by Graphics::Aurora::Text::drawLine().
|
pure virtual |
Return the height of a character.
Implemented in Graphics::Aurora::TextureFont, Graphics::Aurora::TTFFont, Graphics::Aurora::ABCFont, and Graphics::Aurora::NFTRFont.
Referenced by addLine(), Engines::ConsoleWindow::ConsoleWindow(), Engines::KotORJadeWidget::createText(), getHeight(), Graphics::Aurora::Text::getHeight(), Engines::KotORJadeWidget::load(), Engines::LoadProgress::LoadProgress(), Engines::NWN::Tooltip::redoLayout(), Engines::NWN::Tooltip::redoLines(), Graphics::Aurora::Text::render(), Graphics::Aurora::Text::renderImmediate(), Graphics::Aurora::Text::set(), Engines::NWN::DialogBox::setPosition(), and Engines::NWN::WidgetListItemTextLine::WidgetListItemTextLine().
float Graphics::Font::getHeight | ( | const Common::UString & | text, |
float | maxWidth = 0.0f , |
||
float | maxHeight = 0.0f |
||
) | const |
Return the height this string would take.
Definition at line 57 of file font.cpp.
References getHeight(), getLineCount(), and getLineSpacing().
size_t Graphics::Font::getLineCount | ( | const Common::UString & | text, |
float | maxWidth = 0.0f , |
||
float | maxHeight = 0.0f |
||
) | const |
Return the number of lines this text spans.
Definition at line 43 of file font.cpp.
References split().
Referenced by getHeight(), Graphics::Aurora::Text::set(), Graphics::Aurora::Text::setSize(), and Graphics::Aurora::Text::setText().
|
virtual |
Return the size of space between lines.
Reimplemented in Graphics::Aurora::TextureFont.
Definition at line 39 of file font.cpp.
Referenced by Engines::ConsoleWindow::ConsoleWindow(), getHeight(), Engines::NWN::Tooltip::redoLayout(), Engines::NWN::Tooltip::redoLines(), Graphics::Aurora::Text::render(), Graphics::Aurora::Text::renderImmediate(), and Engines::NWN::DialogBox::setPosition().
float Graphics::Font::getLineWidth | ( | const Common::UString & | text | ) | const |
Return the width of this string.
Definition at line 257 of file font.cpp.
References Common::UString::begin(), Common::UString::end(), and getWidth().
Referenced by Engines::ConsoleWindow::ConsoleWindow(), Graphics::Aurora::Text::drawLine(), and Graphics::Aurora::Text::drawLineImmediate().
|
pure virtual |
Return the width of a character.
Implemented in Graphics::Aurora::TextureFont, Graphics::Aurora::TTFFont, Graphics::Aurora::ABCFont, and Graphics::Aurora::NFTRFont.
Referenced by Engines::KotORJadeWidget::createText(), Engines::ConsoleWindow::getColumns(), getLineWidth(), Engines::ConsoleWindow::getPosition(), Engines::ConsoleWindow::recalcCursor(), Graphics::Aurora::Text::set(), split(), and Engines::ConsoleWindow::updateHighlight().
float Graphics::Font::getWidth | ( | const Common::UString & | text, |
float | maxWidth = 0.0f |
||
) | const |
|
inlinevirtual |
Reimplemented in Graphics::Aurora::TextureFont, and Graphics::Aurora::ABCFont.
Definition at line 69 of file font.h.
Referenced by Graphics::Aurora::Text::drawLineImmediate().
|
inlinevirtual |
Reimplemented in Graphics::Aurora::TextureFont, and Graphics::Aurora::ABCFont.
Definition at line 68 of file font.h.
Referenced by Graphics::Aurora::Text::renderImmediate().
|
inlinevirtual |
Reimplemented in Graphics::Aurora::TextureFont, and Graphics::Aurora::ABCFont.
Definition at line 70 of file font.h.
Referenced by Graphics::Aurora::Text::renderImmediate().
float Graphics::Font::split | ( | const Common::UString & | line, |
std::vector< Common::UString > & | lines, | ||
float | maxWidth = 0.0f , |
||
float | maxHeight = 0.0f , |
||
bool | trim = true |
||
) | const |
Definition at line 69 of file font.cpp.
References addLine(), Common::UString::clear(), Common::UString::empty(), FLT_MAX, getWidth(), Common::UString::isSpace(), MAX(), and Common::UString::splitTextTokens().
Referenced by Engines::NWN::Tooltip::createTexts(), Engines::NWN::DialogBox::finishReplies(), getLineCount(), getWidth(), Engines::ConsoleWindow::print(), Graphics::Aurora::Text::render(), Graphics::Aurora::Text::renderImmediate(), Engines::NWN::DialogBox::setEntry(), Engines::NWN::WidgetListBox::setText(), split(), Engines::NWN::WidgetListItemModule::WidgetListItemModule(), and Engines::NWN::WidgetListItemPremium::WidgetListItemPremium().
float Graphics::Font::split | ( | Common::UString & | line, |
float | maxWidth, | ||
float | maxHeight = 0.0f , |
||
bool | trim = true |
||
) | const |
float Graphics::Font::split | ( | const Common::UString & | line, |
Common::UString & | lines, | ||
float | maxWidth, | ||
float | maxHeight = 0.0f , |
||
bool | trim = true |
||
) | const |
Definition at line 241 of file font.cpp.
References Common::UString::clear(), Common::UString::empty(), and split().