Skip to content

Commit

Permalink
Fix BitmapFont
Browse files Browse the repository at this point in the history
  • Loading branch information
OldSerpskiStalker committed Apr 1, 2024
1 parent 7e7092e commit e31eecf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
20 changes: 5 additions & 15 deletions src/RenderLibrary/BitmapFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ using namespace DirectX;
#include "../MultiLogManager/Exports.hpp"
#include "../MultiLogManager/Log/Log.hpp"
#include "BitmapFont.hpp"
#include "RenderText.hpp"
#include <codecvt>
#include "RenderText.hpp"

using namespace ShaderPlayground;

Expand Down Expand Up @@ -148,19 +147,10 @@ bool BitmapFont::m_parse(const char* fontFilename)

auto l_CharToWChar = [&](char* mbString) -> wchar_t*
{
/*
int len = 0;
len = (int)strlen(mbString) + 1;
wchar_t* ucString = new wchar_t[len];
mbstowcs(ucString, mbString, len);
return ucString;
*/
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> converter;
std::wstring ucString = converter.from_bytes(mbString);
wchar_t* result = new wchar_t[ucString.length() + 1];
std::copy(ucString.begin(), ucString.end(), result);
result[ucString.length()] = L'\0';
return result;
int requiredSize = MultiByteToWideChar(CP_UTF8, 0, mbString, -1, nullptr, 0);
wchar_t* wideName = new wchar_t[requiredSize];
MultiByteToWideChar(CP_UTF8, 0, mbString, -1, wideName, requiredSize);
return wideName;
};

wchar_t* name = l_CharToWChar((char*)str.substr(1, Value.length() - 2).c_str());
Expand Down
3 changes: 3 additions & 0 deletions src/RenderTestApp/RenderTestApp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -106,6 +107,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down Expand Up @@ -139,6 +141,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down

0 comments on commit e31eecf

Please sign in to comment.