Adding special OS characters for keyboard shortcuts to ImGUI font map.
This commit is contained in:
parent
739d8131ab
commit
8f762168ba
1 changed files with 14 additions and 2 deletions
|
@ -447,9 +447,21 @@ void ImGuiWrapper::init_font(bool compress)
|
|||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.Fonts->Clear();
|
||||
//FIXME replace with io.Fonts->AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, m_font_size, nullptr, m_glyph_ranges);
|
||||
|
||||
// Create ranges of characters from m_glyph_ranges, possibly adding some OS specific special characters.
|
||||
ImVector<ImWchar> ranges;
|
||||
ImFontAtlas::GlyphRangesBuilder builder;
|
||||
builder.AddRanges(m_glyph_ranges);
|
||||
#ifdef __APPLE__
|
||||
builder.AddChar(0x2318); // OSX Command Key symbol
|
||||
builder.AddChar(0x2325); // OSX Option Key symbol
|
||||
builder.AddChar(0x21E7); // OSX Shift Key symbol
|
||||
#endif
|
||||
builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted)
|
||||
|
||||
//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
|
||||
ImFont* font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + (m_font_cjk ? "NotoSansCJK-Regular.ttc" : "NotoSans-Regular.ttf")).c_str(), m_font_size, nullptr, m_glyph_ranges);
|
||||
ImFont* font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + (m_font_cjk ? "NotoSansCJK-Regular.ttc" : "NotoSans-Regular.ttf")).c_str(), m_font_size, nullptr, ranges.Data);
|
||||
if (font == nullptr) {
|
||||
font = io.Fonts->AddFontDefault();
|
||||
if (font == nullptr) {
|
||||
|
|
Loading…
Reference in a new issue