mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-12-24 19:54:37 +02:00
Removed support for multi-line text drawing
When trying to test the previous commit, I couldn't find any place in the application where strings containing newlines are drawn. So I'm assuming this is an unnecessary feature, until someone comes up with a test case proving otherwise. Yeah, I'm too lazy to review all the code that draws text...
This commit is contained in:
parent
2effd1fc99
commit
0908aa7bb7
25
src/font.cpp
25
src/font.cpp
@ -59,30 +59,7 @@ int Font::getTextWidth(const char *text)
|
||||
else return 1;
|
||||
}
|
||||
|
||||
void Font::write(Surface *surface, const string &text,
|
||||
int x, int y, HAlign halign, VAlign valign)
|
||||
{
|
||||
if (!font) {
|
||||
return;
|
||||
}
|
||||
|
||||
size_t pos = text.find('\n', 0);
|
||||
if (pos == string::npos) {
|
||||
writeLine(surface, text, x, y, halign, valign);
|
||||
} else {
|
||||
size_t prev = 0;
|
||||
do {
|
||||
writeLine(surface, text.substr(prev, pos - prev),
|
||||
x, y, halign, valign);
|
||||
y += lineSpacing;
|
||||
prev = pos + 1;
|
||||
pos = text.find('\n', prev);
|
||||
} while (pos != string::npos);
|
||||
writeLine(surface, text.substr(prev), x, y, halign, valign);
|
||||
}
|
||||
}
|
||||
|
||||
void Font::writeLine(Surface *surface, std::string const& text,
|
||||
void Font::write(Surface *surface, std::string const& text,
|
||||
int x, int y, HAlign halign, VAlign valign)
|
||||
{
|
||||
if (!font) {
|
||||
|
@ -41,9 +41,6 @@ public:
|
||||
private:
|
||||
Font(TTF_Font *font);
|
||||
|
||||
void writeLine(Surface *surface, std::string const& text,
|
||||
int x, int y, HAlign halign, VAlign valign);
|
||||
|
||||
TTF_Font *font;
|
||||
int lineSpacing;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user