FIX: imgui font texture failed
Change-Id: I5ba0ad1c568024ab15e3c1559015e192709376a2
This commit is contained in:
parent
a3071f9e48
commit
04d3917993
|
@ -1705,10 +1705,12 @@ void ImGuiWrapper::init_font(bool compress)
|
||||||
#endif
|
#endif
|
||||||
builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted)
|
builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted)
|
||||||
|
|
||||||
|
io.Fonts->Flags |= ImFontAtlasFlags_NoPowerOfTwoHeight;
|
||||||
|
ImFontConfig cfg = ImFontConfig();
|
||||||
|
cfg.OversampleH = cfg.OversampleV = 1;
|
||||||
//FIXME replace with io.Fonts->AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, m_font_size, nullptr, ranges.Data);
|
//FIXME replace with io.Fonts->AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, m_font_size, nullptr, ranges.Data);
|
||||||
//https://github.com/ocornut/imgui/issues/220
|
//https://github.com/ocornut/imgui/issues/220
|
||||||
ImFont* font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "HarmonyOS_Sans_SC_Regular.ttf").c_str(), m_font_size, nullptr, ranges.Data);
|
ImFont* font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "HarmonyOS_Sans_SC_Regular.ttf").c_str(), m_font_size, &cfg, io.Fonts->GetGlyphRangesChineseSimplifiedCommon());
|
||||||
|
|
||||||
if (font == nullptr) {
|
if (font == nullptr) {
|
||||||
font = io.Fonts->AddFontDefault();
|
font = io.Fonts->AddFontDefault();
|
||||||
if (font == nullptr) {
|
if (font == nullptr) {
|
||||||
|
@ -1716,10 +1718,7 @@ void ImGuiWrapper::init_font(bool compress)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImFontConfig cfg = ImFontConfig();
|
bold_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "HarmonyOS_Sans_SC_Bold.ttf").c_str(), m_font_size, &cfg, io.Fonts->GetGlyphRangesChineseSimplifiedCommon());
|
||||||
cfg.OversampleH = 1;
|
|
||||||
bold_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "HarmonyOS_Sans_SC_Bold.ttf").c_str(), m_font_size, &cfg);
|
|
||||||
|
|
||||||
if (bold_font == nullptr) {
|
if (bold_font == nullptr) {
|
||||||
bold_font = io.Fonts->AddFontDefault();
|
bold_font = io.Fonts->AddFontDefault();
|
||||||
if (bold_font == nullptr) { throw Slic3r::RuntimeError("ImGui: Could not load deafult font"); }
|
if (bold_font == nullptr) { throw Slic3r::RuntimeError("ImGui: Could not load deafult font"); }
|
||||||
|
|
Loading…
Reference in New Issue