| Summary: | Suggestion: adding TTF_SetFontSize() to set font size dynamically | ||
|---|---|---|---|
| Product: | SDL_ttf | Reporter: | George Wu <micstu> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | API change | ||
| Priority: | P2 | CC: | philipp.wiesemann, sylvain.becker |
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: |
The TTF_SetFontSize() function.
patch test case |
||
|
Description
George Wu
2014-04-09 13:54:11 UTC
The TTF_SetFontSize() function uses TTF_CloseFont() on the TTF_Font if there was an error which then also deletes the TTF_Font. I think this is confusing because I would expect the TTF_Font to be still usable after calling TTF_SetFontSize(). There is no return value which tells me that I can not use it again. The other TTF_Set*() also do not have return values so maybe a consistent solution would be to have TTF_SetFontSize() set the error message but not delete the TTF_Font. (This assumes that trying to set the font size and failing does not corrupt the TTF_Font in any way.) To make TTF_SetFontSize() usable it also needs to be added to SDL_ttf.h. The function TF_SetFontSize() is also available in an attachment at bug 2486. Created attachment 3418 [details]
patch
Add a patch for this based on head with similar behaviour.
Created attachment 3419 [details]
test case
test case to try it. keyboard o/p to change increase/decrease the font size.
Fixed in ttps://hg.libsdl.org/SDL_ttf/rev/1f3d498496da |