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

makefont: Fix invalid C data structures declarations #265

Merged
merged 1 commit into from
Jan 17, 2022

Conversation

mrnuke
Copy link
Contributor

@mrnuke mrnuke commented Jan 13, 2022

The data structures generated by makefont are not valid, and may fail
to compile depending on compiler flags:

error: missing braces around initializer [-Werror=missing-braces]
| texture_glyph_t font_glyph_00000020 = {32, 2, 2, 0, 0, 9.640625f
| ^

The texture_glyph_t::kerning field is a double array, so it is invalid
to initialize it as an integer, "0". When a glyph has no kerning
pairs, initialize the "kerning" field to "{{0}}".

Remove the "texture_glyph_0x100_t" structure and incorporate the
glyphs pointer array directly into texture_font_t.

The data structures generated by makefont are not valid, and may fail
to compile depending on compiler flags:

  error: missing braces around initializer [-Werror=missing-braces]
  | texture_glyph_t font_glyph_00000020 =   {32, 2, 2, 0, 0, 9.640625f
  |                                         ^

The texture_glyph_t::kerning field is a double array, so it is invalid
to initialize it as an integer, "0". When a glyph has no kerning
pairs, initialize the "kerning" field to "{{0}}".

Remove the "texture_glyph_0x100_t" structure and incorporate the
glyphs pointer array directly into texture_font_t.
@rougier
Copy link
Owner

rougier commented Jan 17, 2022

Thanks. Actually, I don't remember why there is a specific texture_glyph_0x100_t but I suspect here's a reason. I guess you tested then generated file and it's working as expected?

@mrnuke
Copy link
Contributor Author

mrnuke commented Jan 17, 2022

Yes, I can compile and use the generated file just fine.

@rougier
Copy link
Owner

rougier commented Jan 17, 2022

Ok, thanks.

@rougier rougier merged commit 85d7850 into rougier:master Jan 17, 2022
@mrnuke mrnuke deleted the fix-makefont branch July 14, 2022 14:14
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