Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • entries
    3
  • comments
    17
  • views
    1,978

UTF8 Support!


IgorBgz90

374 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 3

0 Comments


Recommended Comments

There are no comments to display.

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...