-
-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] g.Style().SetFontSize is not working on windows #692
Comments
Any updates on this issue? It seems that it is still broken... I didn't get it... at first, when I played with the FontAtlas stuff, it rendered the fonts ok.. |
Well.. after some research I managed to make it work on Windows... Basically you need to create a "yourprogram.manifest" file with this info: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="Any Cool Name" type="win32"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
<gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling>
</windowsSettings>
</application>
</assembly> Use a tool like this one available for Go: https://github.com/akavel/rsrc to generate a .syso file like so:
After generating the .syso file, you can simply These are the magic lines that made the fonts work as intended..
|
@wilsonmfaria that is a nice workaround. The one thing happening here is, that Does somebody have an idea, how I could get the "physical/real" resolution of a display by code? My problem is, that all methods e.g. Would be awesome if somebody has an idea, as without wilsonmfarias workarround the textwill all be in default font. |
As i can't check it right now but i suggest to try the latest master which uses cimgui-go instead of imgui-go. Maybe this works there... |
I think there is a different underlying issue with the font atlas. I threw together a simple example. Will post it in a second. (Also tried the master with it, but crashes.) One moment :) |
Added my findings in a new issue, as I think it is not related to the |
Please check on v0.8.1 and confirm it still doesn't work |
@gucio321 I switched to Fedora, so I don't have a windows system to test this now. I tried to run it inside Virtual Box on Windows 11, the issue is still there. |
Nice to hear 😁
Ok, got it |
What happend?
I was running examples/setstyle but all the text are of same size. I expected
large label
to be bigger.This is happening for latest commit as well as
v0.6.2
.I looked into the code and i think i found the reason for this. (Code from https://github.com/AllenDang/giu/blob/master/FontAtlasProsessor.go#L300C1-L316C3)
Here for Windows we change the size in
fontInfo
struct and the key forextraFontMap
is generated from this updatedfontInfo
struct. But the struct inextraFonts
still stores the older size, which when used for PushFont never finds the data inextraFontMap
(here).Code example
main.go
To Reproduce
go run github.com/AllenDang/giu/examples/setstyle
v0.6.2
go run github.com/AllenDang/giu/examples/[email protected]
Both show the same output.
Version
master
OS
Windows 10
The text was updated successfully, but these errors were encountered: