Skip to content
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

Fixes gcc wnarrowing spam (issue #38) #39

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

SnapperTT
Copy link

Adds a number of int casts to take out gcc -wnarrowing spam

@grimfang4
Copy link
Owner

Sorry I didn't think about this earlier, but this library compiles slightly differently for SDL and SDL_gpu. SDL uses a rect structure that stores integers, while SDL_gpu uses one that stores floats. SDL_FontCache uses a #define to make FC_Rect match the rect used by the appropriate rendering system. The solution here should depend on which system is being used so the floating point precision is preserved for SDL_gpu instead of always truncating to int.

@SnapperTT
Copy link
Author

SnapperTT commented Sep 16, 2019

This could be fixed by having:

#ifdef SDL_gpu (or other)
   #define FC_COORD float
#else
   #define FC_COORD int
#endif

And replacing all (int) casts with (FC_COORD) casts. Sound good for me to do this?

@grimfang4
Copy link
Owner

Yep, I'm good with that.

@SnapperTT
Copy link
Author

Updated. Also changed #include "SDL.h" to #include <SDL.h>. If you like I can change it back (and the turn around for said change should be faster. Sorry to keep you waiting mate!)

@grimfang4
Copy link
Owner

Hey, no problem. I've got plenty to occupy me. :)

I'd prefer it as "SDL.h" because it should be checking project-defined search directories before checking standard install locations.

@SnapperTT
Copy link
Author

I've reverted the <> to "", and took a crack at #29 .

I've added a "fallback" member to FC_Font, added "void FC_AddFallback(base_font, fallback_font)" which adds the fallback font to the end of the fallback font linked list, and added the font switching to SDL_FontCache.c:1617.

The font switching does "work" - it does successfully load glyphs from other fonts, however the is-glyph-missing detection does not work, so its commented out, so that when a suitable fix is found it can be easily applied

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants