#include <font.hpp>
Inheritance diagram for gcn::Font:
Fonts should inherit from this class and implements it's functions.
Definition at line 69 of file font.hpp.
Public Member Functions | |
virtual | ~Font () |
Destructor. | |
virtual int | getWidth (const std::string &text) const =0 |
Gets the width of a string. | |
virtual int | getHeight () const =0 |
Gets the height of the glyphs in the font. | |
virtual int | getStringIndexAt (const std::string &text, int x) |
Gets a string index in a string providing an x coordinate. | |
virtual void | drawString (Graphics *graphics, const std::string &text, int x, int y)=0 |
Draws a string. |
|
Draws a string. NOTE: You normally won't use this function to draw text since Graphics contains better functions for drawing text.
Implemented in gcn::DefaultFont, and gcn::ImageFont. Referenced by gcn::Graphics::drawText(). |
|
Gets the height of the glyphs in the font.
Implemented in gcn::DefaultFont, and gcn::ImageFont. Referenced by gcn::DropDown::adjustHeight(), gcn::RadioButton::adjustSize(), gcn::CheckBox::adjustSize(), gcn::Window::draw(), gcn::ListBox::draw(), gcn::Label::draw(), gcn::Button::draw(), gcn::TextBox::keyPress(), gcn::TextBox::mousePress(), gcn::TextBox::scrollToCaret(), and gcn::ListBox::setSelected(). |
|
Gets a string index in a string providing an x coordinate. Used to retrive a string index (for a character in a string) at a certain x position. It is especially useful when a mouse clicks in a TextField and you want to know which character was clicked.
Reimplemented in gcn::DefaultFont, and gcn::ImageFont. Definition at line 63 of file font.cpp. References getWidth(). Referenced by gcn::TextField::mousePress(), and gcn::TextBox::mousePress(). |
|
Gets the width of a string. The width of a string is not necesserily the sum of all the widths of it's glyphs.
Implemented in gcn::DefaultFont, and gcn::ImageFont. Referenced by gcn::TextBox::adjustSize(), gcn::Graphics::drawText(), gcn::TextField::fixScroll(), getStringIndexAt(), and gcn::TextBox::scrollToCaret(). |