Open gresm opened 1 year ago
I don't think we should add any more features to the freetype submodule.
The intent should be to add features to font (either directly or via updates to SDL_ttf) so that we can reduce our number of text rendering submodules that use freetype from three down to a more sensible one.
I consider freetype submodule to be on a feature freeze.
So we are striving to deprecate freetype sub-module? I mostly prefer the API style used in it over font. Are there any plans on unifying the API between those two sub-modules?
The first step to having only one font submodule would be ensuring feature parity. So... somewhat? Depending on what parts you like. The APIs are already quite similar.
On Thu, 23 Nov 2023, 21:25 gresm, @.***> wrote:
So we are striving to deprecate freetype sub-module? I mostly prefer the API style used in it over font. Are there any plans on unifying the API between those two sub-modules?
— Reply to this email directly, view it on GitHub https://github.com/pygame-community/pygame-ce/issues/2587#issuecomment-1824923986, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGDGGVNRBTBRIRERIVXQW3YF65MHAVCNFSM6AAAAAA7XNDGG2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRUHEZDGOJYGY . You are receiving this because you commented.Message ID: @.***>
@MyreMylar here is a comparison table, it doesn't cover everything, but it still could be useful.
Good pygame.font.font |
Bad pygame.font.font |
Good pygame.freetype.Font |
Bad pygame.freetype.Font |
---|---|---|---|
metrics() - suggests an ability to change it, not full feature parity with render() | get_metrics() | not full feature parity with render() | |
get_ascent(), get_descent() | missing equivalents of: ascender, descender (get_unscaled_ascend(), get_unscaled_descend()) | get_sized_ascend(), get_sized_descender() - too long, also confusing names of:ascender, descender better use the naming convention above here: get_unscaled_ascend(), get_unscaled_descend() | |
missing equivalent of: height (get_unscaled_height()) | same with height, get_sized_height() | ||
implemented | missing getters for some properties:set_script(), get_direction() | not implemented (feature freeze?) | |
some of the properties have both get_x() + set_x() and .xIMO if it is read and write property, it should be implemented with getsetters not get_x() + set_x() (unless calculating it/changing it is computationally heavy, which in this case is note – they are simple flags of how to style the text) | no such doubling |
It seems like there is no equivalent to
pygame.font.Font.render(wraplength=...)
forpygame.freetype.Font
or at least it is badly documented... Are there any plans on supporting this?After some digging, I've also found a few other methods that lack
wraplength
functionality:pygame.font.Font.metrics(wraplength=...)
- offset should be calculated with taking it into accountpygame.freetype.Font.get_metrics(wraplength=...)
- same as abovepygame.freetype.Font.render(wraplength=...)
pygame.ftfont.Font.render(wraplength=...)
pygame.ftfont.Font.metrics(wraplength=...)