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

Font quality in Linux #2

Closed
spworley opened this issue Aug 11, 2014 · 2 comments
Closed

Font quality in Linux #2

spworley opened this issue Aug 11, 2014 · 2 comments

Comments

@spworley
Copy link

Running Ubuntu with the latest GLWF 3.0.4, fonts are very poorly rendered. The rightmost column of each glyph is clipped off, and the y baseline of each glyph is not consistent.

image

@ocornut
Copy link
Owner

ocornut commented Aug 11, 2014

In this function
void ImBitmapFont::RenderText(

You can replace

            const float s1 = (0.0f + glyph->X) * tex_scale_x;
            const float t1 = (0.0f + glyph->Y) * tex_scale_y;
            const float s2 = (0.0f + glyph->X + glyph->Width) * tex_scale_x;
            const float t2 = (0.0f + glyph->Y + glyph->Height) * tex_scale_y;

With

            const float s1 = (0.5f + glyph->X) * tex_scale_x;
            const float t1 = (0.5f + glyph->Y) * tex_scale_y;
            const float s2 = (0.5f + glyph->X + glyph->Width) * tex_scale_x;
            const float t2 = (0.5f + glyph->Y + glyph->Height) * tex_scale_y;

I am currently investigating the right way to expose that because the offset depends on your rendering architecture.

@ocornut
Copy link
Owner

ocornut commented Aug 11, 2014

I have commited a fix, added a 'float PixelCenterOffset' value in ImGuiIO which default to 0.5f (for OpenGL and DirectX 10+). The DirectX9 sample application sets it back to 0.0. Based on a suggestion by SimDietrich.

@ocornut ocornut closed this as completed Aug 11, 2014
@ocornut ocornut added the bug label Aug 11, 2014
Organic-Code added a commit to Organic-Code/imgui that referenced this issue Mar 5, 2019
I should update my settings, I guess
ocornut pushed a commit that referenced this issue Mar 6, 2019
Squashed commit of the following:

commit 1970d84
Author: Lucas Lazare <lazarelucas@yahoo.fr>
Date:   Tue Mar 5 12:20:39 2019 -0500

    Removing sneaky tabulations #2 (why, editor T-T)

    I should update my settings, I guess

commit 219bdfc
Author: Lucas Lazare <lazarelucas@yahoo.fr>
Date:   Tue Mar 5 12:17:27 2019 -0500

    Removing useless check introduced in b0d172

commit 8afd7a2
Author: Lucas Lazare <lazarelucas@yahoo.fr>
Date:   Tue Mar 5 11:49:24 2019 -0500

    Removing sneaky tabulations

commit 8e04908
Author: Lucas Lazare <lazarelucas@yahoo.fr>
Date:   Tue Mar 5 11:45:13 2019 -0500

    Moving InputTextHinted code to InputTextEx

commit b0d1723
Author: Lucas Lazare <lazarelucas@yahoo.fr>
Date:   Tue Mar 5 00:23:02 2019 -0500

    C++11 to C++98

commit 9afeae3
Author: Lucas Lazare <lazarelucas@yahoo.fr>
Date:   Mon Mar 4 23:43:28 2019 -0500

    Added InputTextHinted
guillermoblanca pushed a commit to guillermoblanca/imgui that referenced this issue Jun 18, 2019
supermerill added a commit to supermerill/imgui that referenced this issue Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants