299f392d7b
Adds support for generating a fallback font by providing font override metrics for the given local font. Also adds support for providing a CSS variable name that then can be accessed through the `.variable` export, it contains the hashed font family name. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) Co-authored-by: JJ Kasper <jj@jjsweb.site>
29 lines
671 B
TypeScript
29 lines
671 B
TypeScript
export type FontModule = {
|
|
className: string
|
|
variable?: string
|
|
style: { fontFamily: string; fontWeight?: number; fontStyle?: string }
|
|
}
|
|
|
|
export type AdjustFontFallback = {
|
|
fallbackFont: string
|
|
ascentOverride?: string
|
|
descentOverride?: string
|
|
lineGapOverride?: string
|
|
sizeAdjust?: string
|
|
}
|
|
|
|
export type FontLoader = (options: {
|
|
functionName: string
|
|
data: any[]
|
|
config: any
|
|
emitFontFile: (content: Buffer, ext: string, preload: boolean) => string
|
|
resolve: (src: string) => string
|
|
fs: any
|
|
}) => Promise<{
|
|
css: string
|
|
fallbackFonts?: string[]
|
|
variable?: string
|
|
adjustFontFallback?: AdjustFontFallback
|
|
weight?: string
|
|
style?: string
|
|
}>
|