| Summary: | TTF_Size() is computing a little bigger size | ||
|---|---|---|---|
| Product: | SDL_ttf | Reporter: | Sylvain <sylvain.becker> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | unspecified | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: | patch | ||
|
Description
Sylvain
2018-10-30 21:20:24 UTC
Created attachment 3422 [details]
patch
I'm accepting this patch, but I know I added that to fix something, but I can't remember what. Since you've made a bunch of other fixes relating to sizing, let's try this out now. https://hg.libsdl.org/SDL_ttf/rev/7489a6f9929b I think I got the reason as I saw some log 1) Now, when you render a string with only space " ", it will report an internal error "Text has zero width" and return NULL surface. Because bounding box is 0 (maxx == minx == 0), but advance has the value for potential next glyph. If you really want 1 space you need to write 2 spaces " ", so that the second one confirm the advance of the first. 2) Also, the difference can be for a trailing space. "foo " will be rendered as "foo" (+ advance of the last 'o'). Not sure, We may still want the first case 1), without the 2) ? Case 3) It may be a memory allocation when rendering a font (non scalable?) that has no width metrics. See bug 4346. Okay, this change is rolled back: https://hg.libsdl.org/SDL_ttf/rev/5df6b43a9f6d |