mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Added the OpenSans Hebrew Condensed Light font.
OptionListComponent and SliderComponent now use it. SliderComponent suffix is now vertically centered properly.
This commit is contained in:
parent
08dfc32f89
commit
3c05d6bc21
|
@ -321,6 +321,7 @@ set(ES_SOURCES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_dpad_left_right_png.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/help_dpad_left_right_png.cpp
|
||||||
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/opensans_hebrew_condensed_regular_ttf.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/opensans_hebrew_condensed_regular_ttf.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/opensans_hebrew_condensed_light_ttf.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/sq_bracket_png.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/sq_bracket_png.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/arrow_png.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/arrow_png.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/checkbox_checked_png.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/data/converted/checkbox_checked_png.cpp
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "Resources.h"
|
#include "Resources.h"
|
||||||
|
|
||||||
const size_t res2hNrOfFiles = 31;
|
const size_t res2hNrOfFiles = 32;
|
||||||
const Res2hEntry res2hFiles[res2hNrOfFiles] = {
|
const Res2hEntry res2hFiles[res2hNrOfFiles] = {
|
||||||
{":/arrow.png", arrow_png_size, arrow_png_data},
|
{":/arrow.png", arrow_png_size, arrow_png_data},
|
||||||
{":/button.png", button_png_size, button_png_data},
|
{":/button.png", button_png_size, button_png_data},
|
||||||
|
@ -12,6 +12,7 @@ const Res2hEntry res2hFiles[res2hNrOfFiles] = {
|
||||||
{":/ES_logo_16.png", ES_logo_16_png_size, ES_logo_16_png_data},
|
{":/ES_logo_16.png", ES_logo_16_png_size, ES_logo_16_png_data},
|
||||||
{":/ES_logo_32.png", ES_logo_32_png_size, ES_logo_32_png_data},
|
{":/ES_logo_32.png", ES_logo_32_png_size, ES_logo_32_png_data},
|
||||||
{":/frame.png", frame_png_size, frame_png_data},
|
{":/frame.png", frame_png_size, frame_png_data},
|
||||||
|
{":/opensans_hebrew_condensed_light.ttf", opensans_hebrew_condensed_light_ttf_size, opensans_hebrew_condensed_light_ttf_data},
|
||||||
{":/opensans_hebrew_condensed_regular.ttf", opensans_hebrew_condensed_regular_ttf_size, opensans_hebrew_condensed_regular_ttf_data},
|
{":/opensans_hebrew_condensed_regular.ttf", opensans_hebrew_condensed_regular_ttf_size, opensans_hebrew_condensed_regular_ttf_data},
|
||||||
{":/scroll_gradient.png", scroll_gradient_png_size, scroll_gradient_png_data},
|
{":/scroll_gradient.png", scroll_gradient_png_size, scroll_gradient_png_data},
|
||||||
{":/slider_knob.png", slider_knob_png_size, slider_knob_png_data},
|
{":/slider_knob.png", slider_knob_png_size, slider_knob_png_data},
|
||||||
|
@ -46,29 +47,30 @@ res2hMapType::value_type mapTemp[] = {
|
||||||
std::make_pair(":/ES_logo_16.png", res2hFiles[5]),
|
std::make_pair(":/ES_logo_16.png", res2hFiles[5]),
|
||||||
std::make_pair(":/ES_logo_32.png", res2hFiles[6]),
|
std::make_pair(":/ES_logo_32.png", res2hFiles[6]),
|
||||||
std::make_pair(":/frame.png", res2hFiles[7]),
|
std::make_pair(":/frame.png", res2hFiles[7]),
|
||||||
std::make_pair(":/opensans_hebrew_condensed_regular.ttf", res2hFiles[8]),
|
std::make_pair(":/opensans_hebrew_condensed_light.ttf", res2hFiles[8]),
|
||||||
std::make_pair(":/scroll_gradient.png", res2hFiles[9]),
|
std::make_pair(":/opensans_hebrew_condensed_regular.ttf", res2hFiles[9]),
|
||||||
std::make_pair(":/slider_knob.png", res2hFiles[10]),
|
std::make_pair(":/scroll_gradient.png", res2hFiles[10]),
|
||||||
std::make_pair(":/sq_bracket.png", res2hFiles[11]),
|
std::make_pair(":/slider_knob.png", res2hFiles[11]),
|
||||||
std::make_pair(":/star_filled.png", res2hFiles[12]),
|
std::make_pair(":/sq_bracket.png", res2hFiles[12]),
|
||||||
std::make_pair(":/star_unfilled.png", res2hFiles[13]),
|
std::make_pair(":/star_filled.png", res2hFiles[13]),
|
||||||
std::make_pair(":/textbox.png", res2hFiles[14]),
|
std::make_pair(":/star_unfilled.png", res2hFiles[14]),
|
||||||
std::make_pair(":/textbox_glow.png", res2hFiles[15]),
|
std::make_pair(":/textbox.png", res2hFiles[15]),
|
||||||
std::make_pair(":/help/a.png", res2hFiles[16]),
|
std::make_pair(":/textbox_glow.png", res2hFiles[16]),
|
||||||
std::make_pair(":/help/b.png", res2hFiles[17]),
|
std::make_pair(":/help/a.png", res2hFiles[17]),
|
||||||
std::make_pair(":/help/dpad_all.png", res2hFiles[18]),
|
std::make_pair(":/help/b.png", res2hFiles[18]),
|
||||||
std::make_pair(":/help/dpad_down.png", res2hFiles[19]),
|
std::make_pair(":/help/dpad_all.png", res2hFiles[19]),
|
||||||
std::make_pair(":/help/dpad_left.png", res2hFiles[20]),
|
std::make_pair(":/help/dpad_down.png", res2hFiles[20]),
|
||||||
std::make_pair(":/help/dpad_left_right.png", res2hFiles[21]),
|
std::make_pair(":/help/dpad_left.png", res2hFiles[21]),
|
||||||
std::make_pair(":/help/dpad_right.png", res2hFiles[22]),
|
std::make_pair(":/help/dpad_left_right.png", res2hFiles[22]),
|
||||||
std::make_pair(":/help/dpad_up.png", res2hFiles[23]),
|
std::make_pair(":/help/dpad_right.png", res2hFiles[23]),
|
||||||
std::make_pair(":/help/dpad_up_down.png", res2hFiles[24]),
|
std::make_pair(":/help/dpad_up.png", res2hFiles[24]),
|
||||||
std::make_pair(":/help/l.png", res2hFiles[25]),
|
std::make_pair(":/help/dpad_up_down.png", res2hFiles[25]),
|
||||||
std::make_pair(":/help/r.png", res2hFiles[26]),
|
std::make_pair(":/help/l.png", res2hFiles[26]),
|
||||||
std::make_pair(":/help/select.png", res2hFiles[27]),
|
std::make_pair(":/help/r.png", res2hFiles[27]),
|
||||||
std::make_pair(":/help/start.png", res2hFiles[28]),
|
std::make_pair(":/help/select.png", res2hFiles[28]),
|
||||||
std::make_pair(":/help/x.png", res2hFiles[29]),
|
std::make_pair(":/help/start.png", res2hFiles[29]),
|
||||||
std::make_pair(":/help/y.png", res2hFiles[30])
|
std::make_pair(":/help/x.png", res2hFiles[30]),
|
||||||
|
std::make_pair(":/help/y.png", res2hFiles[31])
|
||||||
};
|
};
|
||||||
|
|
||||||
res2hMapType res2hMap(mapTemp, mapTemp + sizeof mapTemp / sizeof mapTemp[0]);
|
res2hMapType res2hMap(mapTemp, mapTemp + sizeof mapTemp / sizeof mapTemp[0]);
|
||||||
|
|
|
@ -29,6 +29,9 @@ extern const unsigned char ES_logo_32_png_data[];
|
||||||
extern const size_t frame_png_size;
|
extern const size_t frame_png_size;
|
||||||
extern const unsigned char frame_png_data[];
|
extern const unsigned char frame_png_data[];
|
||||||
|
|
||||||
|
extern const size_t opensans_hebrew_condensed_light_ttf_size;
|
||||||
|
extern const unsigned char opensans_hebrew_condensed_light_ttf_data[];
|
||||||
|
|
||||||
extern const size_t opensans_hebrew_condensed_regular_ttf_size;
|
extern const size_t opensans_hebrew_condensed_regular_ttf_size;
|
||||||
extern const unsigned char opensans_hebrew_condensed_regular_ttf_data[];
|
extern const unsigned char opensans_hebrew_condensed_regular_ttf_data[];
|
||||||
|
|
||||||
|
|
3294
data/converted/opensans_hebrew_condensed_light_ttf.cpp
Normal file
3294
data/converted/opensans_hebrew_condensed_light_ttf.cpp
Normal file
File diff suppressed because it is too large
Load diff
BIN
data/resources/opensans_hebrew_condensed_light.ttf
Normal file
BIN
data/resources/opensans_hebrew_condensed_light.ttf
Normal file
Binary file not shown.
|
@ -113,7 +113,7 @@ public:
|
||||||
OptionListComponent(Window* window, const std::string& name, bool multiSelect = false) : GuiComponent(window), mMultiSelect(multiSelect), mName(name),
|
OptionListComponent(Window* window, const std::string& name, bool multiSelect = false) : GuiComponent(window), mMultiSelect(multiSelect), mName(name),
|
||||||
mText(window), mLeftArrow(window), mRightArrow(window)
|
mText(window), mLeftArrow(window), mRightArrow(window)
|
||||||
{
|
{
|
||||||
auto font = Font::get(FONT_SIZE_MEDIUM);
|
auto font = Font::get(FONT_SIZE_MEDIUM, FONT_PATH_LIGHT);
|
||||||
mText.setFont(font);
|
mText.setFont(font);
|
||||||
mText.setColor(0x777777FF);
|
mText.setColor(0x777777FF);
|
||||||
mText.setCentered(true);
|
mText.setCentered(true);
|
||||||
|
|
|
@ -107,7 +107,7 @@ float SliderComponent::getValue()
|
||||||
void SliderComponent::onSizeChanged()
|
void SliderComponent::onSizeChanged()
|
||||||
{
|
{
|
||||||
if(!mSuffix.empty())
|
if(!mSuffix.empty())
|
||||||
mFont = Font::get((int)(mSize.y() * 0.7f));
|
mFont = Font::get((int)(mSize.y() * 0.8f), FONT_PATH_LIGHT);
|
||||||
|
|
||||||
onValueChanged();
|
onValueChanged();
|
||||||
}
|
}
|
||||||
|
@ -132,9 +132,9 @@ void SliderComponent::onValueChanged()
|
||||||
ss << mSuffix;
|
ss << mSuffix;
|
||||||
const std::string max = ss.str();
|
const std::string max = ss.str();
|
||||||
|
|
||||||
float w = mFont->sizeText(max).x();
|
Eigen::Vector2f textSize = mFont->sizeText(max);
|
||||||
mValueCache = std::shared_ptr<TextCache>(mFont->buildTextCache(val, mSize.x() - w, 0, 0x777777FF));
|
mValueCache = std::shared_ptr<TextCache>(mFont->buildTextCache(val, mSize.x() - textSize.x(), (mSize.y() - textSize.y()) / 2, 0x777777FF));
|
||||||
mValueCache->metrics.size[0] = w; // fudge the width
|
mValueCache->metrics.size[0] = textSize.x(); // fudge the width
|
||||||
}
|
}
|
||||||
|
|
||||||
// update knob position/size
|
// update knob position/size
|
||||||
|
|
|
@ -16,6 +16,9 @@ class TextCache;
|
||||||
#define FONT_SIZE_MEDIUM ((unsigned int)(0.045f * Renderer::getScreenHeight()))
|
#define FONT_SIZE_MEDIUM ((unsigned int)(0.045f * Renderer::getScreenHeight()))
|
||||||
#define FONT_SIZE_LARGE ((unsigned int)(0.1f * Renderer::getScreenHeight()))
|
#define FONT_SIZE_LARGE ((unsigned int)(0.1f * Renderer::getScreenHeight()))
|
||||||
|
|
||||||
|
#define FONT_PATH_LIGHT ":/opensans_hebrew_condensed_light.ttf"
|
||||||
|
#define FONT_PATH_REGULAR ":/opensans_hebrew_condensed_regular.ttf"
|
||||||
|
|
||||||
//A TrueType Font renderer that uses FreeType and OpenGL.
|
//A TrueType Font renderer that uses FreeType and OpenGL.
|
||||||
//The library is automatically initialized when it's needed.
|
//The library is automatically initialized when it's needed.
|
||||||
class Font : public IReloadable
|
class Font : public IReloadable
|
||||||
|
@ -70,7 +73,7 @@ public:
|
||||||
int getSize() const;
|
int getSize() const;
|
||||||
inline const std::string& getPath() const { return mPath; }
|
inline const std::string& getPath() const { return mPath; }
|
||||||
|
|
||||||
inline static const char* getDefaultPath() { return ":/opensans_hebrew_condensed_regular.ttf"; }
|
inline static const char* getDefaultPath() { return FONT_PATH_REGULAR; }
|
||||||
|
|
||||||
static std::shared_ptr<Font> getFromTheme(const ThemeData::ThemeElement* elem, unsigned int properties, const std::shared_ptr<Font>& orig);
|
static std::shared_ptr<Font> getFromTheme(const ThemeData::ThemeElement* elem, unsigned int properties, const std::shared_ptr<Font>& orig);
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,8 @@ void TextureResource::initFromMemory(const char* data, size_t length)
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
|
||||||
const GLint wrapMode = mTile ? GL_REPEAT : GL_CLAMP_TO_EDGE;
|
const GLint wrapMode = mTile ? GL_REPEAT : GL_CLAMP_TO_EDGE;
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapMode);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapMode);
|
||||||
|
|
||||||
mTextureSize << width, height;
|
mTextureSize << width, height;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue