Remove another unnecessary buffer copy.

Also, use `hxs_utf8()` for consistency.
This commit is contained in:
player-03
2024-01-31 14:02:50 -05:00
committed by GitHub
parent 590be2bbe6
commit 7c50f6e9e9

View File

@@ -1198,7 +1198,7 @@ namespace lime {
#ifdef LIME_FREETYPE
Font *font = (Font*)val_data (fontHandle);
return font->GetGlyphIndex (character.c_str ());
return font->GetGlyphIndex (hxs_utf8 (character, nullptr));
#else
return -1;
#endif
@@ -1222,10 +1222,7 @@ namespace lime {
#ifdef LIME_FREETYPE
Font *font = (Font*)val_data (fontHandle);
const std::string str (hxs_utf8 (characters, nullptr));
const std::unique_ptr<char[]> buff (new char[str.size() + 1]);
std::memcpy (buff.get (), str.c_str (), str.size () + 1);
return (value)font->GetGlyphIndices (true, buff.get ());
return (value)font->GetGlyphIndices (true, hxs_utf8 (characters, nullptr));
#else
return alloc_null ();
#endif