@timber-js/app 0.2.0-alpha.246 → 0.2.0-alpha.248
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fonts/ast.d.ts.map +1 -1
- package/dist/fonts/bundle.d.ts +26 -8
- package/dist/fonts/bundle.d.ts.map +1 -1
- package/dist/fonts/fallbacks.d.ts +46 -8
- package/dist/fonts/fallbacks.d.ts.map +1 -1
- package/dist/fonts/font-metrics.d.ts +54 -0
- package/dist/fonts/font-metrics.d.ts.map +1 -0
- package/dist/fonts/local-fallback.d.ts +64 -0
- package/dist/fonts/local-fallback.d.ts.map +1 -0
- package/dist/fonts/local.d.ts.map +1 -1
- package/dist/fonts/sfnt.d.ts +30 -0
- package/dist/fonts/sfnt.d.ts.map +1 -0
- package/dist/fonts/transform.d.ts.map +1 -1
- package/dist/fonts/types.d.ts +29 -0
- package/dist/fonts/types.d.ts.map +1 -1
- package/dist/index.js +1063 -352
- package/dist/index.js.map +1 -1
- package/dist/native/rsc/manifest.json +1 -0
- package/dist/native/rsc/server/internal.js +2 -2
- package/dist/native/rsc/server/metadata-render.js +3 -1
- package/dist/native/rsc/server/metadata-render.js.map +1 -1
- package/dist/native/rsc/server/metadata-urls.js +70 -0
- package/dist/native/rsc/server/metadata-urls.js.map +1 -0
- package/dist/native/rsc/server/metadata.js +1 -64
- package/dist/native/rsc/server/metadata.js.map +1 -1
- package/dist/native/ssr/manifest.json +1 -0
- package/dist/native/ssr/server/internal.js +2 -2
- package/dist/native/ssr/server/metadata-render.js +3 -1
- package/dist/native/ssr/server/metadata-render.js.map +1 -1
- package/dist/native/ssr/server/metadata-urls.js +70 -0
- package/dist/native/ssr/server/metadata-urls.js.map +1 -0
- package/dist/native/ssr/server/metadata.js +1 -64
- package/dist/native/ssr/server/metadata.js.map +1 -1
- package/dist/plugins/build-manifest.d.ts +5 -0
- package/dist/plugins/build-manifest.d.ts.map +1 -1
- package/dist/plugins/fonts.d.ts.map +1 -1
- package/dist/server/internal.d.ts +1 -1
- package/dist/server/internal.d.ts.map +1 -1
- package/dist/server/internal.js +84 -77
- package/dist/server/internal.js.map +1 -1
- package/dist/server/metadata-render.d.ts +4 -1
- package/dist/server/metadata-render.d.ts.map +1 -1
- package/dist/server/metadata-urls.d.ts +24 -0
- package/dist/server/metadata-urls.d.ts.map +1 -0
- package/dist/server/metadata.d.ts +0 -7
- package/dist/server/metadata.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/fonts/ast.ts +35 -2
- package/src/fonts/bundle.ts +71 -17
- package/src/fonts/fallbacks.ts +92 -28
- package/src/fonts/font-metrics.ts +236 -0
- package/src/fonts/local-fallback.ts +249 -0
- package/src/fonts/local.ts +14 -1
- package/src/fonts/pipeline.ts +6 -3
- package/src/fonts/sfnt.ts +185 -0
- package/src/fonts/transform.ts +4 -1
- package/src/fonts/types.ts +29 -0
- package/src/plugins/build-manifest.ts +1 -1
- package/src/plugins/fonts.ts +28 -2
- package/src/server/internal.ts +1 -6
- package/src/server/metadata-render.ts +6 -1
- package/src/server/metadata-urls.ts +109 -0
- package/src/server/metadata.ts +0 -108
package/dist/fonts/ast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/fonts/ast.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAkC,YAAY,EAAE,MAAM,eAAe,CAAC;AAQ3F,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AA+GlD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAIhF;AAiCD;;;;;GAKG;AACH,wBAAgB,yBAAyB,C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.ts
CHANGED
|
@@ -36,15 +36,33 @@ export declare function groupCachedFontsByFamily(cachedFonts: readonly CachedFon
|
|
|
36
36
|
*/
|
|
37
37
|
export declare function emitFontAssets(pipeline: FontPipeline, emitFile: EmitFile, warn: EmitWarning): void;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* `filePath` values (which are absolute) and is consistent with how
|
|
42
|
-
* `buildManifest.css` keys work after TIM-1014.
|
|
39
|
+
* Map each font importer to the route files (layouts and pages) that
|
|
40
|
+
* import it, directly or through any chain of modules.
|
|
43
41
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
42
|
+
* A font is usually defined in a shared module (`app/fonts.ts`) and applied
|
|
43
|
+
* in a layout that imports it. The manifest is read per matched route
|
|
44
|
+
* segment (`collectRouteFonts`), so an entry keyed only by the defining
|
|
45
|
+
* module would never be found. Walking *up* the importer graph from each
|
|
46
|
+
* font module is cheap — there are a handful of font modules, and the walk
|
|
47
|
+
* stops at modules already visited.
|
|
48
|
+
*
|
|
49
|
+
* `getImporters` is Rollup's `getModuleInfo(id)?.importers` from the RSC
|
|
50
|
+
* build, where layouts and pages are real modules. A route file reached
|
|
51
|
+
* through another route file (a page importing a layout's module) still
|
|
52
|
+
* counts: the font is in that page's graph.
|
|
53
|
+
*/
|
|
54
|
+
export declare function mapFontImportersToRoutes(importers: Iterable<string>, routeFiles: Iterable<string>, getImporters: (id: string) => readonly string[] | null | undefined): Map<string, string[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Populate `buildManifest.fonts` with the font binaries to preload, keyed
|
|
57
|
+
* by absolute path. The keys are the font's importer plus every route file
|
|
58
|
+
* that reaches it (`routesByImporter`, from `mapFontImportersToRoutes`), so
|
|
59
|
+
* `collectRouteFonts` finds a font defined outside the layout that applies
|
|
60
|
+
* it. Keys are absolute, matching the route manifest's `filePath` values
|
|
61
|
+
* (and `buildManifest.css`, TIM-1014).
|
|
62
|
+
*
|
|
63
|
+
* Fonts with `preload: false` and non-upright faces are left out. All
|
|
64
|
+
* hrefs are content-hashed and prefixed with Vite's resolved `base`.
|
|
47
65
|
*/
|
|
48
|
-
export declare function writeFontManifest(pipeline: FontPipeline, buildManifest: BuildManifest, base?: string): void;
|
|
66
|
+
export declare function writeFontManifest(pipeline: FontPipeline, buildManifest: BuildManifest, base?: string, routesByImporter?: ReadonlyMap<string, readonly string[]>): void;
|
|
49
67
|
export {};
|
|
50
68
|
//# sourceMappingURL=bundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/fonts/bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGpF;;;;GAIG;AACH,UAAU,YAAY;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;CAC7B;AACD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,MAAM,CAAC;AAChD,KAAK,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAEzC,kEAAkE;AAClE,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,SAAS,UAAU,EAAE,GACjC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAS3B;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,WAAW,GAChB,IAAI,CA4BN;AAED
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/fonts/bundle.ts"],"names":[],"m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@@ -5,25 +5,63 @@
|
|
|
5
5
|
* `size-adjust`, `ascent-override`, `descent-override`, and
|
|
6
6
|
* `line-gap-override` to match custom font metrics and eliminate CLS.
|
|
7
7
|
*
|
|
8
|
+
* Google fonts use the precomputed `FALLBACK_METRICS` table below. Local
|
|
9
|
+
* fonts compute their faces from the font file (`local-fallback.ts`); both
|
|
10
|
+
* paths produce `FallbackFace` values serialized by `generateFallbackFaceCss`.
|
|
11
|
+
*
|
|
8
12
|
* Design doc: 24-fonts.md §"Step 4: Size-Adjusted Fallbacks"
|
|
9
13
|
*/
|
|
10
|
-
|
|
14
|
+
import type { FontCategory } from './font-metrics.ts';
|
|
15
|
+
/** Guess a family's generic category from its name alone. */
|
|
16
|
+
export declare function getGenericFamily(family: string): FontCategory;
|
|
11
17
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* This produces a complete @font-face block with override descriptors
|
|
15
|
-
* that FontFaceDescriptor doesn't natively support.
|
|
18
|
+
* One size-adjusted fallback `@font-face`. Percentages are final CSS values
|
|
19
|
+
* (e.g. `107.64` → `size-adjust: 107.64%`).
|
|
16
20
|
*/
|
|
17
|
-
export
|
|
21
|
+
export interface FallbackFace {
|
|
22
|
+
/** `'<Family> Fallback'`. */
|
|
23
|
+
family: string;
|
|
24
|
+
/** System fonts tried in order, as `local()` sources. */
|
|
25
|
+
local: string[];
|
|
26
|
+
/** `font-weight` descriptor. Omitted for the regular face (defaults to normal). */
|
|
27
|
+
weight?: string;
|
|
28
|
+
sizeAdjust: number;
|
|
29
|
+
ascentOverride: number;
|
|
30
|
+
descentOverride: number;
|
|
31
|
+
lineGapOverride: number;
|
|
32
|
+
}
|
|
33
|
+
/** The fallback family name for `family`. */
|
|
34
|
+
export declare function fallbackFamilyName(family: string): string;
|
|
35
|
+
/** Serialize a fallback face to an `@font-face` rule. */
|
|
36
|
+
export declare function generateFallbackFaceCss(face: FallbackFace): string;
|
|
18
37
|
/**
|
|
19
|
-
*
|
|
38
|
+
* The fallback faces for a Google font, from the precomputed table. Empty
|
|
39
|
+
* when the family isn't in the table.
|
|
20
40
|
*/
|
|
41
|
+
export declare function googleFallbackFaces(family: string): FallbackFace[];
|
|
42
|
+
/** Check whether the Google fallback table has metrics for a family. */
|
|
21
43
|
export declare function hasFallbackMetrics(family: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Generate the fallback `@font-face` CSS for a Google font, or `null` when
|
|
46
|
+
* the family isn't in the table.
|
|
47
|
+
*/
|
|
48
|
+
export declare function generateFallbackCss(family: string): string | null;
|
|
49
|
+
export interface FontStackOptions {
|
|
50
|
+
/** Generic family. Defaults to the name heuristic (`getGenericFamily`). */
|
|
51
|
+
generic?: FontCategory;
|
|
52
|
+
/** Whether a `'<Family> Fallback'` face exists. Defaults to the Google table. */
|
|
53
|
+
hasFallbackFace?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Replaces the default generic tail (`system-ui, sans-serif`, etc.) —
|
|
56
|
+
* the `fallback` option of `next/font`. Entries are emitted verbatim.
|
|
57
|
+
*/
|
|
58
|
+
fallback?: string[];
|
|
59
|
+
}
|
|
22
60
|
/**
|
|
23
61
|
* Build the full font stack string for a font, including its
|
|
24
62
|
* size-adjusted fallback and a generic family.
|
|
25
63
|
*
|
|
26
64
|
* Example: `'Inter', 'Inter Fallback', system-ui, sans-serif`
|
|
27
65
|
*/
|
|
28
|
-
export declare function buildFontStack(family: string): string;
|
|
66
|
+
export declare function buildFontStack(family: string, options?: FontStackOptions): string;
|
|
29
67
|
//# sourceMappingURL=fallbacks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallbacks.d.ts","sourceRoot":"","sources":["../../src/fonts/fallbacks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fallbacks.d.ts","sourceRoot":"","sources":["../../src/fonts/fallbacks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,M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TTF / OTF / WOFF / WOFF2).
|
|
4
|
+
*
|
|
5
|
+
* Fields read:
|
|
6
|
+
*
|
|
7
|
+
* - `head.unitsPerEm`
|
|
8
|
+
* - ascent / descent / lineGap — from `hhea`, or from `OS/2` sTypo* when
|
|
9
|
+
* `fsSelection` bit 7 (USE_TYPO_METRICS) is set, which is what browsers
|
|
10
|
+
* do with such fonts
|
|
11
|
+
* - `OS/2.xAvgCharWidth`, and the advance widths of a letter-frequency
|
|
12
|
+
* weighted Latin sample (`cmap` → glyph id → `hmtx`), the same sample
|
|
13
|
+
* Next.js's `adjustFontFallback` and capsize use
|
|
14
|
+
* - whether the font is monospace: `post.isFixedPitch`, `OS/2` PANOSE
|
|
15
|
+
* proportion = monospaced, or every sampled glyph sharing one advance
|
|
16
|
+
* - whether it is serif or sans, from PANOSE / IBM font class, when the
|
|
17
|
+
* font declares it
|
|
18
|
+
*
|
|
19
|
+
* Design doc: 24-fonts.md §"Step 4: Size-Adjusted Fallbacks"
|
|
20
|
+
*/
|
|
21
|
+
/** The generic CSS family a font belongs to. */
|
|
22
|
+
export type FontCategory = 'sans-serif' | 'serif' | 'monospace';
|
|
23
|
+
export interface FontMetrics {
|
|
24
|
+
unitsPerEm: number;
|
|
25
|
+
/** Positive, in font units. */
|
|
26
|
+
ascent: number;
|
|
27
|
+
/** Positive (distance below the baseline), in font units. */
|
|
28
|
+
descent: number;
|
|
29
|
+
lineGap: number;
|
|
30
|
+
/** `OS/2.xAvgCharWidth`, or `undefined` when the table is absent / zero. */
|
|
31
|
+
xAvgCharWidth?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Mean advance of `AVG_WIDTH_SAMPLE` in font units, or `undefined` when
|
|
34
|
+
* the font lacks a sampled character or its `hmtx` is unreadable.
|
|
35
|
+
*/
|
|
36
|
+
sampleAvgWidth?: number;
|
|
37
|
+
/** True for fixed-pitch fonts. */
|
|
38
|
+
monospace: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* `serif` / `sans-serif` when the font's PANOSE or IBM class says so;
|
|
41
|
+
* `undefined` when it does not (caller falls back to a name heuristic).
|
|
42
|
+
*/
|
|
43
|
+
declaredCategory?: 'serif' | 'sans-serif';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Letter-frequency weighted Latin sample, with spaces for word length.
|
|
47
|
+
* Identical to Next.js's `calcAverageWidth` (packages/font/src/local/
|
|
48
|
+
* get-fallback-metrics-from-font-file.ts) so the reference widths of the
|
|
49
|
+
* fallback bases are comparable.
|
|
50
|
+
*/
|
|
51
|
+
export declare const AVG_WIDTH_SAMPLE = "aaabcdeeeefghiijklmnnoopqrrssttuvwxyz ";
|
|
52
|
+
/** Parse metrics from font bytes. `null` when the file can't be read. */
|
|
53
|
+
export declare function readFontMetrics(data: Uint8Array): FontMetrics | null;
|
|
54
|
+
//# sourceMappingURL=font-metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-metrics.d.ts","sourceRoot":"","sources":["../../src/fonts/font-metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,gDAAgD;AAChD,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,OAAO,GAAG,WAAW,CAAC;AAEhE,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,YAAY,CAAC;CAC3C;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,gDAAgD,CAAC;AAO9E,yEAAyE;AACzE,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,IAAI,CAmEpE"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Size-adjusted fallbacks for local fonts, computed from the font files.
|
|
3
|
+
*
|
|
4
|
+
* Google fonts ship with a precomputed metrics table (`fallbacks.ts`); a
|
|
5
|
+
* local font can be anything, so its metrics are read from the font file
|
|
6
|
+
* itself (`font-metrics.ts`) when the transform registers it — at build
|
|
7
|
+
* time in production, on first transform in dev.
|
|
8
|
+
*
|
|
9
|
+
* From those metrics this module decides:
|
|
10
|
+
*
|
|
11
|
+
* 1. The generic family. Fixed-pitch fonts are `monospace`; otherwise the
|
|
12
|
+
* font's own PANOSE / IBM class, otherwise the family-name heuristic.
|
|
13
|
+
* `adjustFontFallback: 'Arial' | 'Times New Roman' | 'monospace'`
|
|
14
|
+
* overrides it.
|
|
15
|
+
* 2. The fallback base: Arial (sans), Times New Roman (serif), or a list
|
|
16
|
+
* of ~0.600em monospace system fonts (mono). Each base lists
|
|
17
|
+
* metric-compatible Linux equivalents as later `local()` sources.
|
|
18
|
+
* 3. The overrides, computed the way Next.js's `adjustFontFallback` does:
|
|
19
|
+
* `size-adjust` = font average width / base average width, then each
|
|
20
|
+
* vertical metric divided by `unitsPerEm × size-adjust` (the overrides
|
|
21
|
+
* apply to the *adjusted* size).
|
|
22
|
+
*
|
|
23
|
+
* A bold (700) face is emitted when the font has its own 700 source, using
|
|
24
|
+
* the base's bold system font and the bold file's metrics. Without it the
|
|
25
|
+
* browser would synthesize bold from the regular fallback, which changes
|
|
26
|
+
* glyph widths and re-wraps text on swap.
|
|
27
|
+
*
|
|
28
|
+
* Design doc: 24-fonts.md §"Step 4: Size-Adjusted Fallbacks"
|
|
29
|
+
*/
|
|
30
|
+
import type { LocalFontSrc } from './types.ts';
|
|
31
|
+
import { type FontCategory, type FontMetrics } from './font-metrics.ts';
|
|
32
|
+
import { type FallbackFace } from './fallbacks.ts';
|
|
33
|
+
/** `next/font/local`'s `adjustFontFallback` option. */
|
|
34
|
+
export type AdjustFontFallback = boolean | 'Arial' | 'Times New Roman' | 'monospace';
|
|
35
|
+
/** A system font's reference metrics, measured from the font file. */
|
|
36
|
+
interface BaseFace {
|
|
37
|
+
local: string[];
|
|
38
|
+
unitsPerEm: number;
|
|
39
|
+
/** Mean advance of `AVG_WIDTH_SAMPLE` (font-metrics.ts). */
|
|
40
|
+
sampleAvgWidth: number;
|
|
41
|
+
/** `OS/2.xAvgCharWidth`, for fonts whose sample can't be measured. */
|
|
42
|
+
xAvgCharWidth: number;
|
|
43
|
+
}
|
|
44
|
+
/** What a local font's stack and fallback CSS are built from. */
|
|
45
|
+
export interface LocalFallback {
|
|
46
|
+
generic: FontCategory;
|
|
47
|
+
faces: FallbackFace[];
|
|
48
|
+
}
|
|
49
|
+
/** Read a font file's metrics, or `null` when it is missing or unreadable. */
|
|
50
|
+
export declare function readFontFileMetrics(path: string): FontMetrics | null;
|
|
51
|
+
/** The source fallback metrics come from: 400 normal, else the first. */
|
|
52
|
+
export declare function pickRegularSource(sources: LocalFontSrc[]): LocalFontSrc | undefined;
|
|
53
|
+
/** Compute one fallback face from a font's metrics against a base face. */
|
|
54
|
+
export declare function computeFallbackFace(family: string, metrics: FontMetrics, base: BaseFace, weight?: string): FallbackFace;
|
|
55
|
+
/**
|
|
56
|
+
* Work out a local font's generic family and fallback faces.
|
|
57
|
+
*
|
|
58
|
+
* `sources` must already be resolved to absolute paths. Missing or
|
|
59
|
+
* unreadable files produce no faces (the stack then skips the fallback
|
|
60
|
+
* family) and the name heuristic for the generic family.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveLocalFallback(family: string, sources: LocalFontSrc[], adjust?: AdjustFontFallback): LocalFallback;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=local-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-fallback.d.ts","sourceRoot":"","s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ot":"","sources":["../../src/fonts/local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/fonts/local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAMnG;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAgBxD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,YAAY,EAAE,CASzE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,YAAY,EAAE,GACtB,YAAY,EAAE,CAMhB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAYlE;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,YAAY,EAAE,EACvB,OAAO,EAAE,MAAM,EACf,SAAS,SAAkB,GAC1B,kBAAkB,EAAE,CAYtB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,GAAG,aAAa,CAqC7F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAEjF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal font-container reader: TrueType/OpenType (sfnt), WOFF and WOFF2.
|
|
3
|
+
*
|
|
4
|
+
* Returns the raw bytes of the requested tables so `font-metrics.ts` can
|
|
5
|
+
* read the handful of fields the fallback generator needs. This is
|
|
6
|
+
* deliberately not a font parser — it only undoes the container:
|
|
7
|
+
*
|
|
8
|
+
* - sfnt (`\0\1\0\0`, `true`, `OTTO`): tables are stored as-is.
|
|
9
|
+
* - WOFF (`wOFF`): each table is zlib-compressed independently.
|
|
10
|
+
* - WOFF2 (`wOF2`): all tables are concatenated into one Brotli stream.
|
|
11
|
+
* WOFF2 may *transform* `glyf`, `loca` and `hmtx`; a transformed table is
|
|
12
|
+
* not in sfnt layout, so it is reported as missing rather than misread.
|
|
13
|
+
* `head`, `hhea`, `OS/2`, `post` and `cmap` are never transformed.
|
|
14
|
+
*
|
|
15
|
+
* Both decompressors come from `node:zlib`, so no dependency is needed.
|
|
16
|
+
* Font collections (`ttcf`) are not supported — they are not web fonts.
|
|
17
|
+
*
|
|
18
|
+
* Every read is bounds-checked: a truncated or non-font file yields `null`,
|
|
19
|
+
* never a throw, because the caller's fallback is simply "no metrics".
|
|
20
|
+
*
|
|
21
|
+
* Design doc: 24-fonts.md §"Step 4: Size-Adjusted Fallbacks"
|
|
22
|
+
*/
|
|
23
|
+
/** Table tag → that table's uncompressed bytes. */
|
|
24
|
+
export type SfntTables = Map<string, DataView>;
|
|
25
|
+
/**
|
|
26
|
+
* Read the requested tables out of a font file. Returns `null` when the
|
|
27
|
+
* bytes are not a supported font container or are truncated.
|
|
28
|
+
*/
|
|
29
|
+
export declare function readSfntTables(data: Uint8Array, wanted: readonly string[]): SfntTables | null;
|
|
30
|
+
//# sourceMappingURL=sfnt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sfnt.d.ts","sourceRoot":"","sources":["../../src/fonts/sfnt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqB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B,CAC/B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,SAAS,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAA;CAAE,GAAG,IAAI,CAyJtE"}
|
package/dist/fonts/types.d.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* Design doc: 24-fonts.md
|
|
8
8
|
*/
|
|
9
9
|
import type { CachedFont } from './google.ts';
|
|
10
|
+
import type { FallbackFace } from './fallbacks.ts';
|
|
11
|
+
import type { AdjustFontFallback } from './local-fallback.ts';
|
|
10
12
|
/** Configuration passed to a Google font function (e.g. `Inter({ ... })`). */
|
|
11
13
|
export interface GoogleFontConfig {
|
|
12
14
|
weight?: string | string[];
|
|
@@ -31,6 +33,25 @@ export interface LocalFontConfig {
|
|
|
31
33
|
variable?: string;
|
|
32
34
|
/** Override the font family name. Defaults to a generated name. */
|
|
33
35
|
family?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Preload the font's upright (`font-style: normal`) files on every route
|
|
38
|
+
* whose layout or page imports it, directly or through another module.
|
|
39
|
+
* Defaults to `true`.
|
|
40
|
+
*/
|
|
41
|
+
preload?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Size-adjusted fallback, as in `next/font/local`. `true` (the default)
|
|
44
|
+
* measures the font file and picks the base from its metrics; `false`
|
|
45
|
+
* emits no `'<Family> Fallback'` face; a font name forces that base (and
|
|
46
|
+
* its generic family): `'Arial'` → sans-serif, `'Times New Roman'` →
|
|
47
|
+
* serif, `'monospace'` → a list of ~0.600em monospace system fonts.
|
|
48
|
+
*/
|
|
49
|
+
adjustFontFallback?: AdjustFontFallback;
|
|
50
|
+
/**
|
|
51
|
+
* Font families after `'<Family> Fallback'` in the stack, replacing the
|
|
52
|
+
* default generic tail (e.g. `['ui-monospace', 'monospace']`).
|
|
53
|
+
*/
|
|
54
|
+
fallback?: string[];
|
|
34
55
|
}
|
|
35
56
|
/**
|
|
36
57
|
* The return value of a font function call.
|
|
@@ -82,6 +103,14 @@ export interface ExtractedFont {
|
|
|
82
103
|
className: string;
|
|
83
104
|
/** Full font stack including fallback. */
|
|
84
105
|
fontFamily: string;
|
|
106
|
+
/**
|
|
107
|
+
* Size-adjusted fallback faces measured from a local font's files.
|
|
108
|
+
* Google fonts leave this unset — their faces come from the precomputed
|
|
109
|
+
* table in `fallbacks.ts`, keyed by family.
|
|
110
|
+
*/
|
|
111
|
+
fallbackFaces?: FallbackFace[];
|
|
112
|
+
/** Whether the font's files are preloaded. Defaults to `true`. */
|
|
113
|
+
preload?: boolean;
|
|
85
114
|
}
|
|
86
115
|
/**
|
|
87
116
|
* A single @font-face declaration's data (before CSS serialization).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/fonts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/fonts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAA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