Flutter でカスタムフォントを試すサンプル。英数字と日本語で別のフォントを当てる
(fontFamilyFallback) 方法を追加してある。
解説記事: Flutterで英数字と日本語のフォントを分ける — 該当の変更は PR #1。
このリポジトリは susatthi/flutter-sample-fonts (作: susatthi 氏) を複製し、fallback フォントの機能を追加したもの。 2022-04 までの commit は同氏によるもので、履歴ごと引き継いでいる。
上流にライセンス表記が無いため、このリポジトリにもリポジトリ全体を覆う LICENSE は置かない。 利用したい場合は上流の作者に確認すること。
assets/fonts/ 配下の全 14 ファミリ (Montserrat / Noto Serif JP / Shippori Mincho ほか) は
Google Fonts から取得した SIL Open Font License 1.1 のフォント。
各ディレクトリに OFL.txt を同梱している。
- こちらの記事を参考に Google Fonts からフォントをダウンロードする。
- ダウンロードしたフォントは
assets/fontsに配置する。 - https://pub.dev/packages/flutter_gen を使って
fonts.gen.dartに反映する。dart run build_runner buildを実行すればよい。
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.