Skip to content
Permalink
Browse files

Merge pull request #12088 from driver1998/uwp-text-dwrite

UWP TextDrawer for multi language support
  • Loading branch information...
hrydgard committed Jun 7, 2019
2 parents 5d0f2ca + 56a8793 commit b3221bd31c99a4d71b9862fb332de329fcc0d497
@@ -21,6 +21,7 @@
#include <map>
#include <vector>

#include "ppsspp_config.h"
#include "Common/CommonTypes.h"

extern const char *PPSSPP_GIT_VERSION;
@@ -72,7 +73,7 @@ struct Config {
bool bIgnoreWindowsKey;
bool bRestartRequired;
#endif
#if defined(USING_WIN_UI) || defined(USING_QT_UI)
#if defined(USING_WIN_UI) || defined(USING_QT_UI) || PPSSPP_PLATFORM(UWP)
std::string sFont;
#endif

@@ -108,6 +108,9 @@
#if defined(USING_QT_UI)
#include <QFontDatabase>
#endif
#if PPSSPP_PLATFORM(UWP)
#include <dwrite_3.h>
#endif

// The new UI framework, for initialization

@@ -646,7 +649,10 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
// Note to translators: do not translate this/add this to PPSSPP-lang's files.
// It's intended to be custom for every user.
// Only add it to your own personal copies of PPSSPP.
#if defined(USING_WIN_UI) && !PPSSPP_PLATFORM(UWP)
#if PPSSPP_PLATFORM(UWP)
// Roboto font is loaded in TextDrawerUWP.
g_Config.sFont = des->T("Font", "Roboto");
#elif defined(USING_WIN_UI) && !PPSSPP_PLATFORM(UWP)
// TODO: Could allow a setting to specify a font file to load?
// TODO: Make this a constant if we can sanely load the font on other systems?
AddFontResourceEx(L"assets/Roboto-Condensed.ttf", FR_PRIVATE, NULL);
@@ -729,7 +735,7 @@ static UI::Style MakeStyle(uint32_t fg, uint32_t bg) {
}

static void UIThemeInit() {
#if (defined(USING_WIN_UI) && !PPSSPP_PLATFORM(UWP)) || defined(USING_QT_UI)
#if defined(USING_WIN_UI) || PPSSPP_PLATFORM(UWP) || defined(USING_QT_UI)
ui_theme.uiFont = UI::FontStyle(UBUNTU24, g_Config.sFont.c_str(), 22);
ui_theme.uiFontSmall = UI::FontStyle(UBUNTU24, g_Config.sFont.c_str(), 15);
ui_theme.uiFontSmaller = UI::FontStyle(UBUNTU24, g_Config.sFont.c_str(), 12);
@@ -419,6 +419,7 @@
<ClInclude Include="..\..\ext\native\file\path.h" />
<ClInclude Include="..\..\ext\native\file\vfs.h" />
<ClInclude Include="..\..\ext\native\file\zip_read.h" />
<ClInclude Include="..\..\ext\native\gfx_es2\draw_text_uwp.h" />
<ClInclude Include="..\..\ext\native\json\json_reader.h" />
<ClInclude Include="..\..\ext\native\json\json_writer.h" />
<ClInclude Include="..\..\ext\native\gfx\texture_atlas.h" />
@@ -1462,6 +1463,7 @@
<ClCompile Include="..\..\ext\native\file\ini_file.cpp" />
<ClCompile Include="..\..\ext\native\file\path.cpp" />
<ClCompile Include="..\..\ext\native\file\zip_read.cpp" />
<ClCompile Include="..\..\ext\native\gfx_es2\draw_text_uwp.cpp" />
<ClCompile Include="..\..\ext\native\json\json_reader.cpp" />
<ClCompile Include="..\..\ext\native\json\json_writer.cpp" />
<ClCompile Include="..\..\ext\native\gfx\texture_atlas.cpp" />
@@ -1642,4 +1644,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
@@ -474,6 +474,9 @@
<ClCompile Include="..\..\ext\native\data\base64.cpp">
<Filter>data</Filter>
</ClCompile>
<ClCompile Include="..\..\ext\native\gfx_es2\draw_text_uwp.cpp">
<Filter>gfx</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
@@ -747,5 +750,8 @@
<ClInclude Include="..\..\ext\native\data\base64.h">
<Filter>data</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\native\gfx_es2\draw_text_uwp.h">
<Filter>gfx</Filter>
</ClInclude>
</ItemGroup>
</Project>
@@ -42,6 +42,7 @@ using namespace Concurrency;
// UGLY!
PPSSPP_UWPMain *g_main;
extern WindowsAudioBackend *winAudioBackend;
std::string langRegion;
// TODO: Use Microsoft::WRL::ComPtr<> for D3D11 objects?
// TODO: See https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/WindowsAudioSession for WASAPI with UWP
// TODO: Low latency input: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/LowLatencyInput/cpp
@@ -76,7 +77,6 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(App ^app, const std::shared_ptr<DX::DeviceResourc

wchar_t lcCountry[256];

std::string langRegion;
if (0 != GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, lcCountry, 256)) {
langRegion = ConvertWStringToUTF8(lcCountry);
for (size_t i = 0; i < langRegion.size(); i++) {
@@ -345,7 +345,7 @@ std::string System_GetProperty(SystemProperty prop) {
case SYSPROP_NAME:
return "Windows 10 Universal";
case SYSPROP_LANGREGION:
return "en_US"; // TODO UWP
return langRegion;
case SYSPROP_CLIPBOARD_TEXT:
/* TODO: Need to either change this API or do this on a thread in an ugly fashion.
DataPackageView ^view = Clipboard::GetContent();

0 comments on commit b3221bd

Please sign in to comment.
You can’t perform that action at this time.