-
Notifications
You must be signed in to change notification settings - Fork 66
Font cleanup #1847
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
Font cleanup #1847
Conversation
faceData might not be valid at the point it hits the warning "RE_RegisterFont: Unable to read font file %s".
RE_Glyph(), fontInfo_t::height, fontInfo_t::glyphScale, a couple macros
The lengthy comment which is also deleted here explains that once upon a time, pre-rasterized fonts were shipped with Q3A to work around licensing issues with FreeType. The file format being NUKED here was a binary format with a .dat extension, which just specified size, tex coords, etc. for 256 glyphs; the rasterized images were stored in other files.
We only load one font, one time - the console font. No need for a font table caching system to detect duplicate font load requests.
How the cgame does to load a font? |
It has its own copy of the Freetype library. Font rasterization is done entirely inside the cgame. |
necessarily-equal
left a comment
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.
Code change LGTM, didn't test
| } | ||
|
|
||
| void RE_UnregisterFont_Internal( fontHandle_t handle ) | ||
| void RE_UnregisterFont( fontInfo_t *font ) |
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.
I would kind of suggest having a
| void RE_UnregisterFont( fontInfo_t *font ) | |
| void RE_UnregisterFont( fontInfo_t **font ) |
That then sets *font = nullptr; — I think the current code is correct and unlikely to change, so this extra safety doesn't do much difference. Feel free to ignore.
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.
I'll pass on that - this style of freeing function seems a little wonky since most deallocation functions like free or delete don't do that. And I caused a crashing bug one time by implementing this style of deleting function in the particle code... If we want to make it any safer probably RAII with unique_ptr is the way to go.
Oh yes, so we had at least 3 copies of the same font in memory, and I was wondering why our game was so hungry… |
|
(cf #1844) |
Remove unused font-related definitions. NUKE an unused file format with
.datextension for pre-rasterized fonts. NUKE the font handle table since we only load one font. Move font stuff out ofq_shared.h, the header included by everything engine and gamelogic.