Use proper font in ImGuiColorTextEdit.

This commit is contained in:
Bartosz Taudul 2018-08-17 15:10:58 +02:00
parent 5bd35eb34e
commit f3cc5cfd07

View File

@ -412,8 +412,9 @@ void TextEditor::Render(const char* aTitle, const ImVec2& aSize, bool aBorder)
mTextChanged = false; mTextChanged = false;
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
auto xadv = (io.Fonts->Fonts[0]->IndexAdvanceX['X']); auto font = ImGui::GetFont();
mCharAdvance = ImVec2(io.FontGlobalScale * xadv, io.FontGlobalScale * io.Fonts->Fonts[0]->FontSize + mLineSpacing); auto xadv = (font->IndexAdvanceX['X']);
mCharAdvance = ImVec2(io.FontGlobalScale * xadv, io.FontGlobalScale * font->FontSize + mLineSpacing);
ImGui::PushStyleColor(ImGuiCol_ChildWindowBg, ImGui::ColorConvertU32ToFloat4(mPalette[(int)PaletteIndex::Background])); ImGui::PushStyleColor(ImGuiCol_ChildWindowBg, ImGui::ColorConvertU32ToFloat4(mPalette[(int)PaletteIndex::Background]));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 0.0f));