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

Font Override wont work for all controls (probably due to this...) #1287

Open
5 tasks
iurycarlos opened this issue Nov 24, 2023 · 2 comments
Open
5 tasks

Font Override wont work for all controls (probably due to this...) #1287

iurycarlos opened this issue Nov 24, 2023 · 2 comments
Labels
kind/bug Something isn't working

Comments

@iurycarlos
Copy link
Contributor

iurycarlos commented Nov 24, 2023

Current behavior

Font overriding is not working for all controls.

For instance:

If we try to override the "LabelLargeFontFamily", it will work fine for Textblocks.
However, Buttons will not reproduce the same override as expected since the font they use is "LabelLargeFontFamily".

Taking a look at themes code, I found:

In Typography.xaml , the following line:

And in Button.xaml , its font definition:

So, since it is not referencing directly "LabelLargeFontFamily", I suppose it will never reproduce the override.

Expected behavior

Font Override should work everywhere.

How to reproduce it (as minimally and precisely as possible)

Just use Figma Plugin for example or a new app and try to override the referred font.

 <FontFamily x:Key="LabelLargeFontFamily">Rock Salt</FontFamily>
  <!--The font Rock Salt has been found on Google Fonts at the following url: https://fonts.google.com/specimen/Rock+Salt -->
  <!--And its source can be downloaded directly from: https://fonts.gstatic.com/s/rocksalt/v22/MwQ0bhv11fWD6QsAVOZbsEk7hbBWrA.ttf -->
 

image

Environment

Nuget Package:

Package Version(s):

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • UWP
  • MacOS

Anything else we need to know?

@iurycarlos iurycarlos added the kind/bug Something isn't working label Nov 24, 2023
@kazo0
Copy link
Collaborator

kazo0 commented Nov 25, 2023

There's a tradeoff here that we have to figure out, either you have fontfamily specific resource keys for each control or they use the ones coming directly from Typography.xaml.

If we make the control styles use the ones from Typography.xaml instead of having things like OutlineButtonFamilyFamily then we lose the ability to customize fonts for specific controls/styles and are limited to only overriding the font family globally.

Due to how resource aliasing works, you can have Resource B be an alias for Resource A and then expect B to change if A is overridden at a later point in time.

So we may need to change things like this:

<StaticResource x:Key="CheckBoxFontFamily" ResourceKey="MaterialMediumFontFamily" />
<StaticResource x:Key="CheckBoxFontWeight" ResourceKey="BodySmallFontWeight" />
<StaticResource x:Key="CheckBoxFontSize" ResourceKey="BodySmallFontSize" />
<StaticResource x:Key="CheckBoxCharacterSpacing" ResourceKey="BodySmallCharacterSpacing" />

Which will be a breaking change

FYI @Xiaoy312 / @agneszitte

@iurycarlos
Copy link
Contributor Author

@carldebilly FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants