Skip to content
Permalink
Browse files

TextDrawerUWP based on DirectWrite

  • Loading branch information...
driver1998 committed Jun 6, 2019
1 parent 792d9e3 commit 8fab38ecdd68c3c5cc109f18682226be4c0fe844
@@ -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>
@@ -7,6 +7,7 @@
#include "util/text/utf8.h"
#include "gfx_es2/draw_text.h"
#include "gfx_es2/draw_text_win.h"
#include "gfx_es2/draw_text_uwp.h"
#include "gfx_es2/draw_text_qt.h"
#include "gfx_es2/draw_text_android.h"

@@ -45,6 +46,8 @@ TextDrawer *TextDrawer::Create(Draw::DrawContext *draw) {
TextDrawer *drawer = nullptr;
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
drawer = new TextDrawerWin32(draw);
#elif PPSSPP_PLATFORM(UWP)
drawer = new TextDrawerUWP(draw);
#elif defined(USING_QT_UI)
drawer = new TextDrawerQt(draw);
#elif PPSSPP_PLATFORM(ANDROID)

0 comments on commit 8fab38e

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