谷歌字體模塊

該模塊將谷歌字體整合於 HB 框架,其允許制定多個字體及其軸範圍。

本頁內容

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.

站點參數

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}

參考文檔

razonyang
2024年6月15日 星期六 2023年11月15日 星期三