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

Change default map font for Map and Overmap #29036

Closed
wants to merge 2 commits into from
Closed

Change default map font for Map and Overmap #29036

wants to merge 2 commits into from

Conversation

KurzedMetal
Copy link
Contributor

@KurzedMetal KurzedMetal commented Mar 27, 2019

Summary

SUMMARY: Interface "Change default font height/width for Map and Overmap to make square tiles"

Purpose of change

I propose changing the Map and Overmap to an square font. This kind of font is arguably better for showing square shaped multi-tile objects (like vehicles and buildings) and feel more natural, also diagonal distance is kept proportional to cardinal distances.

Describe the solution

I had a good experience using the "White Rabbit" font (which is MIT licensed) in my 1920x1080 22" monitor, I set the height, width and size to 20px, which is a bit higher than the current 8px by 16px font, but with this dimensions it seems to avoid rendering artifacts (using 24px gets even better but may be too big for a default)

Since CDDA have support for internationalization and needs a default font that supports unicode glyphs for multiple languages (including CJK), it's very hard to find a new font suitable for the overmap, but we still can change the fontheight and fontwidth to generate square tiles for the map/overmap.

Describe alternatives you've considered

I tried looking for other "free" (as in freedom) square fonts with glyphs that look good for a map mode but didn't have much success. This one feels quite good, I specially liked the glyphs for symbols and the only criticism I have for it is that some capital letters may look similar (like A and R or O and D), but that's it.

Google Nato is the only other "libre" font I found that support for multiple languages and could be used instead of "unifont", but it is distributed in multiple .ttf files, or in the case of CJK languages, even .otf /.otc files which aren't currently supported by CDDA.

If anyone think there are a better for to use as default, please recommend it here.

Additional context

The default font used for text and other UI elements seems good enough to me, so I didn't change that.

Screenshots

Overmap Current default:

20190327_144957_cataclysm-tiles

Overmap New default:

20190327_145031_cataclysm-tiles

"Map" Current default:
20190327_144952_cataclysm-tiles

"Map" New default:

20190327_145026_cataclysm-tiles

@DracoGriffin DracoGriffin added <Suggestion / Discussion> Talk it out before implementing Info / User Interface Game - player communication, menus, etc. Map / Mapgen Overmap, Mapgen, Map extras, Map display labels Mar 27, 2019
@Hirmuolio
Copy link
Contributor

Hirmuolio commented Mar 27, 2019

I agree that square map tiles is much better. But using 20x20 font makes the map show way too small area.

I think 15px is much better. Finding a font that works at that size would be the better solution instead of increasing font size.

Also the font itself doesn't actually need to be square. Non square fonts will just have some empty space in between symbols.

with
"overmap_fontwidth": 15,
"overmap_fontheight": 15,
"overmap_fontsize": 15,

Unifont (current used font). Some of the letters get slightly cut when it is forced to be of this size. This is what I have been using.
vanilla

wabbit
square

@KurzedMetal
Copy link
Contributor Author

KurzedMetal commented Mar 27, 2019

I think the main problem is that font don't get rendered correctly due to scaling, because some players will prefer 16px, other 20px, and other 24px.

Also, the font is not the problem, these rendering artifacts happens with pretty much any font I tried and only on CDDA, it's really weird. I'd dig on that myself but I don't have much experience with C++.

As for default the size / font preference, I don't mind, as I do think that any size of any square font will be better than the current setting.

EDIT: BTW, I do see in your second image, due to artifacts/scaling, the "c" looks pretty much like an "o".

@KurzedMetal
Copy link
Contributor Author

KurzedMetal commented Mar 27, 2019

I was read the code that loads the font and use it (stdtiles.cpp) and found out that setting "fontblending" enables font antialiasing (calls to TTF_RenderUTF8_Blended() instead of TTF_RenderUTF8_Solid()).

I remember at one point that I didn't like "fontblending" because it actually blurs all the font a bit, but when I restest it again I noticed that it actually fixes artifacts, like the "c" that seems like an "o" at 15px that I mentioned in my previous comment.

Since the rendering of the TTF fonts seem to be cached, wouldn't be a good idea activate that by default too? or was that causing any issues for some players?

EDIT: also, maybe more improvements can be made by setting a "Font Hint" when loading the font? But I haven't found much documentation about it and I don't have a dev environment to build CDDA to test changes myself.

Look at the "c", "m" and "~" on these screenshots, font blending performs better in those cases:
without fontblending, wrabbit, 15px:
20190327_004801_cataclysm-tiles

with fontblending, wrabbit, 15px:
20190327_004739_cataclysm-tiles

@Fracture64
Copy link

Definitely should be a thing, at least in tiles version of game.

@nexusmrsep
Copy link
Contributor

Long awaited change. Thanks

@AMurkin
Copy link
Contributor

AMurkin commented Mar 27, 2019

This font supports English only. For example, notes on a map in Russian look like empty boxes.
Related #19965.

@ZhilkinSerg ZhilkinSerg self-assigned this Mar 27, 2019
@Zireael07
Copy link
Contributor

I believe Unifont is the current font for exactly that reason - it supports pretty much all glyphs that could be needed.

Copy link
Contributor

@ZhilkinSerg ZhilkinSerg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a font with most of Unicode symbols, so it would support non-English languages.

@ZhilkinSerg
Copy link
Contributor

Maybe we need to implement an in-game option for font typeface and size change in game?

@KurzedMetal
Copy link
Contributor Author

KurzedMetal commented Mar 27, 2019

I changed only the Map / Overmap font, not the UI font, I just switched to a non-english language and the map and overmap still use english characters. Are you sure guys that any non-english char is used on those?

Like: see the UI on the right side
image

@ZhilkinSerg
Copy link
Contributor

ZhilkinSerg commented Mar 27, 2019

I changed only the Map / Overmap font, not the UI font, I just switched to a non-english language and the map and overmap still use english characters. Are you sure guys that any non-english char is used on those?

If you switch to non-English language and generate new world/overmaps, city names would use names from that language, thus these names won't be rendered properly in this new font.

Here:

image

@ZhilkinSerg ZhilkinSerg removed their assignment Mar 27, 2019
@KurzedMetal
Copy link
Contributor Author

KurzedMetal commented Mar 27, 2019

I've been doing some search to see if I could find another "libre" font that we could use and supported a large range of Unicode characters and the only one I found was Google Noto.

But it has a few problems:

  1. it only distributes separated fonts for latin+polish+etc on most fonts, but the Chinese, Japanese and Korean (CJK) are separated in other files, actually they have 1 font file for each of those (one for Traditional Chinese, other for Simplified, another for Japanese and another for Korean).
  2. Doesn't seem to distribute .TTF for the CJK fonts, only .TTC / .OTF / .OTC, which isn't supported by CDDA.
  3. Font Size (as in MiB) seems absurd, I guess these fonts have way more glyphs than "unifont" for each of those languages.

So, I guess the only option left is to go back to "unifont" until some heavy code improvements are implemented (OTF support? fallback to rendering town names with a specific font but use other fonts for other tiles in overmap?), but I'll still recommend to set the fontwidth/fontheight for map and overmap to an square size, even with unifont.

EDIT: Also, I noticed unifont has released changes since it was initially added to CDDA, the repo has version 9.0.06 and they are currently distributing 12.0.0.1. So I added a commit to update it.

@AMurkin
Copy link
Contributor

AMurkin commented Mar 27, 2019

Can you update "Overmap New default" image in the OP?

@KurzedMetal
Copy link
Contributor Author

@AMurkin: Done

@Beanzy
Copy link

Beanzy commented Mar 29, 2019

@Firestorm01X2 You have anything to add here? I think the square font you've posted in the forums before looks really good.

SQFnt1
SQFnt2

@Firestorm01X2
Copy link
Contributor

Firestorm01X2 commented Mar 29, 2019

@Beanzy

You have anything to add here? I think the square font you've posted in the forums before looks really good.

No. There is latest version.

Watch out- something may be done not as it should be- I don't have a lot of expirience in creating fonts.
FontFactory reporeted some that font have issues.
And for example Russian letters looks worse than English.

But it works.

@ZhilkinSerg
Copy link
Contributor

but I'll still recommend to set the fontwidth/fontheight for map and overmap to an square size, even with unifont.

I am working on one thing which looks muchbetter in non-square unifont because tiles are seamless:

square

image

non-square

image

@ZhilkinSerg ZhilkinSerg self-assigned this Mar 31, 2019
@KurzedMetal
Copy link
Contributor Author

KurzedMetal commented Mar 31, 2019

But I was recommending that with no font or code change.

If you are doing any of that, of course my recommendation wouldn't apply anymore.

TBH I don't even know what you changed, if code or font or what, but I definitely like what I see in the second screenshot!!

@ZhilkinSerg ZhilkinSerg removed their assignment Apr 4, 2019
@KurzedMetal KurzedMetal closed this Apr 6, 2019
@KurzedMetal KurzedMetal deleted the new_default_map_font branch April 6, 2019 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Info / User Interface Game - player communication, menus, etc. Map / Mapgen Overmap, Mapgen, Map extras, Map display <Suggestion / Discussion> Talk it out before implementing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants