(String) Remade GetXBuffer, now called GetXString

And returns a standard string


Former-commit-id: 516735324a62cb6296e19d3be1960322073e5f3a
This commit is contained in:
Lynix
2015-02-03 21:16:17 +01:00
parent 1c180ca9f2
commit 25dc252666
8 changed files with 60 additions and 134 deletions

View File

@@ -253,9 +253,9 @@ bool NzFont::Precache(unsigned int characterSize, nzUInt32 style, char32_t chara
bool NzFont::Precache(unsigned int characterSize, nzUInt32 style, const NzString& characterSet) const
{
unsigned int size;
std::unique_ptr<char32_t[]> characters(characterSet.GetUtf32Buffer(&size));
if (!characters)
///TODO: Itération UTF-8 => UTF-32 sans allocation de buffer (Exposer utf8cpp ?)
std::u32string set = characterSet.GetUtf32String();
if (set.empty())
{
NazaraError("Invalid character set");
return false;
@@ -263,8 +263,8 @@ bool NzFont::Precache(unsigned int characterSize, nzUInt32 style, const NzString
nzUInt64 key = ComputeKey(characterSize, style);
auto& glyphMap = m_glyphes[key];
for (unsigned int i = 0; i < size; ++i)
PrecacheGlyph(glyphMap, characterSize, style, characters[i]);
for (char32_t character : set)
PrecacheGlyph(glyphMap, characterSize, style, character);
return true;
}