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

[Android] Ensure custom fonts also get weight/slant #1011

Merged
merged 7 commits into from
May 13, 2021
Merged

Conversation

mattleibow
Copy link
Member

@mattleibow mattleibow commented May 11, 2021

Description of Change

Seems that custom fonts never got the weight and slant applied as well as for the "system" fonts, bold was not applied.

However, all is not perfect because of #1018

Before After
before after

@mattleibow mattleibow requested a review from Clancey May 11, 2021 21:38
@@ -79,27 +81,29 @@ public FontManager(IFontRegistrar fontRegistrar, ILogger<FontManager>? logger =
foreach (var folder in folders)
{
formated = $"{folder}{fontFile.FileNameWithExtension()}#{fontFile.PostScriptName}";
var result = LoadTypefaceFromAsset(formated);
var result = LoadTypefaceFromAsset(formated, false);
Copy link
Member Author

Choose a reason for hiding this comment

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

Warnings at each step of the search are not needed.

@rmarinho
Copy link
Member

this fixed the android tests ,but now we have 3 tests failing on iOS

@mattleibow
Copy link
Member Author

Yeah. I found out why... On all platforms in the universe, they can make a "regular" font bold, but iOS just can't. Just updating some tests and will push.

Comment on lines -12 to +13
//TODO: Investigate making this Async
(bool hasFont, string? fontPath) HasFont(string font);
// TODO: this should be async as it involves copying files
string? GetFont(string font);
Copy link
Member Author

Choose a reason for hiding this comment

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

There is NO reason to have these two in a tuple - we literally always have false,null and true,notnull. I even had an extension method that converted from a tuple into a single value... I am not sure my original thought process - might have been for 100% backwards compat. But that is not worth it.

Comment on lines -121 to -126
bool CanUsePackagedNativeFonts =>
#if WINDOWS
true;
#else
false;
#endif
Copy link
Member Author

Choose a reason for hiding this comment

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

This is genuinely cause for concern for all the other devs out there. Which dummy wrote this instead of using the partial classes to actually do different logic. Me. 😭

@rmarinho rmarinho merged commit 7d8c24e into main May 13, 2021
@rmarinho rmarinho deleted the dev/fix-fonts branch May 13, 2021 07:52
@samhouts samhouts added legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-controls-button Button, ImageButton platform/android 🤖 platform/iOS 🍎 platform/windows 🪟 labels Jul 11, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
@samhouts samhouts added the fixed-in-6.0.100-preview.5 Look for this fix in 6.0.100-preview.5! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants