Skip to content
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

How to solve the problem of blurred Chinese fonts #1

Closed
Charltsing opened this issue Aug 24, 2024 · 5 comments
Closed

How to solve the problem of blurred Chinese fonts #1

Charltsing opened this issue Aug 24, 2024 · 5 comments
Assignees

Comments

@Charltsing
Copy link

Charltsing commented Aug 24, 2024

IMGUI.net sample
1

Hexa.NET.ImGui.Widgets demo
2

Maybe there is a way to make Chinese fonts not appear blurry at 16 pixels, but I haven't found it yet.

@JunaMeinhold
Copy link
Member

JunaMeinhold commented Aug 24, 2024

You shouldn't used fixed (in this context) this will create a heap corruption, you either have to use the File load function or you have to keep the pointer alive for the time that the texture is created. And additionally read the Ownership comment, ImGui cannot free a piece of memory allocated with the GC either use mashal AllocH and Free or my utils.

@JunaMeinhold
Copy link
Member

the pointer has to be alive until you call

ImGui.GetTexDataAsRGBA32(io.Fonts, &pixels, &width, &height, null);

and create a texture after that it's safe to free.

@JunaMeinhold
Copy link
Member

if you want that imgui keeps ownership then i suggest using ImGui.MemAlloc instead of Marshal or my utils, this prevents issues with freeing.

@JunaMeinhold
Copy link
Member

JunaMeinhold commented Aug 24, 2024

(font size 24)
image
(font size 16)
image
(font size 16 with config.PixelSnapH = true; config.OversampleH = 1;)
image

the smaller you go, the more "blur" you get, and make sure you have your DPI configuration correct. (like in SDL2 or WinApi, or any windowing framework.)

@JunaMeinhold JunaMeinhold self-assigned this Aug 24, 2024
@Charltsing
Copy link
Author

Charltsing commented Aug 25, 2024

It may be a problem with ImGui

Maybe there is a way to make Chinese fonts not appear blurry at 16 pixels, but I haven't found it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants