Font quality in Linux #2

Closed
opened 2014-08-11 03:52:53 +00:00 by spworley · 2 comments
spworley commented 2014-08-11 03:52:53 +00:00 (Migrated from github.com)

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

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](https://cloud.githubusercontent.com/assets/2530715/3871955/b207275e-210a-11e4-9a35-455357837e68.png)
ocornut commented 2014-08-11 13:40:57 +00:00 (Migrated from github.com)

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.

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 commented 2014-08-11 14:05:16 +00:00 (Migrated from github.com)

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.

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.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#2
No description provided.