Skip to content
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

Std r11091 aliasing fonts #664

Open
wants to merge 57 commits into
base: master
Choose a base branch
from

Conversation

Ranran-the-JuicyPork
Copy link

Font Renovation

prissi and others added 30 commits April 3, 2024 21:34
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11091
8aca7d54-2c30-db11-9de9-000461428c89

# Conflicts:
#	Simutrans.sln
#	src/simutrans/sys/simsys.cc

NOTE:
Changes to symsys have been skipped.
Need to check this out.
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11093
8aca7d54-2c30-db11-9de9-000461428c89

# Conflicts:
#	src/simutrans/display/simgraph16.cc

Changes to simgraph16 related to dr_get_system_font() have been skipped.
Need to recheck it.
…g font

git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11094
8aca7d54-2c30-db11-9de9-000461428c89
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11095
8aca7d54-2c30-db11-9de9-000461428c89

# Conflicts:
#	simutrans/text/be.tab
#	simutrans/text/bg.tab
#	simutrans/text/ca.tab
#	simutrans/text/cn.tab
#	simutrans/text/cz.tab
#	simutrans/text/de.tab
#	simutrans/text/dk.tab
#	simutrans/text/en.tab
#	simutrans/text/en/depot.txt
#	simutrans/text/eo.tab
#	simutrans/text/es.tab
#	simutrans/text/et.tab
#	simutrans/text/fi.tab
#	simutrans/text/fp.tab
#	simutrans/text/fr.tab
#	simutrans/text/gr.tab
#	simutrans/text/hr.tab
#	simutrans/text/hu.tab
#	simutrans/text/id.tab
#	simutrans/text/it.tab
#	simutrans/text/ja.tab
#	simutrans/text/ko.tab
#	simutrans/text/lt.tab
#	simutrans/text/nl.tab
#	simutrans/text/no.tab
#	simutrans/text/pl.tab
#	simutrans/text/pt.tab
#	simutrans/text/ro.tab
#	simutrans/text/ru.tab
#	simutrans/text/sk.tab
#	simutrans/text/sv.tab
#	simutrans/text/th.tab
#	simutrans/text/uk.tab
#	simutrans/text/zh.tab
#	tools/get_revision.ps1
Headless server does not need a font as it's never shown anyway.

git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11127
8aca7d54-2c30-db11-9de9-000461428c89
…d-r11091-aliasing-fonts

# Conflicts:
#	documentation/cherry-picked-commits.txt
#	gui/banner.h
…nt()

git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@10908
8aca7d54-2c30-db11-9de9-000461428c89

# Conflicts:
#	src/simutrans/dataobj/environment.cc
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@10910
8aca7d54-2c30-db11-9de9-000461428c89
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@10925
8aca7d54-2c30-db11-9de9-000461428c89
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@10926
8aca7d54-2c30-db11-9de9-000461428c89
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11049
8aca7d54-2c30-db11-9de9-000461428c89
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11081
8aca7d54-2c30-db11-9de9-000461428c89

# Conflicts:
#	simutrans/history.txt
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11111
8aca7d54-2c30-db11-9de9-000461428c89
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11112
8aca7d54-2c30-db11-9de9-000461428c89
…ask for wide font names

git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11129
8aca7d54-2c30-db11-9de9-000461428c89

# Conflicts:
#	src/simutrans/sys/simsys.cc
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11130
8aca7d54-2c30-db11-9de9-000461428c89
…d-r11091-aliasing-fonts

# Conflicts:
#	display/font.cc
@Ranran-the-JuicyPork
Copy link
Author

This patch focuses on font renovation.

Check ex15-2406-refine-font for the corresponding ex-15 branch.

prissi and others added 2 commits June 4, 2024 06:56
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11268
8aca7d54-2c30-db11-9de9-000461428c89
@jamespetts
Copy link
Owner

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.

@Ranran-the-JuicyPork
Copy link
Author

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

prissi and others added 7 commits June 8, 2024 12:22
…ctory is now real tooltip

git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@10081
8aca7d54-2c30-db11-9de9-000461428c89

# Conflicts:
#	boden/grund.cc
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@10106
8aca7d54-2c30-db11-9de9-000461428c89

# Conflicts:
#	display/simgraph0.cc
#	display/simgraph16.cc
#	gui/components/gui_chart.cc
#	gui/minimap.cc
#	gui/simwin.cc
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@10534
8aca7d54-2c30-db11-9de9-000461428c89
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11001
8aca7d54-2c30-db11-9de9-000461428c89
@jamespetts
Copy link
Owner

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.

@jamespetts
Copy link
Owner

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

@Ranran-the-JuicyPork
Copy link
Author

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.

@jamespetts
Copy link
Owner

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.

prissi and others added 3 commits June 23, 2024 20:06
…nt()

git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@10908
8aca7d54-2c30-db11-9de9-000461428c89

# Conflicts:
#	src/simutrans/dataobj/environment.cc

retake for missing changes
@Ranran-the-JuicyPork
Copy link
Author

Ranran-the-JuicyPork commented Jun 23, 2024

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.

@jamespetts
Copy link
Owner

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.

@Ranran-the-JuicyPork
Copy link
Author

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.

@Ranran-the-JuicyPork
Copy link
Author

Ranran-the-JuicyPork commented Jun 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants