diff --git a/src/app/globals.css b/src/app/globals.css index acbebfa58..ab29b8f34 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -47,8 +47,16 @@ size-adjust: 107.12%; } -/* On body, where the next/font variable class used to set it. */ -body { +/* + * On body, where the next/font variable class used to set it, and on the + * chart text-measurement host, which sits under beside + * (`src/components/charts/text-measurement-host.ts`). The host copies body's + * classes to measure in the app font; the variable class used to be one of + * them, so without this rule the host fell back to the default font and + * every axis label was sized in a font the chart did not draw in. + */ +body, +[data-slot="chart-text-measurement-host"] { --font-sans: "Inter", "Inter Fallback"; } diff --git a/src/components/charts/text-measurement-host.ts b/src/components/charts/text-measurement-host.ts index f27bc2332..aab28735e 100644 --- a/src/components/charts/text-measurement-host.ts +++ b/src/components/charts/text-measurement-host.ts @@ -17,10 +17,10 @@ * ``, inside a `contain: strict` box, costs about 0.01 ms. * * So the span lives under ``, next to ``, inside a zero-size - * contained host. The host copies ``'s class list, which is where the - * app font is set (`--font-sans` + `font-sans`), so every string measures in - * the same font at the same size as before and the charts lay out exactly as - * they did. + * contained host. The host copies ``'s class list (`font-sans`), and + * `globals.css` defines the `--font-sans` stack on the host as on ``, + * so every string measures in the same font at the same size as before and + * the charts lay out exactly as they did. */ export const RECHARTS_MEASUREMENT_SPAN_ID = "recharts_measurement_span";