pygame-community / pygame-ce

🐍🎮 pygame - Community Edition is a FOSS Python library for multimedia applications (like games). Built on top of the excellent SDL library.
https://pyga.me
949 stars 158 forks source link

wraplength for pygame.freetype.Font? #2587

Open gresm opened 1 year ago

gresm commented 1 year ago

It seems like there is no equivalent to pygame.font.Font.render(wraplength=...) for pygame.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:

MyreMylar commented 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.

gresm commented 1 year ago

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?

MyreMylar commented 1 year ago

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: @.***>

gresm commented 1 year ago
@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