SDL2_ttf 2.0.18 PRERELEASE!

SDL_ttf 2.0.18 is now available as a PRERELEASE build!
http://www.libsdl.org/tmp/SDL_ttf/

Changes in this build:

  • Added support for Signed Distance Field rendering with TTF_SetFontSDF() and TTF_GetFontSDF()
  • Added optional DPI-scaling of fonts, with the following new functions:
    TTF_OpenFontDPI()
    TTF_OpenFontIndexDPI()
    TTF_OpenFontDPIRW()
    TTF_OpenFontIndexDPIRW()
    TTF_SetFontSizeDPI()
  • Added 32-bit character support with:
    TTF_GlyphIsProvided32()
    TTF_GlyphMetrics32()
    TTF_RenderGlyph32_Solid()
    TTF_RenderGlyph32_Shaded()
    TTF_RenderGlyph32_Blended()
    TTF_GetFontKerningSizeGlyphs32()
  • Added functions to set direction and script when using Harfbuzz:
    TTF_SetDirection()
    TTF_SetScript()
  • Added extended API for text measurement:
    TTF_MeasureText()
    TTF_MeasureUTF8()
    TTF_MeasureUNICODE()
  • Added TTF_SetFontSize() to set font size dynamically
  • Added ‘Shaded’ and ‘Solid’ text wrapped functions:
    TTF_RenderText_Solid_Wrapped()
    TTF_RenderUTF8_Solid_Wrapped()
    TTF_RenderUNICODE_Solid_Wrapped()
    TTF_RenderText_Shaded_Wrapped()
    TTF_RenderUTF8_Shaded_Wrapped()
    TTF_RenderUNICODE_Shaded_Wrapped()
  • Added TTF_HINTING_LIGHT_SUBPIXEL for better results at small text sizes at a performance cost

Please report any bugs or regressions here:

Cheers!

3 Likes

Wow, this looks like a really nice feature packed release!

I’ve been playing around with the wrapped text functions, and I’m concerned about how they handle small wrap values.

At wrap length 0, the text renders as a single line, and newline characters are still rendered as unknown characters. I expected this to behave like the normal text rendering functions but newline aware.

With a positive but very small wrap length, the text doesn’t fully show up. Or parts of letters might show up. I expected this to allocate at least enough space to put at least one character of the input string on each line.

There’s quite a difference from 2.0.15 in how text is rendered, in Windows at least; 2.0.18 is considerably more bold. Is this expected?

ttf_compare

@rtrussel
Maybe create a separate issue.
Just try with latest and
It seems like size == 16 to me ?
I got the same difference when switching from Hinting mono vs none.
(“mono” would look like the 2.0.15, whereas 2.0.18 looks “none”).

12 points = 16 pixels (at nominal 96 DPI).

I think it’s probably a FreeType issue rather than SDL2_ttf. My 2.0.15 is using FreeType 2.4.12 (it’s a separate DLL) whereas 2.0.18 seems to have FreeType statically linked. I don’t know how to discover the version, because seemingly ‘FT_Library_Version()’ isn’t exported.

I got the same difference when switching from Hinting mono vs none

Thanks, I’ll try that.

The pre-release build has been updated with a few bug fixes and new functions TTF_GetFreeTypeVersion() and TTF_GetHarfBuzzVersion()

Where’s the documentation for these functions? I can’t find any mention of them at the ‘official’ documentation site.

Good question, but those docs are from 2005, so it’s not surprising they’re outdated

1 Like

Oh. They are the ones I have always used, I’m not aware of anything newer (it could be of course that until recently there were no changes to the public API that needed the docs to be updated).