Flutter
Use Openbase Sans, Mono and Drawn in Flutter with the openbase_fonts package.
openbase_fonts bundles the TTF files of all three families and small helpers for text styles and themes.
pubspec.yaml
dependencies:
openbase_fonts:
git:
url: https://github.com/Try-Openbase/typeface.git
path: packages/openbase_fontsUsage
import 'package:openbase_fonts/openbase_fonts.dart';
Text('Hello', style: OpenbaseFonts.sans(fontSize: 16, fontWeight: FontWeight.w500));
Text('Note', style: OpenbaseFonts.sans(fontStyle: FontStyle.italic));
Text('Hello', style: OpenbaseFonts.drawn(fontSize: 16)); // same width as sans
Text('const x = 1;', style: OpenbaseFonts.mono(fontSize: 13));| Member | Value |
|---|---|
| OpenbaseFonts.package | 'openbase_fonts' |
| OpenbaseFonts.sansFamily | 'OpenbaseSans' |
| OpenbaseFonts.monoFamily | 'OpenbaseMono' |
| OpenbaseFonts.drawnFamily | 'Openbase Drawn' |
| OpenbaseFonts.weights | w300, w400, w500, w600, w700 (each upright and italic) |
As the app font
MaterialApp(
theme: ThemeData(
textTheme: OpenbaseFonts.textTheme(ThemeData().textTheme),
),
);
// Drawn everywhere:
OpenbaseFonts.textTheme(base, family: OpenbaseFonts.drawnFamily);Note: When you build a
TextStyle yourself, pass package: 'openbase_fonts' with the family name, or Flutter falls back to the platform font.