mirror of https://github.com/PCSX2/pcsx2.git
GSdx: Add Default OSD Font Resource (#3605)
GSdx: Add Roboto font to resources and make it the default for the OSD
This commit is contained in:
parent
6a4e93db3c
commit
23248b5293
|
@ -94,6 +94,9 @@ bool GSdxApp::LoadResource(int id, std::vector<char>& buff, const char* type)
|
||||||
case IDR_TFX_CL:
|
case IDR_TFX_CL:
|
||||||
path = "/GSdx/res/tfx.cl";
|
path = "/GSdx/res/tfx.cl";
|
||||||
break;
|
break;
|
||||||
|
case IDR_FONT_ROBOTO:
|
||||||
|
path = "/GSdx/res/fonts-roboto/Roboto-Regular.ttf";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf("LoadResource not implemented for id %d\n", id);
|
printf("LoadResource not implemented for id %d\n", id);
|
||||||
return false;
|
return false;
|
||||||
|
@ -359,9 +362,9 @@ void GSdxApp::Init()
|
||||||
m_default_configuration["NTSC_Saturation"] = "1";
|
m_default_configuration["NTSC_Saturation"] = "1";
|
||||||
m_default_configuration["ocldev"] = "";
|
m_default_configuration["ocldev"] = "";
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
m_default_configuration["osd_fontname"] = "C:\\Windows\\Fonts\\tahoma.ttf";
|
m_default_configuration["osd_fontname"] = "C:\\Windows\\Fonts\\my_favorite_font_e_g_tahoma.ttf";
|
||||||
#else
|
#else
|
||||||
m_default_configuration["osd_fontname"] = "/usr/share/fonts/truetype/freefont/FreeSerif.ttf";
|
m_default_configuration["osd_fontname"] = "/usr/share/fonts/truetype/my_favorite_font_e_g_DejaVu Sans.ttf";
|
||||||
#endif
|
#endif
|
||||||
m_default_configuration["osd_color_r"] = "0";
|
m_default_configuration["osd_color_r"] = "0";
|
||||||
m_default_configuration["osd_color_g"] = "160";
|
m_default_configuration["osd_color_g"] = "160";
|
||||||
|
|
|
@ -94,6 +94,8 @@ IDR_TFX_VGS_GLSL RCDATA "res\\glsl\\tfx_vgs.glsl";
|
||||||
|
|
||||||
IDR_TFX_FS_GLSL RCDATA "res\\glsl\\tfx_fs.glsl";
|
IDR_TFX_FS_GLSL RCDATA "res\\glsl\\tfx_fs.glsl";
|
||||||
|
|
||||||
|
IDR_FONT_ROBOTO RCDATA "res\\fonts-roboto\\Roboto-Regular.ttf";
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Bitmap
|
// Bitmap
|
||||||
|
|
|
@ -22,16 +22,24 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "GSdx.h"
|
#include "GSdx.h"
|
||||||
#include "GSOsdManager.h"
|
#include "GSOsdManager.h"
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "resource.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void GSOsdManager::LoadFont() {
|
void GSOsdManager::LoadFont() {
|
||||||
FT_Error error = FT_New_Face(m_library, theApp.GetConfigS("osd_fontname").c_str(), 0, &m_face);
|
FT_Error error = FT_New_Face(m_library, theApp.GetConfigS("osd_fontname").c_str(), 0, &m_face);
|
||||||
if (error) {
|
if (error) {
|
||||||
m_face = NULL;
|
FT_Error error_load_res = 1;
|
||||||
fprintf(stderr, "Failed to init the freetype face\n");
|
if(theApp.LoadResource(IDR_FONT_ROBOTO, resource_data_buffer))
|
||||||
if(error == FT_Err_Unknown_File_Format)
|
error_load_res = FT_New_Memory_Face(m_library, (const FT_Byte*)resource_data_buffer.data(), resource_data_buffer.size(), 0, &m_face);
|
||||||
fprintf(stderr, "\tFreetype unknown file format\n");
|
|
||||||
|
if (error_load_res) {
|
||||||
return;
|
m_face = NULL;
|
||||||
|
fprintf(stderr, "Failed to init freetype face from external and internal resource\n");
|
||||||
|
if(error == FT_Err_Unknown_File_Format)
|
||||||
|
fprintf(stderr, "\tFreetype unknown file format for external file\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadSize();
|
LoadSize();
|
||||||
|
|
|
@ -95,4 +95,8 @@ class GSOsdManager {
|
||||||
GSVector2i m_real_size;
|
GSVector2i m_real_size;
|
||||||
size_t Size();
|
size_t Size();
|
||||||
size_t GeneratePrimitives(GSVertexPT1* dst, size_t count);
|
size_t GeneratePrimitives(GSVertexPT1* dst, size_t count);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
std::vector<char> resource_data_buffer;
|
||||||
};
|
};
|
||||||
|
|
|
@ -98,5 +98,7 @@ enum {
|
||||||
IDR_TFX_VGS_GLSL,
|
IDR_TFX_VGS_GLSL,
|
||||||
IDR_TFX_FS_GLSL,
|
IDR_TFX_FS_GLSL,
|
||||||
IDR_TFX_CL,
|
IDR_TFX_CL,
|
||||||
|
// fonts
|
||||||
|
IDR_FONT_ROBOTO,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,52 @@
|
||||||
|
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: Roboto
|
||||||
|
Upstream-Contact: https://github.com/google/roboto/issues
|
||||||
|
Source: git clone https://github.com/google/roboto
|
||||||
|
Comment: Tarball created from git clone using this command:
|
||||||
|
git archive HEAD --format=tar
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: 2015, Google Inc.
|
||||||
|
License: Apache-2.0
|
||||||
|
|
||||||
|
Files: hinted/*
|
||||||
|
out/*
|
||||||
|
scripts/lib/*
|
||||||
|
src/v2/*
|
||||||
|
scripts/render.sh
|
||||||
|
scripts/build-v2.py
|
||||||
|
scripts/run_exhaustive_tests.py
|
||||||
|
scripts/coverage_test.py
|
||||||
|
scripts/touchup_for_web.py
|
||||||
|
scripts/temporary_touchups.py
|
||||||
|
scripts/run_web_tests.py
|
||||||
|
scripts/touchup_for_android.py
|
||||||
|
scripts/roboto_data.py
|
||||||
|
scripts/force_yminmax.py
|
||||||
|
scripts/run_general_tests.py
|
||||||
|
Copyright: 2015, Google Inc.
|
||||||
|
License: Apache-2.0
|
||||||
|
|
||||||
|
Files: scripts/subset_for_web.py
|
||||||
|
third_party/fontcrunch/*
|
||||||
|
Copyright: 2014, Google Inc.
|
||||||
|
License: Apache-2.0
|
||||||
|
|
||||||
|
Files: third_party/spiro/*
|
||||||
|
Copyright: 2007, Raph Levien
|
||||||
|
License: GPL-2+
|
||||||
|
|
||||||
|
Files: debian/*
|
||||||
|
Copyright: 2015, Vasudev Kamath <vasudev@copyninja.info>
|
||||||
|
2015, Jonas Smedegaard <dr@jones.dk>
|
||||||
|
License: GPL-3+
|
||||||
|
|
||||||
|
License: Apache-2.0
|
||||||
|
License-Reference: /usr/share/common-licenses/Apache-2.0
|
||||||
|
|
||||||
|
License: GPL-2+
|
||||||
|
License-Reference: /usr/share/common-licenses/GPL-2
|
||||||
|
|
||||||
|
License: GPL-3+
|
||||||
|
License-Reference: /usr/share/common-licenses/GPL-3
|
||||||
|
|
|
@ -30,4 +30,7 @@
|
||||||
<gresource prefix="/GSdx/res/">
|
<gresource prefix="/GSdx/res/">
|
||||||
<file>tfx.cl</file>
|
<file>tfx.cl</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
|
<gresource prefix="/GSdx/res/">
|
||||||
|
<file>fonts-roboto/Roboto-Regular.ttf</file>
|
||||||
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
|
|
|
@ -155,13 +155,14 @@
|
||||||
#define IDR_COMMON_GLSL 10015
|
#define IDR_COMMON_GLSL 10015
|
||||||
#define IDR_TFX_VGS_GLSL 10016
|
#define IDR_TFX_VGS_GLSL 10016
|
||||||
#define IDR_TFX_FS_GLSL 10017
|
#define IDR_TFX_FS_GLSL 10017
|
||||||
|
#define IDR_FONT_ROBOTO 10018
|
||||||
#define IDC_STATIC -1
|
#define IDC_STATIC -1
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 10018
|
#define _APS_NEXT_RESOURCE_VALUE 10019
|
||||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||||
#define _APS_NEXT_CONTROL_VALUE 2194
|
#define _APS_NEXT_CONTROL_VALUE 2194
|
||||||
#define _APS_NEXT_SYMED_VALUE 5000
|
#define _APS_NEXT_SYMED_VALUE 5000
|
||||||
|
|
Loading…
Reference in New Issue