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

How to use Font Weights with names? #28543

Closed
feinstein opened this issue Feb 27, 2019 · 11 comments
Closed

How to use Font Weights with names? #28543

feinstein opened this issue Feb 27, 2019 · 11 comments
Assignees
Labels
a: typography Text rendering, possibly libtxt d: api docs Issues with https://api.flutter.dev/ framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list team-framework Owned by Framework team triaged-framework Triaged by Framework team waiting for PR to land (fixed) A fix is in flight

Comments

@feinstein
Copy link
Contributor

I want to use Roboto Medium as my font, but I can only see options like FontWeight.bold for setting the font weight and it's not close to Roboto Medium.

Is it possible to access the name of a given Font Weight defined in a Font?

@zoechi
Copy link
Contributor

zoechi commented Feb 27, 2019

Please consider asking support questions in one of the other channels listed at http://flutter.io/support .

@zoechi zoechi added tool Affects the "flutter" command-line tool. See also t: labels. framework flutter/packages/flutter repository. See also f: labels. a: assets Packaging, accessing, or using assets labels Feb 27, 2019
@zoechi zoechi added this to the Goals milestone Feb 27, 2019
@feinstein
Copy link
Contributor Author

I will, it's just that I think this might be a bug (a functionality missing) or lack of documentation, so I rather open it as an issue as well.

@zoechi
Copy link
Contributor

zoechi commented Feb 27, 2019

This is why I kept it open. I don't know if this is supported or not.
Asking on StackOverflow or similar before reporting a bug/feature request is always a good idea though.

@anderscheow
Copy link

Since FontWeight.bold refer to FontWeight.w700, you can try this in your pubspec.yaml

fonts:
      - family: Roboto
        fonts:
          - asset: assets/fonts/Roboto-Medium.ttf
            weight: 700

@feinstein
Copy link
Contributor Author

I found that usually "Medium" means weight 500, so it actually would be FontWeight.w500.

It would be nice to have some sort of hint for this in the documentation, since many of us aren't well versed in typography and have to deal with some specs sent from designers.

@Kartik1607
Copy link
Contributor

Kartik1607 commented Feb 28, 2019

Hi, I think that the documentation https://flutter.dev/docs/cookbook/design/fonts and for https://docs.flutter.io/flutter/painting/TextStyle-class.html are quite verbose and contain all the required information. Could you please let us know what extra hints should be included in documentation and how can it be made better.

@feinstein
Copy link
Contributor Author

feinstein commented Feb 28, 2019

Sure, here are the things I would add:

1 - A hint that "Roboto Medium" would be "Roboto weight 500", as a way for people to know that "Medium" is actually a weight number and they should find out the number they want, since most of the time a Designer would just say "Roboto Medium", and many developers won't know what that is.

2 - The Cookbook Recipe for Fonts should have a reminder that MaterialApp already includes "Roboto" as the default Theme Font (and if there are any caveats, like something from Roboto missing, it should be there too).

Those are little additions, but I think they will enrich the text.

Thank you for being so open to contributions :)

@jonahwilliams jonahwilliams removed the tool Affects the "flutter" command-line tool. See also t: labels. label Jan 9, 2020
@kf6gpe kf6gpe added the P2 Important issues not at the top of the work list label May 29, 2020
@iapicca iapicca added a: typography Text rendering, possibly libtxt d: api docs Issues with https://api.flutter.dev/ documentation and removed a: assets Packaging, accessing, or using assets labels Jul 29, 2020
@Hixie Hixie removed this from the None. milestone Aug 17, 2020
@andoriyaprashant
Copy link

hey @feinstein
I want to work on this issue
can you please give me the address of this pubspec.yaml file
from where I can change or add something

@feinstein
Copy link
Contributor Author

What do you mean by changing the pubspec.yaml? I don't think there's anything there to be changed.

@flutter-triage-bot flutter-triage-bot bot added team-framework Owned by Framework team triaged-framework Triaged by Framework team labels Jul 8, 2023
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 17, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
@Hixie Hixie self-assigned this Jul 17, 2023
@Hixie Hixie added the waiting for PR to land (fixed) A fix is in flight label Jul 17, 2023
@Hixie
Copy link
Contributor

Hixie commented Jul 17, 2023

I wasn't 100% sure how to fix this issue since it was a bit vague and mentioned several problems, but I tried having a go at improving the FontWeight docs in flutter/engine#43750. Please don't hesitate to file specific bugs against specific documentation that you think is still inadequate. (The more specific the issue the better.)

Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 18, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 19, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 19, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 19, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 19, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 20, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 20, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 20, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 20, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 20, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 20, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 24, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Jul 25, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
@Hixie Hixie removed the easy fix label Aug 4, 2023
auto-submit bot pushed a commit to flutter/engine that referenced this issue Aug 23, 2023
…entation (#43750)

This should aid with implementing the framework side of flutter/flutter#105120 This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Aug 23, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
auto-submit bot pushed a commit to flutter/engine that referenced this issue Aug 23, 2023
…entation (#44996)

This should aid with implementing the framework side of flutter/flutter#105120.
This should also address flutter/flutter#28543.

This is a reland of #43750 with two changes, one to fix a typo mentioned in #43750 (comment), and one to fix the analysis error found when rolling this to the framework (https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20analyze/62845/overview). The latter change is temporary and can be relaxed when FontVariations is reexported from dart:ui. I plan to do that when fixing flutter/flutter#105120.
Hixie added a commit to Hixie/sky_engine that referenced this issue Aug 23, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
Hixie added a commit to Hixie/sky_engine that referenced this issue Aug 23, 2023
…entation

This should aid with implementing the framework side of flutter/flutter#105120
This should also address flutter/flutter#28543.
auto-submit bot pushed a commit to flutter/engine that referenced this issue Aug 25, 2023
…entation (#45030)

This should aid with implementing the framework side of flutter/flutter#105120.
This should also address flutter/flutter#28543.

Original commit in #43750 was reverted in #44993.
Second attempt in #44996 was reverted in #45023.
@Hixie Hixie closed this as completed Aug 29, 2023
gaaclarke pushed a commit to gaaclarke/engine that referenced this issue Aug 30, 2023
…entation (flutter#43750)

This should aid with implementing the framework side of flutter/flutter#105120 This should also address flutter/flutter#28543.
gaaclarke pushed a commit to gaaclarke/engine that referenced this issue Aug 30, 2023
…entation (flutter#44996)

This should aid with implementing the framework side of flutter/flutter#105120.
This should also address flutter/flutter#28543.

This is a reland of flutter#43750 with two changes, one to fix a typo mentioned in flutter#43750 (comment), and one to fix the analysis error found when rolling this to the framework (https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20analyze/62845/overview). The latter change is temporary and can be relaxed when FontVariations is reexported from dart:ui. I plan to do that when fixing flutter/flutter#105120.
gaaclarke pushed a commit to gaaclarke/engine that referenced this issue Aug 30, 2023
…entation (flutter#45030)

This should aid with implementing the framework side of flutter/flutter#105120.
This should also address flutter/flutter#28543.

Original commit in flutter#43750 was reverted in flutter#44993.
Second attempt in flutter#44996 was reverted in flutter#45023.
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: typography Text rendering, possibly libtxt d: api docs Issues with https://api.flutter.dev/ framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list team-framework Owned by Framework team triaged-framework Triaged by Framework team waiting for PR to land (fixed) A fix is in flight
Projects
None yet
Development

No branches or pull requests

10 participants