[Patch]: Font settings GUI
Moderator: OpenTTD Developers
[Patch]: Font settings GUI
Hi, this is my first patch, so I'm sure it needs to be improved a lot.
This patch enables to modify the freetype settings inside the game. I've added a button on the Game Options window that opens a new window with the settings. It works in Windows and Linux, but in Windows take a long time making the list of avaiable fonts.
Both attachments have the same code, in the zip file the patch is split in smaller patchs.
Latest version here
This patch enables to modify the freetype settings inside the game. I've added a button on the Game Options window that opens a new window with the settings. It works in Windows and Linux, but in Windows take a long time making the list of avaiable fonts.
Both attachments have the same code, in the zip file the patch is split in smaller patchs.
Latest version here
- Attachments
-
- font_settings_r20920.diff
- Patch for r20920
- (36.5 KiB) Downloaded 287 times
-
- patches.zip
- Patch split in pieces
- (12.22 KiB) Downloaded 237 times
Last edited by thror on 26 Apr 2011 18:02, edited 4 times in total.
Re: [Patch]: Freetype font settings
What if you would use font-caches, like VideoLan.org's VLC does? That would speed up the selection screen to be loaded, especially where you have more, than 1000 fonts installed (which is the case for me with more, than 8000 fonts).
Re: [Patch]: Freetype font settings
Thank you very much for this nice patch!
Do I right understand, that the patch analyses ALL installed fonts in the OS,
Even newinstalled fonts?

Do I right understand, that the patch analyses ALL installed fonts in the OS,
Even newinstalled fonts?
Re: [Patch]: Freetype font settings
I've been thinking a little about it. The problem is that the the patch make a list with the fonts that matchs your languaje settings, if you change it, the cache has to be refresh or use a different cache for any different language. Anyway I'll think more about that.norbert79 wrote:What if you would use font-caches, like VideoLan.org's VLC does?
The patch ask the OS about the fonts so, if the new installed fonts have been installed properly, you should see them in the list.Timmaexx wrote:Do I right understand, that the patch analyses ALL installed fonts in the OS,
Even newinstalled fonts?
Re: [Patch]: Font settings GUI
I've made a new versión which improves the performance of the Windows patch, but the list of fonts could include some fonts that the game can´t load.
The older version shares part of the Windows callback code with the fallback font function. That code checks if a font can be used with the current settings. One of the checks is trying to load the font. The new version doesn't share that code and skip this ckeck, instead of that implements a simple check that in my computer filters the same fonts than the older check.
This version needs more testing so I'll keep the older version on the first post.
The older version shares part of the Windows callback code with the fallback font function. That code checks if a font can be used with the current settings. One of the checks is trying to load the font. The new version doesn't share that code and skip this ckeck, instead of that implements a simple check that in my computer filters the same fonts than the older check.
This version needs more testing so I'll keep the older version on the first post.
- Attachments
-
- font_settings_gui_v2_r21005.diff
- New version of the patch
- (35.18 KiB) Downloaded 207 times
-
- patches.zip
- The new patch split in pieces.
- (11.45 KiB) Downloaded 161 times
Re: [Patch]: Font settings GUI
New version:
- Fixed patchs to work with the latest code.
- Patch 30 is no longer needed due to changes in r21161.
- Bug Fixed: Strings width calc didn't work properly after changes until restart openttd.
Known issues:
- The list of fonts doesn't update if languaje changes after open the font settings window
Theese changes have been done over the testing version because It seems to work fine.
Anyway, I've been wondering about if fill the list of fonts on a separate thread when the aplication starts could be a better solution. What do you think?
- Fixed patchs to work with the latest code.
- Patch 30 is no longer needed due to changes in r21161.
- Bug Fixed: Strings width calc didn't work properly after changes until restart openttd.
Known issues:
- The list of fonts doesn't update if languaje changes after open the font settings window
Theese changes have been done over the testing version because It seems to work fine.
Anyway, I've been wondering about if fill the list of fonts on a separate thread when the aplication starts could be a better solution. What do you think?
- Attachments
-
- font_settings_gui_r21201.diff
- (34.62 KiB) Downloaded 198 times
-
- patches.zip
- (10.76 KiB) Downloaded 175 times
Last edited by thror on 18 Nov 2010 11:13, edited 1 time in total.
Re: [Patch]: Font settings GUI
It seems that the list of available fonts is not updated if the language changes. As a result, it is possible to select fonts that are not suitable for the current language if the font window is already opened before changing language. You can reproduce this by changing from English to Chinese (Simplified) for example.
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Re: [Patch]: Font settings GUI
I've checked it and I'm trying to fix it, but the fix adds some new problems that I'd like to solve before upload a new version.Terkhen wrote:It seems that the list of available fonts is not updated if the language changes. As a result, it is possible to select fonts that are not suitable for the current language if the font window is already opened before changing language. You can reproduce this by changing from English to Chinese (Simplified) for example.
Re: [Patch]: Font settings GUI
It has been a long time since my last post, but I haven't forgotten the patch.
New version:
- Bug fixed: The list of fonts doesn't update if languaje changes after opening the font settings window
- The list of fonts is filled on a separate thread when the window opens, for the first time or after change the language
- Close the fonts settings window if the settings window is closed.
- The code has been cleaned up.
New version:
- Bug fixed: The list of fonts doesn't update if languaje changes after opening the font settings window
- The list of fonts is filled on a separate thread when the window opens, for the first time or after change the language
- Close the fonts settings window if the settings window is closed.
- The code has been cleaned up.
- Attachments
-
- patches.zip
- The patch split in pieces.
- (10.75 KiB) Downloaded 341 times
-
- font_settings_r22376.diff
- New version of the patch
- (33.53 KiB) Downloaded 353 times
Re: [Patch]: Font settings GUI
20: _list_of_fonts is missing doxygen documentation, and the documentation of _list_of_font_status is a bit incomplete. It should also be called "_list_of_fonts_status"
On 30: Why are the functions EnumFontCallback and ListFontCallback so similar? Could it be possible to merge them into a single function?
On 30: What is the point of the stop_calc code?
Also, there are many occurences of this coding style error:
stop_calc=true --> stop_calc = true
On 30: Why are the functions EnumFontCallback and ListFontCallback so similar? Could it be possible to merge them into a single function?
On 30: What is the point of the stop_calc code?
Also, there are many occurences of this coding style error:
stop_calc=true --> stop_calc = true
Spanish translation of OpenTTD
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Extended heightmaps
Have fun, don't quarrel too much and add as many advanced settings as you can.
Re: [Patch]: Font settings GUI
I know that documentation is incomplete but I'd like to get some feedback about the patch performance before.Terkhen wrote:20: _list_of_fonts is missing doxygen documentation, and the documentation of _list_of_font_status is a bit incomplete.
IIRC on the first version of the patch the part in common of that functions was split to a new function that both of them called, but the performance of the patch was a little bit better with the actual implementation. Probably with this multi-thread version would make more sense come back to that solution.Terkhen wrote:On 30: Why are the functions EnumFontCallback and ListFontCallback so similar? Could it be possible to merge them into a single function?
I forgot add documentation about that partTerkhen wrote:On 30: What is the point of the stop_calc code?

I'll try to fix all of them.Terkhen wrote:Also, there are many occurences of this coding style error:
stop_calc=true --> stop_calc = true
Who is online
Users browsing this forum: No registered users and 9 guests