Skip to content
Randall C. O'Reilly edited this page Jan 25, 2024 · 1 revision

This page contains all the relevant information about fonts in the GoGi framework.

FontStyle

The primary way to specify a font is via the FontStyle which is found in the overall Style struct (see Style). It has fields for all the different supported font parameters, including Stretch, Weight, Style, Decoration, etc.

The standard CSS font styling terms are supported, as described in these links:

Where Download Fonts / Platform Notes

Linux

The Ubuntu distribution of linux includes Liberation fonts (https://en.wikipedia.org/wiki/Liberation_fonts) (which are the basis for the Noto fonts) -- these are specified as a platform-specific default font for linux, instead of Arial which is the default on Windows and Mac.

Supported Fonts and Standard Font Names

Currently, only TrueType fonts are supported, with a .ttf extension.

Some TTF fonts come in a "Collection" format (.ttc extension) -- these should be unpacked into separate .ttf files to enable the system to actually use the different variants within the collection -- use e.g., https://onlinefontconverter.com/ or similar utilties to extract ttf from ttc files.

The standardized / regularized name of a font is the base FamilyName (e.g., Arial) followed by the following modifiers, in that order, space separated:

  • Stretch: Normal (omitted from name), Condensed, Expanded, etc (not as commonly used)
  • Weight: Regular (omitted from name), Thin, Bold, etc
  • Style: Normal (omitted from name), Italic, Oblique

It is ideal if the font file names follow this convention, but the FontLib code in GoGi attempts to regularize as best it can. This FontLib system does its best to try to map a font specification given by FontStyle into an actual available font file found on the system -- usually you don't need to worry about it but see gi/font.go for all the gory details if something is not working right.

Go Font

The special Go font: https://blog.golang.org/go-fonts is compiled in and always available on all platforms, in all variants. Specify Go or GoMono as the Family name.

Unicode support

On Windows and Linux, Unicode support for things like the keyboard symbols (shift, etc) is not great. Mac has it in one arial unicode font that we specifically use for symbol characters. Here's some notes on this issue:

Clone this wiki locally