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 4355

Summary: Multiline problems with TTF_SetFontOutline,
Product: SDL_ttf Reporter: darth.wolfenstein
Component: miscAssignee: Sylvain <sylvain.becker>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: unspecified   
Hardware: x86_64   
OS: Windows 10   
Attachments: outlined multiline text
patch

Description darth.wolfenstein 2018-11-03 17:45:36 UTC
Created attachment 3440 [details]
outlined multiline text

When you use TTF_SetFontOutline() to set outline on a text,. the outlined text get moved down right by the thickness of the outline. When you only print one line this is not a problem at all because you just move the outlined text up and to the left to make the outline fit with the actual text.

But when you use outline on TTF_RenderUTF8_Blended_Wrapped() there is a problem. The outlined text gets moved down for every line. Making the outline and the text not fit, see attachment.

I use something like this to print the text twice to get text with visible outline.

    if(_text.outline > 0)
    {
        TTF_SetFontOutline(_fonts[_text.font], _text.outline);
        _RenderTextBackend(_text.text, _text.font, _text.outlinecolor, _text.pos, _text.width, _text.utf8, _text.outline);
        TTF_SetFontOutline(_fonts[_text.font], 0);
    }
    _RenderTextBackend(_text.text, _text.font, _text.color, _text.pos, _text.width, _text.utf8, 0);

I think outlined text should automatically "fit" un-outlined text.
Comment 1 Sylvain 2018-11-06 13:53:23 UTC
Created attachment 3448 [details]
patch

here's a patch, 
diff'ed with bug 4361
Comment 2 Sylvain 2018-12-18 08:36:23 UTC
Fixed in https://hg.libsdl.org/SDL_ttf/rev/2c501c27c045
Can you try it ?
Comment 3 darth.wolfenstein 2018-12-22 11:35:00 UTC
I have actually never build SDL from scratch myself. I only get what I need from https://www.libsdl.org/projects/SDL_ttf/ or use nuget.
Comment 4 darth.wolfenstein 2019-05-25 21:31:23 UTC
I can comfirm it works with several new lines now.