-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port font to SDL3(_ttf) #3326
base: main
Are you sure you want to change the base?
Port font to SDL3(_ttf) #3326
Conversation
bce1f33
to
a9e5f40
Compare
if (!TTF_SetFontScript(font, HB_TAG(script_code[0], script_code[1], | ||
script_code[2], script_code[3]))) | ||
#else | ||
if (TTF_SetFontScriptName(font, script_code) < 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: raise an issue about this.
It's a recent change, from libsdl-org/SDL_ttf#473
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: slightly incorrect, check further comments, point is still valid
A lot if not all TTF functions in sdl3 (I assume?) have 0 on success and -1 on error, like TTF_SizeText
or TTF_Init
, so checking if (TTF_X) {error}
is actually wrong and should be if (TTF_X < 0) {error}
. I know this PR is supposed to compile it, but without this an extra PR can't be avoided to fix this so you might aswell change it now.
Correction: |
I said my 0 and -1 returns while looking at my IDE docstrings, but my IDE was actually looking at SDL2 functions, so no < 0 is incorrect and will never raise (that's why those bug errors disappeared) so yeah a not operator is needed like you said. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things that I've caught, definitely not checked exhaustively.
SDL3_ttf preview release: https://github.com/libsdl-org/SDL_ttf/releases/tag/preview-3.1.0
With this PR
pygame.font
compiles on SDL3(_ttf)