-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Docs could be clearer on when we should have to define styles #11581
Comments
@Piinks, any idea who might know this? |
I've asked around, and it sounds like @jason-simmons may know best here. This lives in the engine. :) |
The current implementation of font matching in the Flutter engine ignores the weights and styles declared in Font matching is instead based on the weight, style, and other attributes defined within the font asset files. (I don't know if the web platform makes use of the weight and style declarations.) |
@jason-simmons so you are saying that this tutorial is completely outdated and we shouldn't be defining weights and styles at all inside |
The font style and weight attributes in @yjbanov Does Flutter Web use the font weights and styles in If nobody uses or intends to use this data, then we should deprecate it and remove it from the documentation. |
I agree with Jason!
…On Tue, Jan 14, 2025 at 8:09 AM Jason Simmons ***@***.***> wrote:
The font style and weight attributes in pubspec.yaml are currently not
used by the engine. In theory the engine could someday use them for some
purpose (although I suspect this is unlikely to change given that users
depend on the current behavior).
@yjbanov <https://github.com/yjbanov> Does Flutter Web use the font
weights and styles in pubspec.yaml in any way?
(I did not notice any usage when looking through lib/web_ui)
If nobody uses or intends to use this data, then we should deprecate it
and remove it from the documentation.
—
Reply to this email directly, view it on GitHub
<#11581 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKS4PKKEXF7M3NZ3CVBBE2L2KUZDLAVCNFSM6AAAAABU5XH7B2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJQGM3TMMZZGM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Not only that, but the docs state that if not defined, the expected behaviour will change and your texts will appear distorted, so I can't see a scenario where we can keep the text as is. |
Page URL
https://docs.flutter.dev/cookbook/design/fonts/
Page source
https://github.com/flutter/website/tree/main/src/content/cookbook/design/fonts.md
Describe the problem
The website describes how to use custom fonts, but it says:
The wording here implies that it's optional, it says we
can apply
not that weshould apply
.For example, if I have imported
Raleway-Regular.ttf
,Raleway-Italic.ttf
, andRobotoMono-Bold.ttf
, will Flutter automatically understand that a font file ending withItalic
is theitalic
style, or do I have to define it?The text mentions that when Flutter doesn't have the proper definition, then Flutter will try to force a visual distortion that might look bad, but it's not clear how far can Flutter infer the options, and avoiding all of that boiler plate while defining fonts it's very welcomed.
For example, here's what I have to add to configure one typeface that my design team wants to use:
If the docs made it clear that I can avoid typing all of this, then this would save me some time. (I have thought about testing this, but I am not sure if I would be able, as Flutter will distort my fonts to try to comply with my style selection, and I rather have a documented answer).
As an extra, maybe I got this wrong, but the doc firstly explains the difference between a typeface and a font, which for me it appears that a typeface is a collection of fonts, and a font is only one file, like
RobotoMono-Bold.ttf
, but then the rest of the document only uses the word "font", which I feel like in many places maybe it was meaning more "typeface".Expected fix
Clarify if we always have to define the style and weight for each font that's being imported, or if Flutter has some basic rules and applies them by default and we don't have to worry.
Additional context
The Google Fonts package docs says that if the fonts are in a specific format, then we don't have to worry about defining the styles and fonts, but it's not clear if this is a feature from the package or if Flutter itself is handling this.
I would like to fix this problem.
The text was updated successfully, but these errors were encountered: