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 - Multiline problems with TTF_SetFontOutline,
Summary: Multiline problems with TTF_SetFontOutline,
Status: RESOLVED FIXED
Alias: None
Product: SDL_ttf
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: x86_64 Windows 10
: P2 normal
Assignee: Sylvain
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-03 17:45 UTC by darth.wolfenstein
Modified: 2019-05-25 21:31 UTC (History)
0 users

See Also:


Attachments
outlined multiline text (4.36 KB, image/png)
2018-11-03 17:45 UTC, darth.wolfenstein
Details
patch (1.20 KB, patch)
2018-11-06 13:53 UTC, Sylvain
Details | Diff

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