diff --git a/FontAtlasProsessor.go b/FontAtlasProsessor.go index f48c34d0..c9478079 100644 --- a/FontAtlasProsessor.go +++ b/FontAtlasProsessor.go @@ -279,10 +279,10 @@ func (a *FontAtlas) rebuildFontAtlas() { } // Scale font size with DPI scale factor - // TODO - //if runtime.GOOS == windows { - // fontInfo.size *= Context.GetPlatform().GetContentScale() - //} + if runtime.GOOS == windows { + xScale, _ := Context.backend.ContentScale() + fontInfo.size *= xScale + } if len(fontInfo.fontByte) == 0 { fonts.AddFontFromFileTTFV(fontInfo.fontPath, fontInfo.size, fontConfig, ranges.Data()) @@ -309,10 +309,10 @@ func (a *FontAtlas) rebuildFontAtlas() { // Add extra fonts for _, fontInfo := range a.extraFonts { // Scale font size with DPI scale factor - // TODO - //if runtime.GOOS == windows { - // fontInfo.size *= Context.GetPlatform().GetContentScale() - //} + if runtime.GOOS == windows { + xScale, _ := Context.backend.ContentScale() + fontInfo.size *= xScale + } // Store imgui.Font for PushFont var f *imgui.Font diff --git a/MasterWindow.go b/MasterWindow.go index 478aefc3..32bc8564 100644 --- a/MasterWindow.go +++ b/MasterWindow.go @@ -3,6 +3,7 @@ package giu import ( "image" "image/color" + "runtime" imgui "github.com/AllenDang/cimgui-go" "github.com/faiface/mainthread" @@ -117,9 +118,10 @@ func NewMasterWindow(title string, width, height int, flags MasterWindowFlags) * func (w *MasterWindow) setTheme() (fin func()) { // Scale DPI in windows - //if runtime.GOOS == "windows" { - // style.ScaleAllSizes(Context.GetPlatform().GetContentScale()) - //} + if runtime.GOOS == "windows" { + xScale, _ := Context.backend.ContentScale() + imgui.CurrentStyle().ScaleAllSizes(xScale) + } imgui.PushStyleVarFloat(imgui.StyleVarWindowRounding, 2) imgui.PushStyleVarFloat(imgui.StyleVarFrameRounding, 4)