This repository was archived by the owner on May 14, 2025. It is now read-only.
[PS-191] Improve support for larger fonts Android#2053
Merged
Conversation
fedemkr
suggested changes
Aug 29, 2022
fedemkr
suggested changes
Aug 29, 2022
Comment on lines
+408
to
+413
| private void DisableAndroidFontScale() | ||
| { | ||
| //As we are using NamedSizes the xamarin will change the font size. So we are disabling the Android scaling. | ||
| Resources.Configuration.FontScale = 1f; | ||
| BaseContext.Resources.DisplayMetrics.ScaledDensity = Resources.Configuration.FontScale * (float)DeviceDisplay.MainDisplayInfo.Density; | ||
| } |
Member
There was a problem hiding this comment.
Not 100% sure if this is safe enough that doesn't throw exception at some case or device specifics. Just in case, could you wrap this in a try...catch that logs the exception to AppCenter? So that if something happens the app doesn't crash and the users can use the app nonetheless given that you're calling it from OnCreate
fedemkr
approved these changes
Aug 30, 2022
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Objective
The fonts on Android are too big on some devices. Removed Android native scaling as xamarin
NamedSizeis already scaling the fonts.Code changes
NamedSizeis already scaling the textScreenshots
Max font size with Android scaling:

Max font size without Android scaling:

Before you submit
dotnet tool run dotnet-format --check) (required)