____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"#include <font.h>

Public Member Functions | |
| virtual | ~Font () |
| virtual int | getWidth (const std::string &text) const =0 |
| virtual int | getHeight () const =0 |
| virtual int | getStringIndexAt (const std::string &text, int x) |
| virtual void | drawString (Graphics *graphics, const std::string &text, int x, int y)=0 |
Definition at line 69 of file guichan/include/guichan/font.h.
| virtual gcn::Font::~Font | ( | ) | [inline, virtual] |
Destructor.
Definition at line 76 of file guichan/include/guichan/font.h.
| virtual int gcn::Font::getWidth | ( | const std::string & | text | ) | const [pure virtual] |
Gets the width of a string. The width of a string is not necesserily the sum of all the widths of it's glyphs.
| text | the string to return the width of. |
Implemented in gcn::DefaultFont, gcn::ImageFont, and CFont.
Referenced by gcn::TextBox::adjustSize(), gcn::TextField::draw(), gcn::Graphics::drawText(), gcn::TextField::fixScroll(), getStringIndexAt(), and gcn::TextBox::scrollToCaret().
| virtual int gcn::Font::getHeight | ( | ) | const [pure virtual] |
Gets the height of the glyphs in the font.
Implemented in gcn::DefaultFont, gcn::ImageFont, and CFont.
Referenced by gcn::DropDown::adjustHeight(), gcn::RadioButton::adjustSize(), gcn::CheckBox::adjustSize(), gcn::Window::draw(), gcn::TextField::draw(), gcn::ListBox::draw(), gcn::Label::draw(), gcn::DropDown::draw(), gcn::Button::draw(), gcn::TextBox::keyPress(), gcn::TextBox::mousePress(), gcn::TextBox::scrollToCaret(), and gcn::ListBox::setSelected().
| int gcn::Font::getStringIndexAt | ( | const std::string & | text, | |
| int | x | |||
| ) | [virtual] |
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 80 of file gfont.cpp.
References gcn::GetNext(), and getWidth().
Referenced by gcn::TextField::mouseMotion(), gcn::TextField::mousePress(), and gcn::TextBox::mousePress().
| virtual void gcn::Font::drawString | ( | Graphics * | graphics, | |
| const std::string & | text, | |||
| int | x, | |||
| int | y | |||
| ) | [pure virtual] |
Draws a string.
NOTE: You normally won't use this function to draw text since Graphics contains better functions for drawing text.
| graphics | a Graphics object to use for drawing. | |
| text | the string to draw. | |
| x | the x coordinate where to draw the string. | |
| y | the y coordinate where to draw the string. |
Implemented in gcn::DefaultFont, gcn::ImageFont, and CFont.
Referenced by gcn::Graphics::drawText().
1.5.6