Renamed Font:hasGlyph to Font:hasGlyphs, and expanded it to accept multiple arguments and full strings. Resolves issue #762.

This commit is contained in:
Alex Szpakowski
2013-10-25 21:56:32 -03:00
parent b57256b3e5
commit 4e321697d3
8 changed files with 51 additions and 26 deletions
+12 -5
View File
@@ -69,23 +69,30 @@ GlyphData *Rasterizer::getGlyphData(const std::string &text) const
return getGlyphData(codepoint);
}
bool Rasterizer::hasGlyph(const std::string &text) const
bool Rasterizer::hasGlyphs(const std::string &text) const
{
if (text.size() == 0)
return false;
uint32 codepoint = 0;
try
{
codepoint = utf8::peek_next(text.begin(), text.end());
utf8::iterator<std::string::const_iterator> i(text.begin(), text.begin(), text.end());
utf8::iterator<std::string::const_iterator> end(text.end(), text.begin(), text.end());
while (i != end)
{
uint32 codepoint = *i++;
if (!hasGlyph(codepoint))
return false;
}
}
catch (utf8::exception &e)
{
throw love::Exception("Decoding error: %s", e.what());
}
return hasGlyph(codepoint);
return true;
}
} // font