Jump to content

UTF8 Support!

IgorBgz90

180 views

helloWorld.png?dl=1

Hello again. Implemented UTF8 support for LE4. Works fine🙃.

context->SetBlendMode(Blend::Alpha);
context->DrawText(u8"Привет мир! Hello world!", 25.0f, 25.0f);
context->SetBlendMode(Blend::Solid);

Add yours symbols to "familychars" and make own "family" in Font.cpp

if (family==Font::English)
{
	familychars = L"abcdefghijklmnopqrstuvwxyzабвгдеёжзийклмнопрстуфхцчшщъыьэюя АБВГДЕЁЖЗИКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=!@#$%^&*()_+[]\\{}|;':\",./<>?	`~";
}

Update:

#include <codecvt>
std::string WideStringToString(const std::wstring & str)
{
	std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
	return myconv.to_bytes(str);
}

std::wstring StringToWideString(const std::string & str)
{
	std::wstring_convert<std::codecvt_utf8<wchar_t>> convert;
	return convert.from_bytes(str);
}

Gud luck🖐️!

FontSrc.zip

  • Like 2


0 Comments


Recommended Comments

There are no comments to display.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...