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

bug rendering a string starting with glyph with negative minx, in TTF_RenderUTF8_Shaded #43

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: unspecified
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2014-03-29 13:42:33 +0000, Sylvain wrote:

Hi,

With latest version, on Linux. (but whatever OS would do the same).

I try to render the string "Jap" in size 50, and what appears to be rendered is "Jap."
The "." is in fact the begining of the "J"

The first glyph has a value "minx" of -14
And so, should be "compensated for the wrap around with negative minx".

... basically :

in the function TTF_RenderUTF8_Shaded:
line 1586:
we have the initialisation to false :

first = SDL_FALSE

and it should be

first = SDL_TRUE

Thanks,

Sylvain

On 2014-04-17 06:53:12 +0000, Sylvain wrote:

Created attachment 1622
test case

test case

On 2014-04-17 06:55:45 +0000, Sylvain wrote:

Created attachment 1623
ttf font

And also the font for the testcase. All fonts do not make the bug appear. This one does.

On 2014-04-17 06:59:28 +0000, Sylvain wrote:

I was thinking of this patch :

diff -r 1854597a90fd SDL_ttf.c
--- a/SDL_ttf.c Sun Feb 02 02:32:02 2014 -0800
+++ b/SDL_ttf.c Thu Apr 17 08:55:46 2014 +0200
@@ -1583,7 +1583,7 @@

 /* Load and render each character */
 textlen = SDL_strlen(text);
  • first = SDL_FALSE;
  • first = SDL_TRUE;
    xstart = 0;
    while ( textlen > 0 ) {
    Uint16 c = UTF8_getch(&text, &textlen);

But this is not perfect. The "." does not appear, but the "J" is not fully rendered.

On 2014-04-17 07:00:28 +0000, Sylvain wrote:

Created attachment 1624
ttf font with no problem

This TTF font has no problem !

On 2014-04-22 11:21:40 +0000, Sylvain wrote:

Sorry, the two fonts are different. So the "J" is rendered as exepected when the patch is applied.

Please double-check the patch and apply it.
Thanks

On 2014-06-28 18:43:15 +0000, Sam Lantinga wrote:

Fixed, thanks!
https://hg.libsdl.org/SDL_ttf/rev/86d0c63699f4

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

1 participant