libsdl-org / SDL_ttf

Support for TrueType (.ttf) font files with Simple Directmedia Layer.
zlib License
343 stars 116 forks source link

Proposal: Add an API to modify the lineSkip property #353

Open rubenlg opened 2 months ago

rubenlg commented 2 months ago

Right now, when rendering multi-line text, there is no way to control how close to each other each line will render. TTF_initFontMetrics computes a value automatically that looks good, but might not be what the developer needs (e.g. when used in situations with restricted space). CSS allows controlling this with their line-height property, for example.

The proposal would be to add a pair of new functions:

TTF_GetFontLineSkip returns the current configuration. TTF_SetFontLineSkip allows setting a new configuration.

And TTF_FontLineSkip would remain working the same as today, returning the recommended skip for a particular font, ensuring backwards compatibility.

Does this make sense?