How to use a specific font from a list of fonts specified in a asset family in pubspec.yaml
up vote
1
down vote
favorite
Let's say i have added following lines to the pubspec.yaml file
fonts:
fonts:
- family: GreatVibes
  fonts:
    - asset: fonts/GreatVibes-Regular.ttf
    - asset: fonts/GreatVibes-Bold.ttf
I am using it in my app with the following lines of code.
new Text('My New Font',
        style: new TextStyle(
          color: Colors.white,
          fontFamily: 'GreatVibes',
          fontSize: 16.0,
        )),
My question is that ,among the two .ttf files provided earlier, how does flutter decides which file to use?
And Let's say if flutter decides to use GreatVibes-Bold.ttf, what can i do to make it use GreatVibes-regular.ttf
 flutter flutter-layout flutter-dependencies
flutter flutter-layout flutter-dependencies add a comment |
up vote
1
down vote
favorite
Let's say i have added following lines to the pubspec.yaml file
fonts:
fonts:
- family: GreatVibes
  fonts:
    - asset: fonts/GreatVibes-Regular.ttf
    - asset: fonts/GreatVibes-Bold.ttf
I am using it in my app with the following lines of code.
new Text('My New Font',
        style: new TextStyle(
          color: Colors.white,
          fontFamily: 'GreatVibes',
          fontSize: 16.0,
        )),
My question is that ,among the two .ttf files provided earlier, how does flutter decides which file to use?
And Let's say if flutter decides to use GreatVibes-Bold.ttf, what can i do to make it use GreatVibes-regular.ttf
 flutter flutter-layout flutter-dependencies
flutter flutter-layout flutter-dependencies add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Let's say i have added following lines to the pubspec.yaml file
fonts:
fonts:
- family: GreatVibes
  fonts:
    - asset: fonts/GreatVibes-Regular.ttf
    - asset: fonts/GreatVibes-Bold.ttf
I am using it in my app with the following lines of code.
new Text('My New Font',
        style: new TextStyle(
          color: Colors.white,
          fontFamily: 'GreatVibes',
          fontSize: 16.0,
        )),
My question is that ,among the two .ttf files provided earlier, how does flutter decides which file to use?
And Let's say if flutter decides to use GreatVibes-Bold.ttf, what can i do to make it use GreatVibes-regular.ttf
 flutter flutter-layout flutter-dependencies
flutter flutter-layout flutter-dependencies Let's say i have added following lines to the pubspec.yaml file
fonts:
fonts:
- family: GreatVibes
  fonts:
    - asset: fonts/GreatVibes-Regular.ttf
    - asset: fonts/GreatVibes-Bold.ttf
I am using it in my app with the following lines of code.
new Text('My New Font',
        style: new TextStyle(
          color: Colors.white,
          fontFamily: 'GreatVibes',
          fontSize: 16.0,
        )),
My question is that ,among the two .ttf files provided earlier, how does flutter decides which file to use?
And Let's say if flutter decides to use GreatVibes-Bold.ttf, what can i do to make it use GreatVibes-regular.ttf
 flutter flutter-layout flutter-dependencies
flutter flutter-layout flutter-dependencies  flutter flutter-layout flutter-dependencies
flutter flutter-layout flutter-dependencies edited Nov 9 at 11:03


CopsOnRoad
2,24511017
2,24511017
asked Nov 9 at 5:23


hemant bansal
82
82
add a comment |
add a comment |
                                2 Answers
                                2
                        
active
oldest
votes
up vote
0
down vote
If I understand these font things correctly - it has to be like this:
fonts:
- family: GreatVibes
  fonts:
    - asset: fonts/GreatVibes-Regular.ttf
    - asset: fonts/GreatVibes-Bold.ttf
      weight: 700
    - asset: fonts/GreatVibes-Italic.ttf
      style: italic
And then
new Text('My New Font',
    style: new TextStyle(
      color: Colors.white,
      fontFamily: 'GreatVibes',
      fontWeight: FontWeight.w700,
      fontSize: 16.0,
    )),
 
 
 
 
 
 
 Sorry, it is just changing the weight of the font, what if i had placed italic style font in there, i want to give multiple font choices to the app user but if i have to specify 'family' for each of those fonts, it will become really hard to manage, that's the sole purpose of me asking this question.
 – hemant bansal
 Nov 9 at 13:42
 
 
 
 
 
 
 
 
 
 I've edited answer - add option for italic. I don't know how you can put many different fonts in one family and work with them like as list
 – Andrey Turkovsky
 Nov 9 at 13:51
 
 
 
 
 
 
 
 
 
 yes, the fact is that we can use any name for family, it does not need to be same as the font's name, so if it has to choose b/w let say roboto and open sans, which of them will it choose
 – hemant bansal
 Nov 9 at 14:13
 
 
 
add a comment |
up vote
-1
down vote
Checkout these links :
How to use a custom font style in flutter?
https://flutter.io/docs/cookbook/design/fonts
 
 
 
 
 
 
 Are you sure, you said about flutter?
 – Andrey Turkovsky
 Nov 9 at 7:09
 
 
 
 
 
 
 
 
 
 @Sandep, downvoting it, cause your solution is for Android. The question asked is for Flutter.
 – CopsOnRoad
 Nov 9 at 11:02
 
 
 
 
 
 
 
 
 
 @CopsOnRoad I changed it for flutter.
 – Sandeep Insan
 Nov 9 at 11:09
 
 
 
 
 
 
 
 
 
 Don't use link to provide answer. You have comments for this purpose.
 – CopsOnRoad
 Nov 9 at 11:12
 
 
 
add a comment |
                                2 Answers
                                2
                        
active
oldest
votes
                                2 Answers
                                2
                        
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
If I understand these font things correctly - it has to be like this:
fonts:
- family: GreatVibes
  fonts:
    - asset: fonts/GreatVibes-Regular.ttf
    - asset: fonts/GreatVibes-Bold.ttf
      weight: 700
    - asset: fonts/GreatVibes-Italic.ttf
      style: italic
And then
new Text('My New Font',
    style: new TextStyle(
      color: Colors.white,
      fontFamily: 'GreatVibes',
      fontWeight: FontWeight.w700,
      fontSize: 16.0,
    )),
 
 
 
 
 
 
 Sorry, it is just changing the weight of the font, what if i had placed italic style font in there, i want to give multiple font choices to the app user but if i have to specify 'family' for each of those fonts, it will become really hard to manage, that's the sole purpose of me asking this question.
 – hemant bansal
 Nov 9 at 13:42
 
 
 
 
 
 
 
 
 
 I've edited answer - add option for italic. I don't know how you can put many different fonts in one family and work with them like as list
 – Andrey Turkovsky
 Nov 9 at 13:51
 
 
 
 
 
 
 
 
 
 yes, the fact is that we can use any name for family, it does not need to be same as the font's name, so if it has to choose b/w let say roboto and open sans, which of them will it choose
 – hemant bansal
 Nov 9 at 14:13
 
 
 
add a comment |
up vote
0
down vote
If I understand these font things correctly - it has to be like this:
fonts:
- family: GreatVibes
  fonts:
    - asset: fonts/GreatVibes-Regular.ttf
    - asset: fonts/GreatVibes-Bold.ttf
      weight: 700
    - asset: fonts/GreatVibes-Italic.ttf
      style: italic
And then
new Text('My New Font',
    style: new TextStyle(
      color: Colors.white,
      fontFamily: 'GreatVibes',
      fontWeight: FontWeight.w700,
      fontSize: 16.0,
    )),
 
 
 
 
 
 
 Sorry, it is just changing the weight of the font, what if i had placed italic style font in there, i want to give multiple font choices to the app user but if i have to specify 'family' for each of those fonts, it will become really hard to manage, that's the sole purpose of me asking this question.
 – hemant bansal
 Nov 9 at 13:42
 
 
 
 
 
 
 
 
 
 I've edited answer - add option for italic. I don't know how you can put many different fonts in one family and work with them like as list
 – Andrey Turkovsky
 Nov 9 at 13:51
 
 
 
 
 
 
 
 
 
 yes, the fact is that we can use any name for family, it does not need to be same as the font's name, so if it has to choose b/w let say roboto and open sans, which of them will it choose
 – hemant bansal
 Nov 9 at 14:13
 
 
 
add a comment |
up vote
0
down vote
up vote
0
down vote
If I understand these font things correctly - it has to be like this:
fonts:
- family: GreatVibes
  fonts:
    - asset: fonts/GreatVibes-Regular.ttf
    - asset: fonts/GreatVibes-Bold.ttf
      weight: 700
    - asset: fonts/GreatVibes-Italic.ttf
      style: italic
And then
new Text('My New Font',
    style: new TextStyle(
      color: Colors.white,
      fontFamily: 'GreatVibes',
      fontWeight: FontWeight.w700,
      fontSize: 16.0,
    )),
If I understand these font things correctly - it has to be like this:
fonts:
- family: GreatVibes
  fonts:
    - asset: fonts/GreatVibes-Regular.ttf
    - asset: fonts/GreatVibes-Bold.ttf
      weight: 700
    - asset: fonts/GreatVibes-Italic.ttf
      style: italic
And then
new Text('My New Font',
    style: new TextStyle(
      color: Colors.white,
      fontFamily: 'GreatVibes',
      fontWeight: FontWeight.w700,
      fontSize: 16.0,
    )),
edited Nov 9 at 13:48
answered Nov 9 at 12:38


Andrey Turkovsky
1,3671515
1,3671515
 
 
 
 
 
 
 Sorry, it is just changing the weight of the font, what if i had placed italic style font in there, i want to give multiple font choices to the app user but if i have to specify 'family' for each of those fonts, it will become really hard to manage, that's the sole purpose of me asking this question.
 – hemant bansal
 Nov 9 at 13:42
 
 
 
 
 
 
 
 
 
 I've edited answer - add option for italic. I don't know how you can put many different fonts in one family and work with them like as list
 – Andrey Turkovsky
 Nov 9 at 13:51
 
 
 
 
 
 
 
 
 
 yes, the fact is that we can use any name for family, it does not need to be same as the font's name, so if it has to choose b/w let say roboto and open sans, which of them will it choose
 – hemant bansal
 Nov 9 at 14:13
 
 
 
add a comment |
 
 
 
 
 
 
 Sorry, it is just changing the weight of the font, what if i had placed italic style font in there, i want to give multiple font choices to the app user but if i have to specify 'family' for each of those fonts, it will become really hard to manage, that's the sole purpose of me asking this question.
 – hemant bansal
 Nov 9 at 13:42
 
 
 
 
 
 
 
 
 
 I've edited answer - add option for italic. I don't know how you can put many different fonts in one family and work with them like as list
 – Andrey Turkovsky
 Nov 9 at 13:51
 
 
 
 
 
 
 
 
 
 yes, the fact is that we can use any name for family, it does not need to be same as the font's name, so if it has to choose b/w let say roboto and open sans, which of them will it choose
 – hemant bansal
 Nov 9 at 14:13
 
 
 
Sorry, it is just changing the weight of the font, what if i had placed italic style font in there, i want to give multiple font choices to the app user but if i have to specify 'family' for each of those fonts, it will become really hard to manage, that's the sole purpose of me asking this question.
– hemant bansal
Nov 9 at 13:42
Sorry, it is just changing the weight of the font, what if i had placed italic style font in there, i want to give multiple font choices to the app user but if i have to specify 'family' for each of those fonts, it will become really hard to manage, that's the sole purpose of me asking this question.
– hemant bansal
Nov 9 at 13:42
I've edited answer - add option for italic. I don't know how you can put many different fonts in one family and work with them like as list
– Andrey Turkovsky
Nov 9 at 13:51
I've edited answer - add option for italic. I don't know how you can put many different fonts in one family and work with them like as list
– Andrey Turkovsky
Nov 9 at 13:51
yes, the fact is that we can use any name for family, it does not need to be same as the font's name, so if it has to choose b/w let say roboto and open sans, which of them will it choose
– hemant bansal
Nov 9 at 14:13
yes, the fact is that we can use any name for family, it does not need to be same as the font's name, so if it has to choose b/w let say roboto and open sans, which of them will it choose
– hemant bansal
Nov 9 at 14:13
add a comment |
up vote
-1
down vote
Checkout these links :
How to use a custom font style in flutter?
https://flutter.io/docs/cookbook/design/fonts
 
 
 
 
 
 
 Are you sure, you said about flutter?
 – Andrey Turkovsky
 Nov 9 at 7:09
 
 
 
 
 
 
 
 
 
 @Sandep, downvoting it, cause your solution is for Android. The question asked is for Flutter.
 – CopsOnRoad
 Nov 9 at 11:02
 
 
 
 
 
 
 
 
 
 @CopsOnRoad I changed it for flutter.
 – Sandeep Insan
 Nov 9 at 11:09
 
 
 
 
 
 
 
 
 
 Don't use link to provide answer. You have comments for this purpose.
 – CopsOnRoad
 Nov 9 at 11:12
 
 
 
add a comment |
up vote
-1
down vote
Checkout these links :
How to use a custom font style in flutter?
https://flutter.io/docs/cookbook/design/fonts
 
 
 
 
 
 
 Are you sure, you said about flutter?
 – Andrey Turkovsky
 Nov 9 at 7:09
 
 
 
 
 
 
 
 
 
 @Sandep, downvoting it, cause your solution is for Android. The question asked is for Flutter.
 – CopsOnRoad
 Nov 9 at 11:02
 
 
 
 
 
 
 
 
 
 @CopsOnRoad I changed it for flutter.
 – Sandeep Insan
 Nov 9 at 11:09
 
 
 
 
 
 
 
 
 
 Don't use link to provide answer. You have comments for this purpose.
 – CopsOnRoad
 Nov 9 at 11:12
 
 
 
add a comment |
up vote
-1
down vote
up vote
-1
down vote
Checkout these links :
How to use a custom font style in flutter?
https://flutter.io/docs/cookbook/design/fonts
Checkout these links :
How to use a custom font style in flutter?
https://flutter.io/docs/cookbook/design/fonts
edited Nov 9 at 11:08
answered Nov 9 at 5:29


Sandeep Insan
1836
1836
 
 
 
 
 
 
 Are you sure, you said about flutter?
 – Andrey Turkovsky
 Nov 9 at 7:09
 
 
 
 
 
 
 
 
 
 @Sandep, downvoting it, cause your solution is for Android. The question asked is for Flutter.
 – CopsOnRoad
 Nov 9 at 11:02
 
 
 
 
 
 
 
 
 
 @CopsOnRoad I changed it for flutter.
 – Sandeep Insan
 Nov 9 at 11:09
 
 
 
 
 
 
 
 
 
 Don't use link to provide answer. You have comments for this purpose.
 – CopsOnRoad
 Nov 9 at 11:12
 
 
 
add a comment |
 
 
 
 
 
 
 Are you sure, you said about flutter?
 – Andrey Turkovsky
 Nov 9 at 7:09
 
 
 
 
 
 
 
 
 
 @Sandep, downvoting it, cause your solution is for Android. The question asked is for Flutter.
 – CopsOnRoad
 Nov 9 at 11:02
 
 
 
 
 
 
 
 
 
 @CopsOnRoad I changed it for flutter.
 – Sandeep Insan
 Nov 9 at 11:09
 
 
 
 
 
 
 
 
 
 Don't use link to provide answer. You have comments for this purpose.
 – CopsOnRoad
 Nov 9 at 11:12
 
 
 
Are you sure, you said about flutter?
– Andrey Turkovsky
Nov 9 at 7:09
Are you sure, you said about flutter?
– Andrey Turkovsky
Nov 9 at 7:09
@Sandep, downvoting it, cause your solution is for Android. The question asked is for Flutter.
– CopsOnRoad
Nov 9 at 11:02
@Sandep, downvoting it, cause your solution is for Android. The question asked is for Flutter.
– CopsOnRoad
Nov 9 at 11:02
@CopsOnRoad I changed it for flutter.
– Sandeep Insan
Nov 9 at 11:09
@CopsOnRoad I changed it for flutter.
– Sandeep Insan
Nov 9 at 11:09
Don't use link to provide answer. You have comments for this purpose.
– CopsOnRoad
Nov 9 at 11:12
Don't use link to provide answer. You have comments for this purpose.
– CopsOnRoad
Nov 9 at 11:12
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53220294%2fhow-to-use-a-specific-font-from-a-list-of-fonts-specified-in-a-asset-family-in-p%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
