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

Cursor position incorrect when a custom font or custom font scale is used. #1

Open
KillzXGaming opened this issue Sep 8, 2023 · 1 comment

Comments

@KillzXGaming
Copy link

KillzXGaming commented Sep 8, 2023

When I have a custom font set, the cursor slowly gets offset the more characters are on a line. The cursor should be at the end of the text, rather than spaced out.

If a custom font scale is set ie ImGui.SetWindowFontScale(FontScale), the cursor also breaks in a similar way though I am not sure if that is the same issue.

image

Font settings:

unsafe
{
    var nativeConfig = ImGuiNative.ImFontConfig_ImFontConfig();
    //Add a higher horizontal/vertical sample rate for global scaling.
    (*nativeConfig).OversampleH = 8;
    (*nativeConfig).OversampleV = 8;
    (*nativeConfig).RasterizerMultiply = 1f;
    (*nativeConfig).GlyphOffset = new System.Numerics.Vector2(0);

    io.Fonts.AddFontFromFileTTF("Font.ttf", 16, nativeConfig);
}

Font file:
Font.zip

Btw thanks for this library! It has been very useful.

@csinkers
Copy link
Owner

Thanks for the report! I'm currently travelling until Nov, so might not get to this for a bit

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