mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-26 16:13:58 -06:00
ENH:GLGizmoText style display
Change-Id: Ie7e3a91a10464cf8b85f7553b74973a4cbac3bca
This commit is contained in:
parent
929ab9d327
commit
6d46ac98ba
8 changed files with 200 additions and 23 deletions
|
@ -30,6 +30,17 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
static std::map<std::string, std::string> g_occt_fonts_maps; //map<font_name, font_path>
|
||||
|
||||
static const std::vector<Standard_CString> fonts_suffix{ "Bold", "Medium", "Heavy", "Italic", "Oblique", "Inclined", "Light", "Thin",
|
||||
"Semibold", "ExtraBold", "ExtraBold", "Semilight", "SemiLight", "ExtraLight", "Extralight", "Ultralight",
|
||||
"Condensed", "Ultra", "Extra", "Expanded", "Extended", "1", "2", "3", "4", "5", "6", "7", "8", "9", "Noto Sans"};
|
||||
|
||||
std::map<std::string, std::string> get_occt_fonts_maps()
|
||||
{
|
||||
return g_occt_fonts_maps;
|
||||
}
|
||||
|
||||
std::vector<std::string> init_occt_fonts()
|
||||
{
|
||||
std::vector<std::string> stdFontNames;
|
||||
|
@ -41,9 +52,37 @@ std::vector<std::string> init_occt_fonts()
|
|||
aFontMgr->GetAvailableFontsNames(availFontNames);
|
||||
stdFontNames.reserve(availFontNames.Size());
|
||||
|
||||
for (auto afn : availFontNames)
|
||||
stdFontNames.push_back(afn->ToCString());
|
||||
g_occt_fonts_maps.clear();
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "init_occt_fonts start";
|
||||
#ifdef __APPLE__
|
||||
//from resource
|
||||
stdFontNames.push_back("HarmonyOS Sans SC");
|
||||
g_occt_fonts_maps.insert(std::make_pair("HarmoneyOS Sans SC", Slic3r::resources_dir() + "/fonts/" + "HarmonyOS_Sans_SC_Regular.ttf"));
|
||||
#endif
|
||||
for (auto afn : availFontNames) {
|
||||
#ifdef __APPLE__
|
||||
if(afn->String().StartsWith("."))
|
||||
continue;
|
||||
#endif
|
||||
bool repeat = false;
|
||||
for (size_t i = 0; i < fonts_suffix.size(); i++) {
|
||||
if (afn->SearchFromEnd(fonts_suffix[i]) != -1) {
|
||||
repeat = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (repeat)
|
||||
continue;
|
||||
|
||||
Handle(Font_SystemFont) sys_font = aFontMgr->GetFont(afn->ToCString());
|
||||
TCollection_AsciiString font_path = sys_font->FontPath(Font_FontAspect::Font_FontAspect_Regular);
|
||||
if (!font_path.IsEmpty()) {
|
||||
g_occt_fonts_maps.insert(std::make_pair(afn->ToCString(), font_path.ToCString()));
|
||||
stdFontNames.push_back(afn->ToCString());
|
||||
}
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "init_occt_fonts end";
|
||||
return stdFontNames;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue