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

[Material] Change to a single MaterialFontFamily resource #1213

Open
kazo0 opened this issue Sep 21, 2023 · 1 comment
Open

[Material] Change to a single MaterialFontFamily resource #1213

kazo0 opened this issue Sep 21, 2023 · 1 comment
Labels
area/fonts Categorizes an issue or PR as relevant to fonts kind/enhancement New feature or request theme/material

Comments

@kazo0
Copy link
Collaborator

kazo0 commented Sep 21, 2023

⚠️ PROPOSED BREAKING CHANGE ⚠️

Once unoplatform/uno#13725 is fixed, we should consolidate all of the Material FontFamily resources into a single MaterialFontFamily resource that will use the Roboto Flex font from Uno.Fonts.Roboto

Prerequisite issue: unoplatform/uno.fonts#36

@agneszitte
Copy link
Contributor

--- For more context: ---
When you are using the Roboto font with Material, as of right now there are multiple .ttf files (here) [that does not contain all the Roboto .ttf files by the way at the moment as we only added what was needed for the current controls for Material].

For the FontWeight to work properly visually, the FontFamily will need to follow:

  • FontFamily = ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Medium.ttf#Roboto
  • FontWeight = Medium
    --
  • FontFamily = ms-appx:///Uno.Fonts.Roboto/Fonts/Roboto-Regular.ttf#Roboto
  • FontWeight = Normal

If you want to override the FontWeight for some text styles in the Figma file for a project, right now the plugin is only adding the override value for the FontWeight only and not for the FontFamily. In Figma, Roboto is the name of the font in the list and you only need to change the FontWeight.
For Windows apps, when dealing with multiple font files for the same font, there is not this automatic bundle possible at the moment (Related issue opened by @MartinZikmund : microsoft/microsoft-ui-xaml#7538 (comment)).

  • If we are keeping multiple .ttf font files for Roboto as we have at the moment:
    There are normally no issues on the dev side as we can manually override the correct FontFamily to match the FontWeight.
    But the issue will be on the Figma plugin side where right now not sure if we will have a way to have the proper FontFamily override for the MaterialFontsOverride.xaml file. FontFamily only mentioned "Roboto" in Figma as correctly bundled so it will need to have additional logic to know that for this particular font when FontWeight is overridden then FontFamily should also follow (+ providing somehow the correct path for it...).

  • If we bundle up all the Roboto font files into one to end up with only one .ttf file:
    Then we will need to fix this issue: [Fonts] FontWeights are not being respected for .ttf files containing multiple weights uno#13725 (comment)
    Pretty sure it is the same issue for all fonts with only one .ttf file for all the font weights
    But in this case, if #13725 is fixed, there will be no issue on the Figma plugin side as we will just need to override the FontWeight, and this is already working properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/fonts Categorizes an issue or PR as relevant to fonts kind/enhancement New feature or request theme/material
Projects
None yet
Development

No branches or pull requests

2 participants