-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[text] Review LoadTTF() spritefont generation #375
Comments
Just for record, I've been working on this issue (along with SDF font generation) for some time now. Current After some time working in an improved implementation for image font atlas generation, I came to different approximations:
Image GenImageFont(const char *fileName, int fontSize, int *fontChars, CharInfo *chars, int charsCount); This method give us an Font font = { 0 };
font.baseSize = 36;
font.charsCount = 96;
font.chars = (CharInfo *)malloc(font.charsCount*sizeof(CharInfo));
Image atlas = GenImageFont("fonts/Inconsolata.ttf", font.baseSize, NULL, font.chars, font.charsCount);
font.texture = LoadTextureFromImage(atlas);
CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, bool sdf);
Image GenImageFontAtlas(CharInfo *chars, int charsCount, int fontSize, int packMethod); I think those methods are more intuitive and give us more control over the full system, including packing mechanism inside Font font = { 0 };
font.baseSize = 36;
font.charsCount = 96;
font.chars = LoadFontData("fonts/Inconsolata.ttf", font.baseSize, NULL, font.charsCount, false);
Image atlas = GenImageFontAtlas(font.chars, font.charsCount, font.baseSize, 0);
font.texture = LoadTextureFromImage(atlas); I keep thinking on this API improvement, really need a versatile and intuitive system for future related projects. Comments are welcome! |
Improvements implemented in commit 75ba5ac Still some things to review:
|
Reviewed on commit 0e13511. For now I consider this implementation complete... only SDF example left. Working on it. |
... (edited by @raysan5) |
@iva0410217 why this issue is linked to 401? EDIT: I'll assume it was an error. Editing your post. |
Right now using a basic font baking mechanism, no proper texture-packing just aligning characters one after the other, no sub-pixel oversampling for better font quality.
This function can be improved...
The text was updated successfully, but these errors were encountered: