How To Use A Custom Font In Google Docs

You can use the drop-down menu to add new fonts to Google Slides Jumping back to my presentation in Google Slides, let's go ahead and update one of the text boxes with a custom font. I'll select the text by highlighting it and then come up to the Fonts drop-down menu.

Contents
  1. Open your presentation in Google Slides. Select one or more text boxes whose font you want to change. To select more than one, hold the Ctrl/Cmd key while clicking the text boxes. Go to the toolbar, click the Font drop-down arrow and choose the font that best suits your needs.
  2. Import the font files. Declare the font in the pubspec. Set a font as the default. Use a font in a specific widget.
  • 2. Declare the font in the pubspec
  • 4. Use the font in a specific widget
  • Complete example

Although Android and iOS offer high quality system fonts,one of the most common requests from designers is for custom fonts.For example, you might have a custom-built font from a designer,or perhaps you downloaded a font from Google Fonts.

Note: Check out the google_fonts package for direct access to over 1,000 open-sourced font families.

Note: For another approach to using custom fonts, especially if you want to re-use one font over multiple projects, see Export fonts from a package.

Flutter works with custom fonts and you can apply a customfont across an entire app or to individual widgets.This recipe creates an app that uses custom fonts withthe following steps:

  1. Import the font files.
  2. Declare the font in the pubspec.
  3. Set a font as the default.
  4. Use a font in a specific widget.

1. Import the font files

To work with a font, import the font files into the project.It’s common practice to put font files in a fonts or assetsfolder at the root of a Flutter project.

For example, to import the Raleway and Roboto Mono fontfiles into a project, the folder structure might look like this:

2. Declare the font in the pubspec

Once you’ve identified a font, tell Flutter where to find it.You can do this by including a font definition in the pubspec.yaml file.

pubspec.yaml option definitions

How To Use A Custom Font In Google Docs

How To Use A Custom Font On Google Docs

The family determines the name of the font, which you use in thefontFamily property of a TextStyle object.

The asset is a path to the font file, relative to the pubspec.yaml file.These files contain the outlines for the glyphs in the font.When building the app, these files are included in the app’s asset bundle.

Add Custom Font Google Docs

A single font can reference many different files with differentoutline weights and styles:

  • The weight property specifies the weight of the outlines inthe file as an integer multiple of 100, between 100 and 900.These values correspond to the FontWeightand can be used in the fontWeight property of aTextStyle object.

  • The style property specifies whether the outlines in the file areitalic or normal. These values correspond to theFontStyle and can be used in the fontStyle property of aTextStyle object.

3. Set a font as the default

How to use a custom font on google docs

You have two options for how to apply fonts to text: as the default fontor only within specific widgets.

To use a font as the default, set the fontFamily property as part ofthe app’s theme. The value provided to fontFamily must match the familyname declared in the pubspec.yaml.

For more information on themes,see the Using Themes to share colors and font styles recipe.

4. Use the font in a specific widget

If you want to apply the font to a specific widget,such as a Text widget,provide a TextStyle to the widget.

In this example, apply the RobotoMono font to a single Text widget.Once again, the fontFamily must match the family name declared in thepubspec.yaml.

TextStyle

If a TextStyle object specifies a weightor style for which there is no exact font file,the engine uses one of the more generic files for the font and attempts toextrapolate outlines for the requested weight and style.

Complete example

Fonts

The Raleway and RobotoMono fonts were downloaded fromGoogle Fonts.

pubspec.yaml

How To Use A Custom Font In Google Docs

main.dart