This website requires JavaScript.
Explore
Help
Sign In
andrew
/
libakgl
Watch
1
Star
0
Fork
0
You've already forked libakgl
Code
Issues
66
Pull Requests
1
Actions
1
Packages
Projects
Releases
Wiki
Activity
Files
490e62dbbf8bcceb07e5632a16043fb35e015f2d
libakgl
/
tests
/
assets
/
akgl_test_mono.ttf
25 lines
9.9 KiB
Plaintext
Raw
Normal View
History
Unescape
Escape
Measure rendered text without drawing it akbasic needs the advance width of one character cell to build a terminal-style text surface, and the wrapped size to know where a string crosses the right margin. akgl_text_measure and akgl_text_measure_wrapped report both over TTF_GetStringSize and TTF_GetStringSizeWrapped; neither needs a renderer, so this half of the text subsystem is testable without the offscreen harness. A negative wrap length is refused with AKERR_OUTOFBOUNDS: SDL_ttf reads it as a very large unsigned width and quietly stops wrapping, which would return a measurement that is wrong rather than an error the caller can see. Also fixes akgl_text_loadfont, which checked name twice and passed an unchecked filepath to TTF_OpenFont (TODO item 39). The fixture font is a 10 KB monospaced ASCII subset of Liberation Mono, renamed because "Liberation" is a Reserved Font Name; see tests/assets/akgl_test_mono.LICENSE.txt. Monospaced so the suite can assert width("AAAA") == 4 * width("A") rather than hardcode glyph metrics. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 06:55:25 -04:00