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 - style Outline overlap
Summary: style Outline overlap
Status: RESOLVED FIXED
Alias: None
Product: SDL_ttf
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-30 21:04 UTC by Sylvain
Modified: 2018-10-31 03:10 UTC (History)
0 users

See Also:


Attachments
patch (3.24 KB, patch)
2018-10-30 21:08 UTC, Sylvain
Details | Diff
test case (8.30 KB, text/x-csrc)
2018-10-30 21:11 UTC, Sylvain
Details

Note You need to log in before you can comment on or make changes to this bug.
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