| Summary: | TTF_RenderUTF8_Blended_Wrapped ignores lineSpace | ||
|---|---|---|---|
| Product: | SDL_ttf | Reporter: | Tim <tim.montague> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sylvain.becker |
| Version: | 2.0.13 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
TTF_RenderUTF8_Blended_Wrapped lineSpace patch
Test program showing the problem Font used by the test program patch patch v2 |
||
|
Description
Tim
2017-06-23 00:21:27 UTC
Created attachment 2919 [details]
Test program showing the problem
Created attachment 2920 [details]
Font used by the test program
I committed what I think the actual fix should be, but I don't want to enable it until the next release that can change font rendering size, so I don't break anyone who is relying on this behavior for their UI. https://hg.libsdl.org/SDL_ttf/rev/b3c9090d1120 Feel free to grab this change and define TTF_USE_LINESKIP for your build though! Shouldn't it be: numLines * TTF_FontLineSkip(font) instead of: height * TTF_FontLineSkip(font) ? Yes indeed, thanks! https://hg.libsdl.org/SDL_ttf/rev/3528ff8cb609 Created attachment 3438 [details]
patch
I have attached a patch to clean-up the define because we've made already lots of changes.
also:
- lineskip is still not really used as it just defined as the font height, so that doesn't change in the end.
- the current font height definition (ascender - descender + 1) is sometimes bigger than lineskip. -> just use font height.
If we want to propose an api to set the lineskip, I think it will be easier to propose a "linegap". currently the height between to line is not exactly "font->height", but "font->height + a potential ystart" for strings that contain a glyph that goes higher than ascender.
Created attachment 3441 [details]
patch v2
I would go for this version of patch: font->height is defined as
font->height = FT_CEIL(FT_MulFix(face->ascender - face->descender, scale));
Since the freetype definition in FT_FaceRec gives:
/* height :: This value is the vertical distance */
/* between two consecutive baselines, */
/* expressed in font units. It is always */
/* positive. Only relevant for scalable */
/* formats. */
/* */
/* If you want the global glyph height, use */
/* `ascender - descender'. */
That doesn't make lots of differences.
Okay, I've accepted this patch. This will definitely change layout for some applications, so I'm thinking with all the changes in this release maybe we should mark it as ABI changing. https://hg.libsdl.org/SDL_ttf/rev/b9d25816d9dc |