SDL_ttf icon indicating copy to clipboard operation
SDL_ttf copied to clipboard

SDL_ttf test app + patches to apply to FreeType-2.9.1

Open SDLBugzilla opened this issue 4 years ago • 6 comments

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: unspecified Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2018-11-09 15:38:50 +0000, Sylvain wrote:

Created attachment 3480 test app for SDL_ttf

Here's the console test app I've used for last bugs and also as a text rendering stress-test.

You can specify several fonts, strings, and interacts with the keyboard:

  • press several times "space" and you go with all strings and render modes (solid,shaded,blended).
  • use keyboard to: switch font, size, style, outline, kerning, hinting, wrap, etc. F1 for help!

I've added a few known broken strings and random strings. And also all fonts I found in SDL_ttf bug tracker (scalable/non-scalable. Extension .ttf, .fon, .pcf).

Press "r" for random (also "d" to turn off display-screen update) and it will render random configurations in an infinite loop. All configurations are displayed in the terminal, so that if it crashes or exits, copy paste the log and it playback only that test. (If you're unlucky, you still have the possibility to re-use the random seed to replay the whole test suite).

It brokes Freetype twice. You can get errors as "Glyph not found". Which are Freetype failing inside the Stroker without reporting it, then FT_Glyph_To_Bitmap failing. It affects style named "outline" in SDL_ttf.

I've reported them and there are already two short fixes in head: https://savannah.nongnu.org/bugs/?54976 https://savannah.nongnu.org/bugs/?54986

Those patch should probably be applied in SDL_ttf/external/freetype-2.9.1 for people re-build it. (BTW, the current external/freetype-2.9.1 fails to autogen/configure on linux, is that normal ?, and I had to re-use the official distribution and also FT2 head).

Otherwise, I let it run for 20 hours and it renders 50.10^6 times without crashing. (Remember all memory dst_checks get removed). Which means it looks very stable to me.

On 2018-11-09 15:41:33 +0000, Sylvain wrote:

Created attachment 3481 fonts

The fonts archive

On 2018-11-13 01:02:47 +0000, Sam Lantinga wrote:

Great! I'll leave this open for us to use for SDL_ttf regression testing.

On 2018-11-13 01:05:12 +0000, Sam Lantinga wrote:

I've applied the upstream fixes. Kudos! https://hg.libsdl.org/SDL_ttf/rev/f08df1ebbf08

On 2018-11-13 10:07:23 +0000, Sylvain wrote:

Created attachment 3485 test app for SDL_ttf

Updated the test app with three defines so it can use:

HAVE_STREAM_TEXTURE_FUNCTION (d to switch {render to surface, no render, render to texture}) Need patch to render to a streaming texture (bug 1399)

HAVE_SET_FONT_SIZE_FUNCTION Need patch to set size dynamically (bug 2487)

HAVE_ALL_WRAPPED_FUNCTIONS Need patch to have all wrapped functions (bug 4361)

On 2018-11-14 12:01:32 +0000, Sylvain wrote:

Created attachment 3493 test app for SDL_ttf

updates:

  • correct missing to use of TTF_GetKerning() instead of TTF_GetFontHinting()
  • better log message when changing size

On 2018-11-26 15:09:21 +0000, Sylvain wrote:

Created attachment 3505 test app for SDL_ttf

Some update: q/e : wrap size -/+ g/h : hinting -/+ (normal, light, light_subpix, mono, none) m : render mode Solid/Blended/Shaded F2 : save current rendering to .bmp

To try subpixel rendering:

  • h -> hinting=light_supix
  • m -> mode Blended or Shaded (but not solid)
  • v -> change font to -> DejaVuSans.ttf (4th) change string to "iiiiiiiiii"

reduce/change size with up/down

On 2018-12-13 16:04:29 +0000, Sylvain wrote:

Created attachment 3546 test app for SDL_ttf

Update the test app to allow changing text colours and alpha

SDLBugzilla avatar Feb 11 '21 05:02 SDLBugzilla

latest version of SDL_ttf_testapp.c SDL_ttf_testapp.c.txt

1bsyl avatar May 11 '22 17:05 1bsyl

@slouken @smcv This is the latest version of the test app I use for SDL_ttf. interactive with the console (F1 for help). with 'r' it run a random fuzzing rendering test and catch any bug. you can re-run with the same seed to debug. etc. Normally, you can run billion of string rendering without crashing

1bsyl avatar May 11 '22 17:05 1bsyl

Does it make sense to add this (and the test fonts) to the SDL_ttf repo, and exclude it from make dist?

slouken avatar May 11 '22 17:05 slouken

Not sure, maybe not yet. but at least, this test program exists and can be useful when adding new feature. One can use any fonts (There are hard-coded)

1bsyl avatar May 11 '22 17:05 1bsyl

If @1bsyl is willing to license it the same as the rest of SDL_ttf, I think it would be useful to have the test program in the SDL_ttf git repo and maybe even in dist tarballs, even if it isn't run (or even built) by default.

Modifying it to list all files in ./fonts and use those (or something) would make it more generally applicable?

Adding the test fonts to either the SDL_ttf repo or tarball doesn't seem great, though, both from a copyright/licensing point of view (each font has its own copyright/licensing, and some distros will be grumpy about lack of source code), and from a size point of view.

smcv avatar May 11 '22 20:05 smcv

Yes, this is licensed same as SDL_ttf ! Ideally, it could populate a list with some fonts found in the machine. (but I also used fixed font, emoji font, international font etc.) It probably needs a lot of clean-up inside.

1bsyl avatar May 11 '22 20:05 1bsyl

Thank you @1bsyl for the test application!

madebr avatar Sep 07 '23 22:09 madebr