Switch to M+ fonts
This commit is contained in:
parent
6dda174c8a
commit
d2194e9e00
BIN
assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Black.ttf
Normal file
BIN
assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Black.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Light.ttf
Normal file
BIN
assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Light.ttf
Normal file
Binary file not shown.
BIN
assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Medium.ttf
Normal file
BIN
assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Medium.ttf
Normal file
Binary file not shown.
91
assets/fonts/M_PLUS_Rounded_1c/OFL.txt
Normal file
91
assets/fonts/M_PLUS_Rounded_1c/OFL.txt
Normal file
@ -0,0 +1,91 @@
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
Binary file not shown.
@ -43,7 +43,7 @@ namespace MusicSelect {
|
||||
|
||||
sf::Text category_label{
|
||||
"category",
|
||||
m_resources.noto_sans_medium,
|
||||
m_resources.fallback_font.medium,
|
||||
static_cast<unsigned int>(get_size()*0.1f)
|
||||
};
|
||||
category_label.setFillColor(sf::Color::White);
|
||||
@ -53,7 +53,7 @@ namespace MusicSelect {
|
||||
|
||||
sf::Text label_text{
|
||||
m_label,
|
||||
m_resources.noto_sans_medium,
|
||||
m_resources.fallback_font.black,
|
||||
static_cast<unsigned int>(get_size()*0.7f)
|
||||
};
|
||||
label_text.setFillColor(sf::Color::White);
|
||||
@ -144,7 +144,7 @@ namespace MusicSelect {
|
||||
auto dif = m_song->chart_levels.at(last_selected_chart);
|
||||
sf::Text dif_label{
|
||||
std::to_string(dif),
|
||||
m_resources.noto_sans_medium,
|
||||
m_resources.fallback_font.black,
|
||||
static_cast<unsigned int>(get_size()*0.15f)
|
||||
};
|
||||
dif_label.setFillColor(sf::Color::White);
|
||||
@ -153,7 +153,7 @@ namespace MusicSelect {
|
||||
target.draw(dif_label, states);
|
||||
}
|
||||
sf::Text song_title;
|
||||
song_title.setFont(m_resources.noto_sans_medium);
|
||||
song_title.setFont(m_resources.fallback_font.medium);
|
||||
song_title.setString(m_song->title);
|
||||
song_title.setCharacterSize(static_cast<unsigned int>(0.06875f*get_size()));
|
||||
song_title.setFillColor(sf::Color::White);
|
||||
@ -183,7 +183,7 @@ namespace MusicSelect {
|
||||
target.draw(frame, states);
|
||||
|
||||
sf::Text message;
|
||||
message.setFont(m_resources.noto_sans_medium);
|
||||
message.setFont(m_resources.fallback_font.medium);
|
||||
message.setString(m_message);
|
||||
message.setCharacterSize(static_cast<unsigned int>(0.1f*get_size()));
|
||||
message.setFillColor(m_color);
|
||||
|
@ -7,16 +7,29 @@
|
||||
#include "Panel.hpp"
|
||||
|
||||
namespace MusicSelect {
|
||||
|
||||
FallbackFont::FallbackFont() :
|
||||
light(),
|
||||
medium(),
|
||||
black()
|
||||
{
|
||||
if (not light.loadFromFile("assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Light.ttf")) {
|
||||
throw std::runtime_error("Unable to load assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Light.ttf");
|
||||
}
|
||||
if (not medium.loadFromFile("assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Medium.ttf")) {
|
||||
throw std::runtime_error("Unable to load assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Medium.ttf");
|
||||
}
|
||||
if (not black.loadFromFile("assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Black.ttf")) {
|
||||
throw std::runtime_error("Unable to load assets/fonts/M_PLUS_Rounded_1c/MPLUSRounded1c-Black.ttf");
|
||||
}
|
||||
}
|
||||
|
||||
SharedResources::SharedResources(Data::Preferences& p) :
|
||||
Data::HoldsPreferences(p),
|
||||
covers(),
|
||||
fallback_cover(),
|
||||
noto_sans_medium()
|
||||
fallback_cover()
|
||||
{
|
||||
covers.reserve(256);
|
||||
if (not noto_sans_medium.loadFromFile("assets/fonts/NotoSans-Medium.ttf")) {
|
||||
throw std::runtime_error("Unable to load assets/fonts/NotoSans-Medium.ttf");
|
||||
}
|
||||
if (not fallback_cover.loadFromFile("assets/textures/fallback_cover.png")) {
|
||||
throw std::runtime_error("Unable to load assets/textures/fallback_cover.png");
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <optional>
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <SFML/Graphics/Font.hpp>
|
||||
#include <SFML/System.hpp>
|
||||
|
||||
#include "../../Resources/TextureCache.hpp"
|
||||
@ -25,6 +26,13 @@ namespace MusicSelect {
|
||||
bool is_first_click = true;
|
||||
};
|
||||
|
||||
struct FallbackFont {
|
||||
FallbackFont();
|
||||
sf::Font light;
|
||||
sf::Font medium;
|
||||
sf::Font black;
|
||||
};
|
||||
|
||||
// Holds everything that needs to be shared by all levels of the class hierarchy
|
||||
struct SharedResources : public Data::HoldsPreferences {
|
||||
SharedResources(Data::Preferences& p);
|
||||
@ -32,7 +40,7 @@ namespace MusicSelect {
|
||||
Textures::TextureCache covers;
|
||||
sf::Texture fallback_cover;
|
||||
|
||||
sf::Font noto_sans_medium;
|
||||
FallbackFont fallback_font;
|
||||
|
||||
MusicSelect::DensityGraphCache density_graphs;
|
||||
|
||||
|
@ -81,7 +81,7 @@ namespace MusicSelect {
|
||||
if (not song_title.empty()) {
|
||||
sf::Text song_title_label{
|
||||
song_title,
|
||||
m_resources.noto_sans_medium,
|
||||
m_resources.fallback_font.medium,
|
||||
static_cast<unsigned int>(
|
||||
0.026315789f*get_screen_width()
|
||||
)
|
||||
@ -102,7 +102,7 @@ namespace MusicSelect {
|
||||
if (not song_artist.empty()) {
|
||||
sf::Text song_artist_label{
|
||||
song_artist,
|
||||
m_resources.noto_sans_medium,
|
||||
m_resources.fallback_font.medium,
|
||||
static_cast<unsigned int>(
|
||||
0.02f*get_screen_width()
|
||||
)
|
||||
@ -134,7 +134,7 @@ namespace MusicSelect {
|
||||
}
|
||||
sf::Text level_label{
|
||||
"LEVEL",
|
||||
m_resources.noto_sans_medium,
|
||||
m_resources.fallback_font.light,
|
||||
static_cast<unsigned int>(12.f/768.f*get_screen_width())
|
||||
};
|
||||
Toolkit::set_origin_normalized(level_label, 0.5f, 0.f);
|
||||
@ -144,7 +144,7 @@ namespace MusicSelect {
|
||||
|
||||
sf::Text level_number_label{
|
||||
std::to_string(selected_chart->song.chart_levels.at(selected_chart->difficulty)),
|
||||
m_resources.noto_sans_medium,
|
||||
m_resources.fallback_font.black,
|
||||
static_cast<unsigned int>(130.f/768.f*get_screen_width())
|
||||
};
|
||||
Toolkit::set_origin_normalized(level_number_label, 0.5f, 0.f);
|
||||
@ -163,7 +163,7 @@ namespace MusicSelect {
|
||||
|
||||
sf::Text chart_label{
|
||||
full_difficulty,
|
||||
m_resources.noto_sans_medium,
|
||||
m_resources.fallback_font.medium,
|
||||
static_cast<unsigned int>(20.f/768.f*get_screen_width())
|
||||
};
|
||||
Toolkit::set_origin_normalized_no_position(chart_label, 0.5f, 0.f);
|
||||
|
Loading…
x
Reference in New Issue
Block a user