cleanup; added a TODO to Font class
svn-id: r13308
This commit is contained in:
parent
d26f96e9ad
commit
7410f041ee
3 changed files with 17 additions and 5 deletions
|
@ -71,6 +71,9 @@ void NewFont::drawChar(const Surface *dst, byte chr, int x, int y, uint32 color)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
|
||||||
int Font::getStringWidth(const Common::String &str) const {
|
int Font::getStringWidth(const Common::String &str) const {
|
||||||
int space = 0;
|
int space = 0;
|
||||||
|
|
||||||
|
|
13
gui/font.h
13
gui/font.h
|
@ -46,6 +46,19 @@ struct Surface {
|
||||||
Surface() : pixels(0), w(0), h(0), pitch(0), bytesPerPixel(0) {}
|
Surface() : pixels(0), w(0), h(0), pitch(0), bytesPerPixel(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instances of this class represent a distinct font, with a built-in renderer.
|
||||||
|
* @todo Maybe move the high-level methods (drawString etc.) to a separate
|
||||||
|
* FontRenderer class? That way, we could have different variants... ?
|
||||||
|
* @todo Add more parameters to drawString, or additional similar methods,
|
||||||
|
* featuring abilities like
|
||||||
|
* - rendering with wrap-around instead of inserting an ellipsis or
|
||||||
|
* cutting them; needs a 'height' parameter
|
||||||
|
* - rendering multi-line strings (essentially, invoke the regular
|
||||||
|
* drawString for each line, and advance one line)
|
||||||
|
* - combinations of the two above: honor line feeds, and also wrap
|
||||||
|
* overlong lines
|
||||||
|
*/
|
||||||
class Font {
|
class Font {
|
||||||
public:
|
public:
|
||||||
virtual int getFontHeight() const = 0;
|
virtual int getFontHeight() const = 0;
|
||||||
|
|
|
@ -363,11 +363,7 @@ void NewGui::drawChar(byte chr, int xx, int yy, OverlayColor color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int NewGui::getStringWidth(const String &str) {
|
int NewGui::getStringWidth(const String &str) {
|
||||||
int space = 0;
|
return g_guifont.getStringWidth(str);
|
||||||
|
|
||||||
for (uint i = 0; i < str.size(); ++i)
|
|
||||||
space += getCharWidth(str[i]);
|
|
||||||
return space;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int NewGui::getCharWidth(byte c) {
|
int NewGui::getCharWidth(byte c) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue