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
Remove restriction on rendering 4-byte characters on pygame.font part 2 of 2 #2746
Conversation
015e0cb
to
353ff7d
Compare
SDL_TTF_VERSION_ATLEAST wasn't defined until recently... which makes using it problematic with old code. No idea why it crashed the compiler on src_c/surface_fill.c... but seems to work now. |
8592edd
to
b323ed7
Compare
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.
This PR is very useful indeed!
Hehe, Avaxar had asked me on discord to continue on his PR and I got some work done locally on this a while back, but forgot to finish up and push. Anyways, no probs! We can go ahead with this PR, and the #define
of SDL_TTF_VERSION_ATLEAST
when it is missing is nice!
Before this PR is merged, it would need a doc update to reflect this change, and also I was thinking, a way to check at runtime if pygame.font
module supports ucs4 range would be something useful to people
How about I add the doc update, and for now detecting usc4 can be done with a pygame version check of >= 2.0.2? |
Well uhm... There is a chance that someone has pygame 2.0.2 but not SDL_ttf v2.0.15. So users checking for pygame version is a not-so-good idea. Maybe this feature can wait for 2.0.3? but IDK I would certainly prefer to have like an attribute check, something like if hasattr(pygame.font, "ucs4"):
do_ucs4_stuff()
else:
do_non_ucs4_stuff() Also this way, the checking code remains compatible with older pygame versions, because introducing a new check function would ofc not work on older pygame versions |
Mind if I push to this branch and finish this PR? Or @illume do you want to continue on this? |
Does this mean we can render emoji now? Are they colourful or monochrome? Do they use the colour passed in by the caller? |
Yeah, the ucs4 check would be nice. IMHO: I can at least document this now, and it could be merged. The ucs4 can happen at any time later. |
hmmm, aight! Sounds like a plan for now. This feature would need some more testing as well (also maybe more unit tests for this), but that too can happen after this PR |
Add handling for SDL below version 2.0.15 Comment out old test for UCS-4 error with old SDL_ttf Co-authored-by: René Dudfield <renesd@gmail.com>
5dd3e2b
to
8048408
Compare
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.
This PR looks good to go! 🎉 🥳
Left a minor review though
13bcf9c
to
7527118
Compare
7527118
to
bde8421
Compare
continued on from #2627
Just a little bug fix for those changes to pass CI (by disabling the old test).