This PR rewrites and re-documents the sdl.ext.BitmapFont class, fixing a wide range of bugs and API unpleasantness. The main new additions are the render_text method, which renders text to an SDL surface (converted to ARGB8888 format by default) and supports custom line heights, and a :meth:remap method for customizing the surface-to-character mappings and fine-tuning character sizes (e.g. making the "i" character narrower than the "o" character).
Additionally, this PR deprecates the render method as it returns a SoftwareSprite instead of a regular SDL_Surface (now replaced by render_text), as well as the can_render method which is no longer useful (render_text and render_on already throw an informative exception on a missing character).
Merge Checklist
[x] the PR has been reviewed and all comments are resolved
PR Description
This PR rewrites and re-documents the
sdl.ext.BitmapFont
class, fixing a wide range of bugs and API unpleasantness. The main new additions are therender_text
method, which renders text to an SDL surface (converted to ARGB8888 format by default) and supports custom line heights, and a :meth:remap
method for customizing the surface-to-character mappings and fine-tuning character sizes (e.g. making the "i" character narrower than the "o" character).Additionally, this PR deprecates the
render
method as it returns aSoftwareSprite
instead of a regularSDL_Surface
(now replaced byrender_text
), as well as thecan_render
method which is no longer useful (render_text
andrender_on
already throw an informative exception on a missing character).Merge Checklist
closes #<issue-number>
to automatically close an issue