This PR overhauls and documents how text rendering works in KLibs. The main changes are:
Adding a new add_text_style function to KLText for defining styles without needing to use the undocumented and messy self.txtm
Changed message so blit_txt now defaults to False instead of True, since that's how it's used 95% of the time. message will now only blit the text if a location is provided and will just render/return the text without blitting otherwise (preserving backwards compatibility).
Added automatic loading of all user-provided fonts in ExpAssets/Resources/font, eliminating the need to load them manually with self.txtm.add_font.
Added/overhauled TextStyle as a user-facing class, so you can define a text style object without registering it in the environment. Useful for cases where you want to define a custom text style inside an object/function without worrying about the label overwriting an existing one.
Changed text spacing to be defined as a multiple of line height, similar to most word processors (e.g. 2.0 gives you double-spacing).
Removed a number of unused vestigial function arguments and object attributes.
Hopefully this makes text rendering in KLibs a lot smoother to work with and easier to understand!
Merge Checklist
[x] the PR has been reviewed and all comments are resolved
PR Description
This PR overhauls and documents how text rendering works in KLibs. The main changes are:
add_text_style
function to KLText for defining styles without needing to use the undocumented and messyself.txtm
message
soblit_txt
now defaults to False instead of True, since that's how it's used 95% of the time.message
will now only blit the text if alocation
is provided and will just render/return the text without blitting otherwise (preserving backwards compatibility).ExpAssets/Resources/font
, eliminating the need to load them manually withself.txtm.add_font
.TextStyle
as a user-facing class, so you can define a text style object without registering it in the environment. Useful for cases where you want to define a custom text style inside an object/function without worrying about the label overwriting an existing one.2.0
gives you double-spacing).Hopefully this makes text rendering in KLibs a lot smoother to work with and easier to understand!
Merge Checklist
closes #<issue-number>
to automatically close an issue