mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 05:15:59 +08:00
Fix icons.
Fix error message on uknown glyph in font
This commit is contained in:
parent
88523bceb6
commit
6a66436858
@ -57,8 +57,11 @@ std::optional<Emboss::Glyph> Private::get_glyph(stbtt_fontinfo &font_info, int u
|
|||||||
{
|
{
|
||||||
int glyph_index = stbtt_FindGlyphIndex(&font_info, unicode_letter);
|
int glyph_index = stbtt_FindGlyphIndex(&font_info, unicode_letter);
|
||||||
if (glyph_index == 0) {
|
if (glyph_index == 0) {
|
||||||
std::cerr << "Character codepoint(" << unicode_letter
|
wchar_t wchar = static_cast<wchar_t>(unicode_letter);
|
||||||
<< " = '" << (char) unicode_letter << "') is not defined in the font.";
|
std::cerr << "Character unicode letter ("
|
||||||
|
<< "decimal value = " << std::dec << unicode_letter << ", "
|
||||||
|
<< "hexadecimal value = U+" << std::hex << unicode_letter << std::dec
|
||||||
|
<< ") is NOT defined inside of the font. \n";
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,7 +525,7 @@ std::optional<Emboss::Glyph> Emboss::letter2glyph(const Font &font,
|
|||||||
{
|
{
|
||||||
auto font_info_opt = Private::load_font_info(font);
|
auto font_info_opt = Private::load_font_info(font);
|
||||||
if (!font_info_opt.has_value()) return {};
|
if (!font_info_opt.has_value()) return {};
|
||||||
return Private::get_glyph(*font_info_opt, (int) letter, flatness);
|
return Private::get_glyph(*font_info_opt, letter, flatness);
|
||||||
}
|
}
|
||||||
|
|
||||||
ExPolygons Emboss::text2shapes(Font & font,
|
ExPolygons Emboss::text2shapes(Font & font,
|
||||||
|
@ -470,7 +470,7 @@ void GLGizmoEmboss::initialize()
|
|||||||
|
|
||||||
// TODO: What to do when icon was NOT loaded?
|
// TODO: What to do when icon was NOT loaded?
|
||||||
bool success = init_icons();
|
bool success = init_icons();
|
||||||
|
assert(success);
|
||||||
load_font_list();
|
load_font_list();
|
||||||
|
|
||||||
|
|
||||||
@ -1416,7 +1416,7 @@ std::string GLGizmoEmboss::create_volume_name()
|
|||||||
|
|
||||||
bool GLGizmoEmboss::init_icons()
|
bool GLGizmoEmboss::init_icons()
|
||||||
{
|
{
|
||||||
std::string path = resources_dir() + "/icons/white/";
|
std::string path = resources_dir() + "/icons/";
|
||||||
|
|
||||||
// icon order has to match the enum IconType
|
// icon order has to match the enum IconType
|
||||||
std::vector<std::string> filenames = {path + "wrench.svg",
|
std::vector<std::string> filenames = {path + "wrench.svg",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user