fix <invalid UTF-8 string>
* Fix UTF-8 conversion issue on iOS * Fix visual glitches with TTF font
This commit is contained in:
parent
23d3335a6b
commit
d885c30b2a
@ -121,7 +121,9 @@ namespace gui
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool flgmip = driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
|
bool flgmip = driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
|
||||||
|
bool flgcpy = driver->getTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY);
|
||||||
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
|
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
|
||||||
|
driver->setTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY, true);
|
||||||
|
|
||||||
// Set the texture color format.
|
// Set the texture color format.
|
||||||
switch (pixel_mode)
|
switch (pixel_mode)
|
||||||
@ -137,6 +139,7 @@ namespace gui
|
|||||||
|
|
||||||
// Restore our texture creation flags.
|
// Restore our texture creation flags.
|
||||||
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, flgmip);
|
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, flgmip);
|
||||||
|
driver->setTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY, flgcpy);
|
||||||
return texture ? true : false;
|
return texture ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,15 @@ std::wstring utf8_to_wide(const std::string &input)
|
|||||||
char *outbuf = new char[outbuf_size];
|
char *outbuf = new char[outbuf_size];
|
||||||
memset(outbuf, 0, outbuf_size);
|
memset(outbuf, 0, outbuf_size);
|
||||||
|
|
||||||
if (!convert("WCHAR_T", "UTF-8", outbuf, outbuf_size, inbuf, inbuf_size)) {
|
#ifdef __IOS__
|
||||||
|
// iOS needs manual caring to support the full character set possible with wchar_t
|
||||||
|
SANITY_CHECK(sizeof(wchar_t) == 4);
|
||||||
|
const char *to = "UTF-32LE";
|
||||||
|
#else
|
||||||
|
const char *to = "WCHAR_T";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!convert(to, "UTF-8", outbuf, outbuf_size, inbuf, inbuf_size)) {
|
||||||
infostream << "Couldn't convert UTF-8 string 0x" << hex_encode(input)
|
infostream << "Couldn't convert UTF-8 string 0x" << hex_encode(input)
|
||||||
<< " into wstring" << std::endl;
|
<< " into wstring" << std::endl;
|
||||||
delete[] inbuf;
|
delete[] inbuf;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user