Skip to content

Commit 3cb3214

Browse files
committed
docs: update README.md file
1 parent 759b6e0 commit 3cb3214

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.1
2+
3+
- Update README.md file to reflect previous changes and be more concise.
4+
15
## 0.2.0
26

37
- Move font configuration into `fonts` key in fontsource config.

README.md

+13-11
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@ Add Fontsource fonts to your flutter app. Direct access to Fontsource API.
66

77
To start, create a config in either your `pubspec.yaml` file under the `fontsource` key or in the `fontsource.yaml` file.
88

9-
The `fontsource` config is a map of font ids to font configs. Each font config can have a `version`, `subsets`, `weights`, and `styles` key. The default is `latest` for the `version`, and `all` for the rest of the keys. This config will tell `fontsource` what to download and bundle into your flutter app. To ensure everything is downloaded, execute `dart run fontsource` after your config is modified. Also make sure to run it whenever your repository is cloned.
10-
11-
`fontsource.yaml`:
12-
139
```yaml
14-
alex-brush:
15-
subsets: [latin, latin-ext]
16-
weights: [400]
17-
styles: [normal]
10+
fonts:
11+
alex-brush: # This can be any font id
12+
version: 4.5.3 # Defaults to latest
13+
subsets: [latin, latin-ext] # Defaults to all
14+
weights: [400] # Defaults to all
15+
styles: [normal] # Defaults to all
1816
```
1917
18+
The config will tell `fontsource` what to download and bundle into your flutter app. To ensure everything is downloaded, execute `dart run fontsource` after your config is modified. Also make sure to run it whenever your repository is cloned. This will generate a local package in the `.fontsource` directory.
19+
2020
You can then import the `fontsource` package:
2121

2222
```dart
2323
import 'package:fontsource/fontsource.dart';
2424
```
2525

26-
Use `FontsourceTextStyle` to use a Fontsource font:
26+
Use [`FontsourceTextStyle`](https://pub.dev/documentation/fontsource/latest/fontsource/FontsourceTextStyle-class.html) to use a Fontsource font:
2727

2828
```dart
2929
const Text(
@@ -32,6 +32,8 @@ const Text(
3232
),
3333
```
3434

35-
`FontsourceTextStyle` extends the `TextStyle` class, so any styling properties can be used to change the way the text looks.
35+
[`FontsourceTextStyle`](https://pub.dev/documentation/fontsource/latest/fontsource/FontsourceTextStyle-class.html) extends the `TextStyle` class, so any styling properties can be used to change the way the text looks.
36+
37+
## Fontsource API
3638

37-
Alternatively, you can use the normal `TextStyle` class by specifying the `package` as `fontsource_gen`. This package is automatically added to your dependencies and generated locally when `dart run fontsource` is executed.
39+
The Fontsource API also has a dart interface that can be accessed through [`fontsource/api.dart`](https://pub.dev/documentation/fontsource/latest/api/api-library.html).

example/pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ packages:
8080
path: ".."
8181
relative: true
8282
source: path
83-
version: "0.2.0"
83+
version: "0.2.1"
8484
fontsource_gen:
8585
dependency: "direct main"
8686
description:

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: fontsource
22
description: Add Fontsource fonts to your flutter app. Direct access to Fontsource API.
3-
version: 0.2.0
3+
version: 0.2.1
44
repository: https://github.com/fontsource/fontsource-flutter
55

66
environment:

0 commit comments

Comments
 (0)