Open Ranran-the-JuicyPork opened 5 months ago
This patch focuses on font renovation.
Check ex15-2406-refine-font for the corresponding ex-15 branch.
Thank you for this. Unfortunately, I am getting a compile error with this in Visual Studio: I get FT_Bitmap_Init showing as undefined in line 299 of font.cc.
I think the link to include freetype is missing (probably only links to an older version that exists) since FT_Bitmap_Init clearly exist here. https://github.com/Ranran-the-JuicyPork/simutrans-ex-fix/blob/d9e77d47abb6ddb1822a45b223f759cb77c47098/utils/openttd/ftbitmap.h#L70
Please check if the additional link corrections are correct
Thank you very much for your work on this. Just a note to say that I am exceptionally busy in work this week, but should be able to look at incorporating this next week.
Thank you again.
Thank you for this. Apologies for not having had a chance to test this until now. Unfortunately, I am currently getting a compile error with this:
font.cc(301,2): error C3861: 'FT_Bitmap_Init': identifier not found
Since there are no such errors on my PC and git action, I think this problem is caused by an incomplete build environment on your computer. In other words, your computer has an old freetype library and is still including it.
The freetype libraries are in the repository, so if they are correct it's probably best to use them. To avoid overrides by old libraries I removed the include folder links which I believe were personal preferences.
It would be ideal if new developers could quickly set up a build environment using MSVC, with the best possible environment built using only what is in the repository.
If you try this and still cannot build, please obtain the appropriate libraries, update the files, or change the include folder.
A search for freetype.h on your computer may reveal where the old freetype files (missing the correct ftbitmap.h) is located.
Thank you for that - incorporating your changes to the Visual Studio project fixed the compile issue that I was having and I have now been able to get this working.
Overall, this is very good and definitely a substantial improvement over the current arrangement. Two things will need consideration before we incorporate this, however: defaults and the cent symbol.
The current default for my computer is Segoe UI regular 11 point. On my 4k and 1440p monitors, this is too small to be easily readable. What I am currently not clear on is how these defaults are chosen - Segoe UI is a Microsoft font, so presumably a different font would be chosen in Linux. Is the choice based on the system default? I suspect that a bold font may be better, especially for showing town and stop names. Some fonts, however, appear larger in any given point size than others. For example, Verdana bold works well in 11pt on my Windows system. Liberation Sans is a good font for Linux systems (I also have it installed in Windows, but this is not a default for Windows), but this needs to be in 12pt to be readable. Again, for town and stop names, bold makes it more readable, but regular is readable for ordinary dialogues.
Do you have any idea how defaults can be set sensibly to work with different systems (and how defaults can actually be set)?
The second thing is the cent symbol. Simutrans has always used the ¢ symbol for its currency, but in all of the TrueType fonts, this shows as the $ symbol, even in fonts (e.g. Liberation Sans) which I have confirmed have the ¢ symbol. Only the traditional Prop Latin (etc.) fonts work with the correct ¢ symbol. Do you have any idea what might be causing this issue and how to go about rectifying it?
Thank you for your work on this - it is much appreciated.
Thank you for testing.
The current default for my computer is Segoe UI regular 11 point. On my 4k and 1440p monitors, this is too small to be easily readable. What I am currently not clear on is how these defaults are chosen All current designs are based on the current standard 124 implementation.
The default font size depends on the setting of theme. For example, a large theme might specify font_size = 16. However, this no longer appears to work in the standard. (If changing themes automatically changes the font without the player's intention, it would be annoying.)
The menu bar and some icons change size depending on the theme. On the other hand, due to historical conflicts, icons that depend on the pakset cannot be resized, resulting in size mismatches.
Segoe UI is a Microsoft font, so presumably a different font would be chosen in Linux. Is the choice based on the system default?
The first font selected is the system font of the OS. The best font varies depending on the language.
Liberation Sans is a good font for Linux systems (I also have it installed in Windows, but this is not a default for Windows), but this needs to be in 12pt to be readable.
The default font size of 11 was the standard choice, but I found it too small so I increased it to 12.
I suspect that a bold font may be better, especially for showing town and stop names. Do you have any idea how defaults can be set sensibly to work with different systems (and how defaults can actually be set)?
I have submitted the same request to standard in the past. https://forum.simutrans.com/index.php/topic,22925.0.html However, as of now there has been no reply or progress from prissi on this matter.
Hajo's repository allows two font weights to be displayed simultaneously. That is, the font drawing functions have a bold option, allowing us to choose a font weight when placing text. And it appears there are plans to make it possible to display different font sizes simultaneously in the future. But he has left simutrans behind, and Dwach has patched out just the code that makes the font look better.
So while standard doesn't yet have the ability to render two font weights, we could consider implementing that first.
I've already tested the bold patch using the code from Hajo's repository and posted it in the thread above. The testing was done in extended mode, so it's possible to implement it early. However, additional work is required to apply it individually to many UIs. I've tested it on dialog title bars and station labels, so I think it will be quick to make them bold.
Simutrans has always used the ¢ symbol for its currency, but in all of the TrueType fonts, this shows as the $ symbol, even in fonts (e.g. Liberation Sans) which I have confirmed have the ¢ symbol. Only the traditional Prop Latin (etc.) fonts work with the correct ¢ symbol. Do you have any idea what might be causing this issue and how to go about rectifying it? ¢ is an environment-dependent character, and the old bitmap fonts always displayed it correctly because the bitmap files contained that character. It is important to note that the ancient simutrans font system did not display ¢ as ¢, but rather displayed $ as ¢. In other words, the bitmap image of $ became ¢. Therefore, even in the current master branch, if you change the font to something other than m+10r.bdf, $ will be displayed instead of ¢.
The only way to properly solve this issue would be to separate out the currency unit, make the currency symbol selectable in the pakset and translations, and make the code compatible everywhere in the UI, but that would definitely require a lot of work.
Thank you for replying. As to currency symbols, I had thought that these were already customised for translations? I am not clear on how it is possible for just changing the font to substitute the ¢ symbol for the $ symbol. Is there not a Unicode standard for both symbols? How is the currency symbol currently handled, do you know?
Thank you for the reference to the forum thread - that is useful. It would definitely be helpful to allow specifying bold text in certain places, especially for station and town names - it is likely to be difficult to read these in Extended otherwise.
Thank you again for your work on this.
https://github.com/Ranran-the-JuicyPork/simutrans-ex-fix/tree/2406-bold-font You can test the station name and title bar in the main view in bold in the above branch.
As to currency symbols, I had thought that these were already customised for translations? I am not clear on how it is possible for just changing the font to substitute the ¢ symbol for the $ symbol. Is there not a Unicode standard for both symbols? How is the currency symbol currently handled, do you know?
As far as we can see, function *void money_to_string(char p, double f, const bool show_decimal)** is commonly used to display monetary amounts, and all it does is add a "$" to the end of value to complete the string.
EDIT: I'm reposting my comment, because in my three previous comments there was an error in the description of the quote, which may have made it easier to miss the content.
The first font selected is the system font of the OS. The best font varies depending on the language.
The default font size of 11 was the standard choice, but I found it too small so I increased it to 12.
Font Renovation