Google Fonts Module

This module integrates Google fonts with HB framework, which allow specifying multiple fonts and their axises.

Donate

Become a backer or sponsor to support our work.

On this page

Sponsors
Modulegithub.com/hbstack/google-fonts
Repository⭐ Please consider giving a star if your like it.
Stars
Version
Used by
Requirements
License
UsageSee how to use modules.

Site Parameters

ParameterTypeRequiredDefaultDescription
familiesarray✔️The array of font families, the first one are preferred.
families.namestring✔️Font name.
families.axisobjectFont axis.
families.axis.italarrayFont italic, range from 0 to 1.
families.axis.wghtarrayFont weight, the quantity must be the same as the families.axis.ital, range from 100 to 900 typically.

hugo.toml

 1[params]
 2  [params.hb]
 3    [params.hb.google_fonts]
 4      [[params.hb.google_fonts.families]]
 5        name = 'Roboto'
 6      [[params.hb.google_fonts.families]]
 7        name = 'Agbalumo'
 8        [params.hb.google_fonts.families.axis]
 9          ital = ['0', '1']
10          wght = ['600', '600..900']

hugo.yaml

 1params:
 2  hb:
 3    google_fonts:
 4      families:
 5      - name: Roboto
 6      - axis:
 7          ital:
 8          - "0"
 9          - "1"
10          wght:
11          - "600"
12          - 600..900
13        name: Agbalumo

hugo.json

 1{
 2   "params": {
 3      "hb": {
 4         "google_fonts": {
 5            "families": [
 6               {
 7                  "name": "Roboto"
 8               },
 9               {
10                  "axis": {
11                     "ital": [
12                        "0",
13                        "1"
14                     ],
15                     "wght": [
16                        "600",
17                        "600..900"
18                     ]
19                  },
20                  "name": "Agbalumo"
21               }
22            ]
23         }
24      }
25   }
26}

References

razonyang
Saturday, December 21, 2024 Wednesday, November 15, 2023