The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: ceeac on April 01, 2020, 01:53:21 PM

Title: Font code refactor
Post by: ceeac on April 01, 2020, 01:53:21 PM
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.
Title: Re: Font code refactor
Post by: Dwachs on April 01, 2020, 02:02:35 PM
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.
Title: Re: Font code refactor
Post by: prissi on April 01, 2020, 11:40:22 PM
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.)
Title: Re: Font code refactor
Post by: ceeac on April 05, 2020, 01:48:18 PM
What was the reason to work on this?
Preparation for GPU assisted rendering.

I 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.

Also no hex fonts used anymore, so one can safely remove this code.
Done.
Title: Re: Font code refactor
Post by: ceeac on April 18, 2020, 10:44:31 AM
Patch updated. Notable changes:
As far as I am concerned, this is finished now. (I think)

It 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.
Title: Re: Font code refactor
Post by: prissi on April 23, 2020, 03:15:37 PM
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.