text stringlengths 1 372 |
|---|
<topic_start> |
using the google fonts site |
use the font’s details page to learn more about its static fonts. |
use the following API to programmatically alter a static font |
(but remember that this only works if the font was designed |
to support the feature): |
a FontFeature corresponds to an OpenType feature tag |
and can be thought of as a boolean flag to enable or disable |
a feature of a given font. |
the following example is for CSS, but illustrates the concept: |
<topic_end> |
<topic_start> |
other resources |
the following video shows you some of the capabilities |
of flutter’s typography and combines it with the material |
and cupertino look and feel (depending on the platform |
the app runs on), animation, and custom fragment shaders: |
prototyping beautiful designs with flutter |
to read one engineer’s experience |
customizing variable fonts and animating them as they |
morph (and was the basis for the above video), |
check out playful typography with flutter, |
a free article on medium. the associated example also |
uses a custom shader. |
<topic_end> |
<topic_start> |
use a custom font |
<topic_end> |
<topic_start> |
what you’ll learn |
although android and iOS offer high quality system fonts, |
designers want support for custom fonts. |
you might have a custom-built font from a designer, |
or perhaps you downloaded a font from google fonts. |
a typeface is the collection of glyphs or shapes that comprise |
a given style of lettering. |
a font is one representation of that typeface at a given weight or variation. |
roboto is a typeface and roboto bold is a font. |
flutter lets you apply a custom font across an entire app or to individual widgets. |
this recipe creates an app that uses custom fonts with the following steps. |
you don’t need to follow each step as you go. |
the guide offers completed example files at the end. |
info note |
this guide makes the following presumptions: |
<topic_end> |
<topic_start> |
choose a font |
your choice of font should be more than a preference. |
consider which file formats work with flutter and |
how the font could affect design options and app performance. |
<topic_end> |
<topic_start> |
pick a supported font format |
flutter supports the following font formats: |
flutter does not support fonts in the web open font format, |
.woff and .woff2, on desktop platforms. |
<topic_end> |
<topic_start> |
choose fonts for their specific benefits |
few sources agree on what a font file type is or which uses less space. |
the key difference between font file types involves how the format |
encodes the glyphs in the file. |
most TrueType and OpenType font files have similar capabilities as they |
borrowed from each other as the formats and fonts improved over time. |
which font you should use depends on the following considerations. |
research what options a given font offers, |
like more than one weight or style per font file, |
variable font capability, |
the availability of multiple font files for a multiple font weights, |
or more than one width per font. |
choose the typeface or font family that meets the design needs of your app. |
to learn how to get direct access to over 1,000 open-sourced font families, |
check out the google_fonts package. |
to learn about another approach to using custom fonts that allows you to |
re-use one font over multiple projects, |
check out export fonts from a package. |
<topic_end> |
<topic_start> |
import the font files |
to work with a font, import its font files into your flutter project. |
to import font files, perform the following steps. |
if necessary, to match the remaining steps in this guide, |
change the name of your flutter app to custom_fonts. |
navigate to the root of your flutter project. |
create a fonts directory at the root of your flutter project. |
move or copy the font files in a fonts or assets |
folder at the root of your flutter project. |
the resulting folder structure should resemble the following: |
<topic_end> |
<topic_start> |
declare the font in the pubspec.yaml file |
after you’ve downloaded a font, |
include a font definition in the pubspec.yaml file. |
this font definition also specifies which font file should be used to |
render a given weight or style in your app. |
<topic_end> |
<topic_start> |
define fonts in the pubspec.yaml file |
to add font files to your flutter app, complete the following steps. |
open the pubspec.yaml file at the root of your flutter project. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.