Skip to content

Commit 42fdd7e

Browse files
authored
Merge branch 'main' into i18n/fr-update-modules/astro-config.mdx
2 parents 2881f64 + 920718b commit 42fdd7e

File tree

1 file changed

+11
-9
lines changed
  • src/content/docs/en/reference/experimental-flags

1 file changed

+11
-9
lines changed

src/content/docs/en/reference/experimental-flags/fonts.mdx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ body {
8282
});
8383
```
8484

85-
More configuration options, such as defining [fallback font families](#fallbacks) and which [`weights`](#weights) and [`styles`](#styles) to download, are available and some will depend on your chosen provider.
85+
More configuration options, such as defining [fallback font families](#fallbacks) and which [`weights`](#weights), [`styles`](#styles) and [`subsets`](#subsets) to download, are available and some will depend on your chosen provider.
8686

8787
See the full [configuration reference](#font-configuration-reference) to learn more.
8888

@@ -152,7 +152,9 @@ body {
152152

153153
## Available remote font providers
154154

155-
Astro re-exports most [unifont](https://github.com/unjs/unifont/) providers. The following have built-in support:
155+
Astro re-exports most [unifont](https://github.com/unjs/unifont/) providers. You can also [make a custom Astro font provider](#build-your-own-font-provider) for any unifont provider.
156+
157+
The following providers have built-in support:
156158

157159
- [Adobe](https://fonts.adobe.com/)
158160
- [Bunny](https://fonts.bunny.net/)
@@ -167,9 +169,11 @@ To use a built-in remote provider, configure `provider` with the appropriate val
167169
<TabItem label="Adobe">
168170

169171
```js
170-
provider: fontProviders.adobe({ id: process.env.ADOBE_ID })
172+
provider: fontProviders.adobe({ id: 'your-id' })
171173
```
172174

175+
Pass the Adobe font provider an ID loaded as an [environment variable in your Astro config file](/en/guides/environment-variables/#in-the-astro-config-file).
176+
173177
</TabItem>
174178

175179
<TabItem label="Bunny">
@@ -216,8 +220,6 @@ provider: fontProviders.google({
216220

217221
</Tabs>
218222

219-
You can also [make a custom Astro font provider](#build-your-own-font-provider) for any unifont provider.
220-
221223
## Usage examples
222224

223225
```js title="astro.config.mjs"
@@ -233,7 +235,7 @@ export default defineConfig({
233235
// Default included:
234236
// weights: [400] ,
235237
// styles: ["normal", "italics"],
236-
// subsets: ["cyrillic-ext", "cyrillic", "greek-ext", "greek", "vietnamese", "latin-ext", "latin"],
238+
// subsets: ["latin"],
237239
// fallbacks: ["sans-serif"],
238240
},
239241
{
@@ -245,14 +247,14 @@ export default defineConfig({
245247
// Specify styles that are actually used
246248
styles: ["normal"],
247249
// Download only font files for characters used on the page
248-
subsets: ["cyrillic"],
250+
subsets: ["latin", "cyrillic"],
249251
},
250252
{
251253
name: "JetBrains Mono",
252254
cssVariable: "--font-jetbrains-mono",
253255
provider: fontProviders.fontsource(),
254256
// Download only font files for characters used on the page
255-
subsets: ["latin"],
257+
subsets: ["latin", "latin-ext"],
256258
// Use a fallback font family matching the intended appearance
257259
fallbacks: ["monospace"],
258260
},
@@ -550,7 +552,7 @@ styles: ["normal", "oblique"]
550552
<p>
551553

552554
**Type:** `string[]`<br />
553-
**Default:** `["cyrillic-ext", "cyrillic", "greek-ext", "greek", "vietnamese", "latin-ext", "latin"]`
555+
**Default:** `["latin"]`
554556
</p>
555557

556558
Defines a list of [font subsets](https://knaap.dev/posts/font-subsetting/) to preload.

0 commit comments

Comments
 (0)