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

Feature #6918: Add option to adjust font size separately from GUI size. #7003

Merged
merged 2 commits into from Feb 23, 2019

Conversation

@gregcarlin
Copy link
Contributor

gregcarlin commented Dec 31, 2018

Adds an option in the "Game Options" next to "Interface Size" called "Font Size". Available options are normal, double, and quad. Tested with both freetype and sprite fonts. The only known hiccup is that I couldn't get sprite fonts to work properly past a complete "quad zoom". Eg. if the interface and font sizes are both set to double, the effective font size will be quad. Increasing either option further will not increase the font size. This works fine for freetype fonts though.

Thanks for taking a look! Super excited to be helping out, I love playing the game!

Fixes #6918

Copy link
Member

LordAro left a comment

Looks broadly fine in principle...

src/lang/english.txt Show resolved Hide resolved
src/script/api/game/game_window.hpp.sq Outdated Show resolved Hide resolved
@gregcarlin gregcarlin force-pushed the gregcarlin:adjust-font-size branch 2 times, most recently from a13bb51 to 0243291 Jan 7, 2019
@planetmaker

This comment has been minimized.

Copy link
Contributor

planetmaker commented Jan 12, 2019

Is it really intended, that the font size selection is relative to the interface size?

With the current PR, if I select 'double size interface size' and 'double size font size', I end up with 4x font size compared to both settings set to 'normal'.

As sprite fonts are the defaults, it should work for those as with non-sprite fonts, too.

@gregcarlin

This comment has been minimized.

Copy link
Contributor Author

gregcarlin commented Jan 13, 2019

Without this PR, changing the interface size will also change the font size if the sprite font is used, but it will not affect the font size if a FreeType font is used. Are you proposing to change this behavior so that the interface size never affects the font size?

@PeterN

This comment has been minimized.

Copy link
Member

PeterN commented Jan 13, 2019

@gregcarlin I would say exactly that behaviour should happen, as you have added the ability to (almost) independently set the font size.

This may need existing text strings to be altered to indicate that the existing selection is for graphical/icon elements and no longer affects text?

@gregcarlin

This comment has been minimized.

Copy link
Contributor Author

gregcarlin commented Jan 14, 2019

Sounds good, I'll get on it!

@gregcarlin gregcarlin force-pushed the gregcarlin:adjust-font-size branch from 0243291 to 774180f Jan 14, 2019
@gregcarlin

This comment has been minimized.

Copy link
Contributor Author

gregcarlin commented Jan 14, 2019

I updated the behavior! I didn't change the strings because I wasn't sure what would be more clear and I think the current strings are fairly easy to understand. However, if someone has a specific recommendation I'd be more than happy to make the change.

src/zoom_type.h Outdated Show resolved Hide resolved
src/settings_gui.cpp Outdated Show resolved Hide resolved
src/fontcache.cpp Outdated Show resolved Hide resolved
@gregcarlin gregcarlin force-pushed the gregcarlin:adjust-font-size branch from 774180f to 3a46738 Jan 18, 2019
@LordAro LordAro dismissed their stale review Jan 27, 2019

uiyhkj

src/zoom_type.h Outdated Show resolved Hide resolved
@LordAro

This comment has been minimized.

Copy link
Member

LordAro commented Jan 27, 2019

I spotted this at high font size levels. I suspect it's not directly related to your change, but it is revealed by it

@PeterN

This comment has been minimized.

Copy link
Member

PeterN commented Jan 27, 2019

@LordAro there is code that changes the width, it probably also needs to be changed to be based on (and happen on) font zoom instead of gui zoom. May well be other instances.

@gregcarlin

This comment has been minimized.

Copy link
Contributor Author

gregcarlin commented Feb 4, 2019

@LordAro and @PeterN the issue seems to only appear if the font zoom is adjusted mid-game. If it's adjusted before a game is loaded the town names appear fine. This leads me to believe the issue is with timing (i.e. the width needs to be recalculated when the font zoom changes). I'll investigate further.

@gregcarlin gregcarlin force-pushed the gregcarlin:adjust-font-size branch 2 times, most recently from 524f08c to 2ed0c58 Feb 4, 2019
@gregcarlin

This comment has been minimized.

Copy link
Contributor Author

gregcarlin commented Feb 4, 2019

Got it! Just needed to add a call to UpdateAllVirtCoords.

@LordAro LordAro requested a review from PeterN Feb 4, 2019
@gregcarlin gregcarlin force-pushed the gregcarlin:adjust-font-size branch from 2ed0c58 to 8f6fede Feb 20, 2019
@PeterN
PeterN approved these changes Feb 23, 2019
@PeterN PeterN merged commit 00d28a5 into OpenTTD:master Feb 23, 2019
8 checks passed
8 checks passed
OpenTTD CI Build #20190220.13 succeeded
Details
OpenTTD CI (Linux commit-checker) Linux commit-checker succeeded
Details
OpenTTD CI (Linux linux-amd64-clang-3.8) Linux linux-amd64-clang-3.8 succeeded
Details
OpenTTD CI (Linux linux-amd64-gcc-6) Linux linux-amd64-gcc-6 succeeded
Details
OpenTTD CI (Linux linux-i386-gcc-6) Linux linux-i386-gcc-6 succeeded
Details
OpenTTD CI (MacOS) MacOS succeeded
Details
OpenTTD CI (Windows Win32) Windows Win32 succeeded
Details
OpenTTD CI (Windows Win64) Windows Win64 succeeded
Details
@gregcarlin

This comment has been minimized.

Copy link
Contributor Author

gregcarlin commented Feb 23, 2019

Yay! Thanks!

PeterN added a commit to PeterN/OpenTTD that referenced this pull request Feb 23, 2019
PeterN added a commit that referenced this pull request Feb 23, 2019
…s. (#7267)
nielsmh added a commit to nielsmh/OpenTTD that referenced this pull request Mar 11, 2019
…enTTD#7003)

Adds an option in the "Game Options" next to "Interface Size" called "Font Size". Available options are normal, double, and quad.
nielsmh added a commit to nielsmh/OpenTTD that referenced this pull request Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.