We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4343

Summary: style Outline overlap
Product: SDL_ttf Reporter: Sylvain <sylvain.becker>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: unspecified   
Hardware: x86_64   
OS: Linux   
Attachments: patch
test case

Description Sylvain 2018-10-30 21:04:10 UTC
When using Outline style with a big value (~50). Text starts to overlap (the end being written at the beginning.

because the following check is un-activated with an outline not 0. 
        
        /* Ensure the width of the pixmap is correct. On some cases,
         * freetype may report a larger pixmap than possible.*/
        width = current->width;
        if (font->outline <= 0 && width > glyph->maxx - glyph->minx) {
            width = glyph->maxx - glyph->minx;
        }

That was done with initial implementation because the maxx/minx were not updated with outline. Since https://hg.libsdl.org/SDL_ttf/rev/ff81ac6d76c4 it is. ( cached->maxx += 2 * fo; )
Now that we can reactivated this sanity check.

Moreover, the fact we hit the overlap means that the pixmap/bitmap is cropped a little bit. We can increase a little bit the bounding box..
Comment 1 Sylvain 2018-10-30 21:08:00 UTC
Created attachment 3420 [details]
patch

patch

Increasing by 2.1f * outline seems to prevent cropping the outlined pixmap.
Comment 2 Sylvain 2018-10-30 21:11:10 UTC
Created attachment 3421 [details]
test case

test case if needed.
decrease/increase outline by keyboard q/w
Comment 3 Sam Lantinga 2018-10-31 03:10:20 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL_ttf/rev/9c15d85d32e3