____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
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 | ~CFont () |
| int | Height () const |
| int | Width (const std::string &text) const |
| bool | IsLoaded () const |
| virtual int | getHeight () const |
| virtual int | getWidth (const std::string &text) const |
| virtual void | drawString (gcn::Graphics *graphics, const std::string &text, int x, int y) |
| void | MeasureWidths () |
Static Public Member Functions | |
| static CFont * | New (const std::string &ident, CGraphic *g) |
| static CFont * | Get (const std::string &ident) |
Public Attributes | |
| std::string | Ident |
| Ident of the font. | |
| char * | CharWidth |
| Real font width (starting with ' '). | |
| CGraphic * | G |
| Graphic object used to draw. | |
#include "font.h"
Defines the fonts used in the Stratagus engine. We support proportional multicolor fonts of 9 colors. (Currently the fonts aren't packed)
The width of each font glyph in pixels. The index 0 is the width of the SPACE (' ', 0x20).
Contains the graphics of the font, Only 9 colors are supported.
Definition at line 71 of file include/font.h.
| CFont::~CFont | ( | ) | [virtual] |
Create a new font
| ident | Font identifier | |
| g | Graphic |
Definition at line 814 of file font.cpp.
References AllFonts, Fonts, CGraphic::Free(), and G.
Referenced by tolua_stratagus_CFont_New00().
| CFont * CFont::Get | ( | const std::string & | ident | ) | [static] |
Get a font
| ident | Font identifier |
Definition at line 838 of file font.cpp.
References _C_, DebugPrint, and Fonts.
Referenced by CclDefineButtonStyle(), CclSetTitleScreens(), LoadFonts(), and tolua_stratagus_CFont_Get00().
| int CFont::Height | ( | ) | const |
Definition at line 85 of file font.cpp.
References G, and CGraphic::Height.
Referenced by DrawDecoration(), MessagesDisplay::DrawMessages(), getHeight(), and MessagesDisplay::UpdateMessages().
| int CFont::Width | ( | const std::string & | text | ) | const |
Returns the pixel width of text.
| text | Text to calculate the width of. |
Definition at line 226 of file font.cpp.
References CharWidth, and GetUTF8().
Referenced by MessagesDisplay::AddMessage(), DrawDecoration(), DrawMenuButton(), DrawPopup(), getWidth(), ShowInput(), ShowTitleImage(), and VideoDrawTextCentered().
| bool CFont::IsLoaded | ( | ) | const |
Definition at line 90 of file font.cpp.
References G, and CGraphic::IsLoaded().
Referenced by ShowLoadProgress().
| virtual int CFont::getHeight | ( | ) | const [inline, virtual] |
Gets the height of the glyphs in the font.
Implements gcn::Font.
Definition at line 86 of file include/font.h.
References Height().
| virtual int CFont::getWidth | ( | const std::string & | text | ) | const [inline, 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. |
Implements gcn::Font.
Definition at line 87 of file include/font.h.
References Width().
| void CFont::drawString | ( | gcn::Graphics * | graphics, | |
| const std::string & | text, | |||
| int | x, | |||
| int | y | |||
| ) | [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. |
Implements gcn::Font.
Definition at line 95 of file font.cpp.
References gcn::Graphics::getCurrentClipArea(), CVideo::Height, gcn::Rectangle::height, PopClipping(), PushClipping(), SetClipping(), Video, VideoDrawTextClip(), CVideo::Width, gcn::Rectangle::width, gcn::Rectangle::x, gcn::ClipRectangle::xOffset, gcn::Rectangle::y, and gcn::ClipRectangle::yOffset.
| void CFont::MeasureWidths | ( | ) |
Calculate the width of each character
Definition at line 666 of file font.cpp.
References CharWidth, G, CGraphic::GraphicHeight, CGraphic::GraphicWidth, CGraphic::Height, CGraphic::Surface, CGraphic::Width, and y.
| std::string CFont::Ident |
| char* CFont::CharWidth |
Real font width (starting with ' ').
Definition at line 95 of file include/font.h.
Referenced by DoDrawText(), MeasureWidths(), Width(), and ~CFont().
Graphic object used to draw.
Definition at line 96 of file include/font.h.
Referenced by DoDrawText(), FreeOpenGLFonts(), Height(), IsLoaded(), LoadFonts(), MakeFontColorTextures(), MeasureWidths(), New(), ReloadFonts(), and ~CFont().
1.5.6