Open mwskwong opened 7 months ago
Font Name (Geist Sans/Geist Mono):
This is an enhancement instead of a bug. It would be great if we could customize the options of GeistSans and GeistMono. e.g. may be we can do
GeistSans
GeistMono
import localFont from 'next/font/local'; // since LocalFont is not exported from next/font/local type LocalFont = Parameters<typeof localFont>[0]; // omitting src, clearly we don't want that part to be customizable. export const GeistMono = (options?: Omit<LocalFont, 'src'>) => localFont({ src: './fonts/geist-mono/GeistMono-Variable.woff2', variable: '--font-geist-mono', adjustFontFallback: false, fallback: [ 'ui-monospace', 'SFMono-Regular', 'Roboto Mono', 'Menlo', 'Monaco', 'Liberation Mono', 'DejaVu Sans Mono', 'Courier New', 'monospace', ], ...options, }); export const GeistSans = (options?: Omit<LocalFont, 'src'>) => localFont({ src: './fonts/geist-sans/Geist-Variable.woff2', variable: '--font-geist-sans', ...options, });
Then we can allow users to customize the options they way they want, e.g. for my case, I want to prevent the monospace font from being preloaded.
const geistMono = GeistMono({ preload: false });
This syntax also matches that from next/font/google.
next/font/google
Font Name (Geist Sans/Geist Mono):
This is an enhancement instead of a bug. It would be great if we could customize the options of
GeistSans
andGeistMono
. e.g. may be we can doThen we can allow users to customize the options they way they want, e.g. for my case, I want to prevent the monospace font from being preloaded.
This syntax also matches that from
next/font/google
.