This patch refactors font loading and rendering. I also updated variable names to follow the freetype naming conventions from this (https://www.freetype.org/freetype2/docs/glyphs/glyphs-3.html) page where possible.
Thanks! What was the reason to work on this?
It would be nice if the font-code would enable larger than 16 x 23 pixels per letter.
The font system is more broken: There are all the "large_font" remainder, even though there is no small font used anymore. I would also define functions like "get_glyph_height" etc. inline in the "*.h" file, since those are used a lot in the UI code. Especially if they only return a const. Otherwise many compiler will no inline them.
Also no hex fonts used anymore, so one can safely remove this code. (Also the latin2 languages schould probably switch to a bdf font a some point.)
Quote from: Dwachs on April 01, 2020, 02:02:35 PMWhat was the reason to work on this?
Preparation for GPU assisted rendering.
Quote from: prissi on April 01, 2020, 11:40:22 PMI would also define functions like "get_glyph_height" etc. inline
Done. I have not inlined get_glyph_data etc. because I have not noticed a performance difference and doing it this way is much more readable.
Quote from: prissi on April 01, 2020, 11:40:22 PMAlso no hex fonts used anymore, so one can safely remove this code.
Done.
Patch updated. Notable changes:
- Fixed crashes when reading corrupted bdf files
- Fixed debug printing of characters more than 8 pixels wide
- Fixed compile error when COLOUR_DEPTH==0
- Removed get_glyph_height
- Renamed large_font -> default_font in simgraph16.cc
- Renamed GLYPH_HEIGHT -> GLYPH_BITMAP_HEIGHT
- Renamed font_t::get_glyph_data -> font_t::get_glyph_bitmap
As far as I am concerned, this is finished now. (I think)
Quote from: Dwachs on April 01, 2020, 02:02:35 PMIt would be nice if the font-code would enable larger than 16 x 23 pixels per letter.
I can do this in a follow-up patch, I believe this patch is big enough as-is.
std::min and std::max does not work on my system, so I replace them with min and max. Otherwise committed in r9042, Thank you.