News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Recent posts

#21
Extension Requests / Re: Allow fonts of different w...
Last post by prissi - April 11, 2024, 01:42:10 PM
I think the better way would be to use the bold font of the used TTF font, especially for CJK bold. Simutrans had in ancient times two fonts already. Hence, having a second bold font should be easy, one would just need a second fonts structure and loading it of course.
#22
Extension Requests / Allow fonts of different weigh...
Last post by Ranran(retired) - April 11, 2024, 09:59:09 AM
The new anti-aliased fonts look great.
As I tested it, I started to think there was still room for improvement.
Thin fonts look especially good on dialogs. Thin fonts are especially preferred in Japanese, which has complex shapes derived from China.
On the other hand, such thin fonts have poor visibility on the "main screen"(map view) of the game.

Particularly in the extended case, the station label's floating text defaults to a shadowed style with no background.
In my opinion, the readability is not very good.

I notice that Hajo has been changing their label design last year.
Quote from: _Hajo_ on February 15, 2023, 09:55:15 PM- Both can be drawn in bold style.
Hajo is growing flowers and James is renovating the shed but I would like to incorporate it.
Font innovation is a big effort, but I think the ability to use bold type can be achieved with a little more effort on top of that.
However, implementing this into individual UIs will require another discussion and effort but there is no doubt that this will lead to improvements to the UI in the future.


I took Hajo's code as a reference and tested it with extended.


Hajo used bold only in the title bar of the dialog.
I found the station label difficult to read so I changed it to bold. (This change is not included in the patch)

some notes:
Hajo was changing the file structure (display.h/display.cc), but I didn't do that to avoid confusing the changes. It was predicted that it would be easier to merge into extended.
Certainly simgraph is so bloated that it might make sense to separate it. If separation is required, it can be done later.
Some conflicts have arisen in the process of implementing aliasing fonts in Standard.
https://github.com/Varkalandar/simutrans_ts/commit/1fe397ed7173aacd6376468b2b50ef55e99b69b9
if(c == '\e') {
if(decoder.has_next()) {
utf32 c2 = decoder.next();
color = handle_color_sequences(c2, default_color);
}
continue; // nothing to see
}
This code in hajo's branch was removing the letter "e" from all text in my environment.




I submit a patch that I created for extended and modified for standard. I would appreciate it if you would consider implementing a bold font.
(Not tested with standard. It seems that the required libraries are different from extended in order to build. It was possible to build with git actions.)
This is like the first step; for example, in order to make bold text available in the UI, we need to prepare something like a bold option for gu_label_t.
Hajo also did something to make different font sizes available, but that's not included. (I hope to eventually implement it.)
First of all, we need to check whether bold fonts can be used correctly.

I can't attach the patch file, so I post the github link.
https://github.com/Ranran-the-JuicyPork/simutrans/commit/c8b3d1ac87800e1e5f00a59c5c481e03dcb31acf.patch
#23
Thank you for the correction priss.
I think now we can also test the std-r11091-aliasing-fonts branch.
#24
FYI we have had another help request about this bug on Reddit. I know that Prissi is hard at work on a new release so hopefully it's encouraging to know that there are players eagerly awaiting the bugfixes in it. Thank you also to ceeac for fixing it. :coffee:
#25
Simutrans-Extended major projects / Re: Incorporating changes from...
Last post by prissi - April 09, 2024, 02:19:01 PM
THe following code compiles also as C++20:
    NONCLIENTMETRICSW ncm;
    ncm.cbSize = sizeof(NONCLIENTMETRICSW);
    SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0);
    std::wstring wsFaceName = ncm.lfMessageFont.lfFaceName;

    LPCWSTR fontRegistryPath = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
    HKEY hKey;
    LONG result;
#26
Quote from: prissi on April 09, 2024, 06:54:09 AMSeems like it is compiled with the wide char functions as default. I will add code to standard. Essentially, add a W to NONCLIENMETRICSW and to SystemParameterInfosW and change faceName to a string wsFaceName and remove the next definition.
std::wstring faceName(ncm.lfMessageFont.lfFaceName);
Thank you for looking into that.
After changing the code like this, the compilation was successful.
EDIT: This change seems to cause an error in git action.

Note that if you upgrade MSVC to 2022 and change it to be c++20 compliant, fontRegistryPath will result in an error, so it seems that you need to make it c++17 compliant.
#27
Simutrans-Extended major projects / Re: Incorporating changes from...
Last post by prissi - April 09, 2024, 06:54:09 AM
Seems like it is compiled with the wide char functions as default. I will add code to standard. Essentially, add a W to NONCLIENMETRICSW and to SystemParameterInfosW and change faceName to a string wsFaceName and remove the next definition.
#28
Quote from: Ranran(retired) on April 05, 2024, 02:26:44 PMBut for some reason I was not able to properly incorporate dr_get_system_font() in my environment.

I don't understand why this function doesn't work with the same code as standard.
It turns out that this is due to C++20 being a requirement. I was able to compile correctly with git action.
There is currently a problem with initial font retrieval as this cannot be tested properly.
#29
Quote from: jamespetts on April 07, 2024, 07:46:38 PMFor reference, when I paused the process, I got the following stack trace: void display_fillbox_wh_clip_rgb() < void gui_colored_route_bar_t::draw() < void gui_container_t::draw() (line 262) < void gui_aligned_container_t::draw() (line 587) < void gui_container_t::draw() (line 262) and so on, repeating a number of times moving between lines 587 and 262.
Thank you for the testing.
The bb server saves could not be opened in the debug build, but I think I fixed the cause of the problem based on the information given.
It would be helpful if you could test it again.
#30
Thank you very much for this, and apologies for not having had the chance to look into this sooner. I have found what appears to be an error with this, which is that we appear to get an infinite loop originating in GUI code in this saved game when selecting the line, "!# Strawerdale Crude" belonging to the company "BR Summerisle Region" in the lines dialogue with the "stops" tab open. I had previously clicked on a number of the same company's other lines with the "stops" tab open when this occurred. 

For reference, when I paused the process, I got the following stack trace: void display_fillbox_wh_clip_rgb() < void gui_colored_route_bar_t::draw() < void gui_container_t::draw() (line 262) < void gui_aligned_container_t::draw() (line 587) < void gui_container_t::draw() (line 262) and so on, repeating a number of times moving between lines 587 and 262.

I should be grateful if you could look into this before I merge this. Thank you.