@remotion/google-fonts 4.0.384 → 4.0.385

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.
@@ -0,0 +1,137 @@
1
+ // src/base.ts
2
+ import { continueRender, delayRender } from "remotion";
3
+ import { NoReactInternals } from "remotion/no-react";
4
+ var loadedFonts = {};
5
+ var withResolvers = function() {
6
+ let resolve;
7
+ let reject;
8
+ const promise = new Promise((res, rej) => {
9
+ resolve = res;
10
+ reject = rej;
11
+ });
12
+ return { promise, resolve, reject };
13
+ };
14
+ var loadFontFaceOrTimeoutAfter20Seconds = (fontFace) => {
15
+ const timeout = withResolvers();
16
+ const int = setTimeout(() => {
17
+ timeout.reject(new Error("Timed out loading Google Font"));
18
+ }, 18000);
19
+ return Promise.race([
20
+ fontFace.load().then(() => {
21
+ clearTimeout(int);
22
+ }),
23
+ timeout.promise
24
+ ]);
25
+ };
26
+ var loadFonts = (meta, style, options) => {
27
+ const weightsAndSubsetsAreSpecified = Array.isArray(options?.weights) && Array.isArray(options?.subsets) && options.weights.length > 0 && options.subsets.length > 0;
28
+ if (NoReactInternals.ENABLE_V5_BREAKING_CHANGES && !weightsAndSubsetsAreSpecified) {
29
+ throw new Error("Loading Google Fonts without specifying weights and subsets is not supported in Remotion v5. Please specify the weights and subsets you need.");
30
+ }
31
+ const promises = [];
32
+ const styles = style ? [style] : Object.keys(meta.fonts);
33
+ let fontsLoaded = 0;
34
+ for (const style2 of styles) {
35
+ if (typeof FontFace === "undefined") {
36
+ continue;
37
+ }
38
+ if (!meta.fonts[style2]) {
39
+ throw new Error(`The font ${meta.fontFamily} does not have a style ${style2}`);
40
+ }
41
+ const weights = options?.weights ?? Object.keys(meta.fonts[style2]);
42
+ for (const weight of weights) {
43
+ if (!meta.fonts[style2][weight]) {
44
+ throw new Error(`The font ${meta.fontFamily} does not have a weight ${weight} in style ${style2}`);
45
+ }
46
+ const subsets = options?.subsets ?? Object.keys(meta.fonts[style2][weight]);
47
+ for (const subset of subsets) {
48
+ let font = meta.fonts[style2]?.[weight]?.[subset];
49
+ if (!font) {
50
+ throw new Error(`weight: ${weight} subset: ${subset} is not available for '${meta.fontFamily}'`);
51
+ }
52
+ let fontKey = `${meta.fontFamily}-${style2}-${weight}-${subset}`;
53
+ const previousPromise = loadedFonts[fontKey];
54
+ if (previousPromise) {
55
+ promises.push(previousPromise);
56
+ continue;
57
+ }
58
+ const baseLabel = `Fetching ${meta.fontFamily} font ${JSON.stringify({
59
+ style: style2,
60
+ weight,
61
+ subset
62
+ })}`;
63
+ const label = weightsAndSubsetsAreSpecified ? baseLabel : `${baseLabel}. This might be caused by loading too many font variations. Read more: https://www.remotion.dev/docs/troubleshooting/font-loading-errors#render-timeout-when-loading-google-fonts`;
64
+ const handle = delayRender(label, { timeoutInMilliseconds: 60000 });
65
+ fontsLoaded++;
66
+ const fontFace = new FontFace(meta.fontFamily, `url(${font}) format('woff2')`, {
67
+ weight,
68
+ style: style2,
69
+ unicodeRange: meta.unicodeRanges[subset]
70
+ });
71
+ let attempts = 2;
72
+ const tryToLoad = () => {
73
+ if (fontFace.status === "loaded") {
74
+ continueRender(handle);
75
+ return;
76
+ }
77
+ const promise = loadFontFaceOrTimeoutAfter20Seconds(fontFace).then(() => {
78
+ (options?.document ?? document).fonts.add(fontFace);
79
+ continueRender(handle);
80
+ }).catch((err) => {
81
+ loadedFonts[fontKey] = undefined;
82
+ if (attempts === 0) {
83
+ throw err;
84
+ } else {
85
+ attempts--;
86
+ tryToLoad();
87
+ }
88
+ });
89
+ loadedFonts[fontKey] = promise;
90
+ promises.push(promise);
91
+ };
92
+ tryToLoad();
93
+ }
94
+ }
95
+ if (fontsLoaded > 20) {
96
+ console.warn(`Made ${fontsLoaded} network requests to load fonts for ${meta.fontFamily}. Consider loading fewer weights and subsets by passing options to loadFont(). Disable this warning by passing "ignoreTooManyRequestsWarning: true" to "options".`);
97
+ }
98
+ }
99
+ return {
100
+ fontFamily: meta.fontFamily,
101
+ fonts: meta.fonts,
102
+ unicodeRanges: meta.unicodeRanges,
103
+ waitUntilDone: () => Promise.all(promises).then(() => {
104
+ return;
105
+ })
106
+ };
107
+ };
108
+
109
+ // src/Sekuya.ts
110
+ var getInfo = () => ({
111
+ fontFamily: "Sekuya",
112
+ importName: "Sekuya",
113
+ version: "v1",
114
+ url: "https://fonts.googleapis.com/css2?family=Sekuya:ital,wght@0,400",
115
+ unicodeRanges: {
116
+ "latin-ext": "U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF",
117
+ latin: "U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD"
118
+ },
119
+ fonts: {
120
+ normal: {
121
+ "400": {
122
+ "latin-ext": "https://fonts.gstatic.com/s/sekuya/v1/fdN_9suEu39Dg3wU0yBerF8.woff2",
123
+ latin: "https://fonts.gstatic.com/s/sekuya/v1/fdN_9suEu39Dg3wU3SBe.woff2"
124
+ }
125
+ }
126
+ },
127
+ subsets: ["latin", "latin-ext"]
128
+ });
129
+ var fontFamily = "Sekuya";
130
+ var loadFont = (style, options) => {
131
+ return loadFonts(getInfo(), style, options);
132
+ };
133
+ export {
134
+ loadFont,
135
+ getInfo,
136
+ fontFamily
137
+ };
@@ -299,6 +299,11 @@ export const getAvailableFonts = () => [
299
299
  importName: 'Amaranth',
300
300
  load: () => import('./Amaranth.mjs'),
301
301
  },
302
+ {
303
+ fontFamily: 'Amarna',
304
+ importName: 'Amarna',
305
+ load: () => import('./Amarna.mjs'),
306
+ },
302
307
  {
303
308
  fontFamily: 'Amatic SC',
304
309
  importName: 'AmaticSC',
@@ -704,6 +709,21 @@ export const getAvailableFonts = () => [
704
709
  importName: 'B612Mono',
705
710
  load: () => import('./B612Mono.mjs'),
706
711
  },
712
+ {
713
+ fontFamily: 'BBH Bartle',
714
+ importName: 'BBHBartle',
715
+ load: () => import('./BBHBartle.mjs'),
716
+ },
717
+ {
718
+ fontFamily: 'BBH Bogle',
719
+ importName: 'BBHBogle',
720
+ load: () => import('./BBHBogle.mjs'),
721
+ },
722
+ {
723
+ fontFamily: 'BBH Hegarty',
724
+ importName: 'BBHHegarty',
725
+ load: () => import('./BBHHegarty.mjs'),
726
+ },
707
727
  {
708
728
  fontFamily: 'BIZ UDGothic',
709
729
  importName: 'BIZUDGothic',
@@ -1479,6 +1499,11 @@ export const getAvailableFonts = () => [
1479
1499
  importName: 'Caudex',
1480
1500
  load: () => import('./Caudex.mjs'),
1481
1501
  },
1502
+ {
1503
+ fontFamily: 'Cause',
1504
+ importName: 'Cause',
1505
+ load: () => import('./Cause.mjs'),
1506
+ },
1482
1507
  {
1483
1508
  fontFamily: 'Caveat',
1484
1509
  importName: 'Caveat',
@@ -2749,6 +2774,11 @@ export const getAvailableFonts = () => [
2749
2774
  importName: 'Geologica',
2750
2775
  load: () => import('./Geologica.mjs'),
2751
2776
  },
2777
+ {
2778
+ fontFamily: 'Geom',
2779
+ importName: 'Geom',
2780
+ load: () => import('./Geom.mjs'),
2781
+ },
2752
2782
  {
2753
2783
  fontFamily: 'Georama',
2754
2784
  importName: 'Georama',
@@ -2849,6 +2879,11 @@ export const getAvailableFonts = () => [
2849
2879
  importName: 'GolosText',
2850
2880
  load: () => import('./GolosText.mjs'),
2851
2881
  },
2882
+ {
2883
+ fontFamily: 'Google Sans',
2884
+ importName: 'GoogleSans',
2885
+ load: () => import('./GoogleSans.mjs'),
2886
+ },
2852
2887
  {
2853
2888
  fontFamily: 'Google Sans Code',
2854
2889
  importName: 'GoogleSansCode',
@@ -4159,6 +4194,11 @@ export const getAvailableFonts = () => [
4159
4194
  importName: 'LifeSavers',
4160
4195
  load: () => import('./LifeSavers.mjs'),
4161
4196
  },
4197
+ {
4198
+ fontFamily: 'Lilex',
4199
+ importName: 'Lilex',
4200
+ load: () => import('./Lilex.mjs'),
4201
+ },
4162
4202
  {
4163
4203
  fontFamily: 'Lilita One',
4164
4204
  importName: 'LilitaOne',
@@ -7555,6 +7595,11 @@ export const getAvailableFonts = () => [
7555
7595
  importName: 'SedgwickAveDisplay',
7556
7596
  load: () => import('./SedgwickAveDisplay.mjs'),
7557
7597
  },
7598
+ {
7599
+ fontFamily: 'Sekuya',
7600
+ importName: 'Sekuya',
7601
+ load: () => import('./Sekuya.mjs'),
7602
+ },
7558
7603
  {
7559
7604
  fontFamily: 'Sen',
7560
7605
  importName: 'Sen',
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/google-fonts"
4
4
  },
5
5
  "name": "@remotion/google-fonts",
6
- "version": "4.0.384",
6
+ "version": "4.0.385",
7
7
  "description": "Use Google Fonts in Remotion",
8
8
  "main": "dist/cjs/index.js",
9
9
  "module": "dist/esm/index.mjs",
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "license": "SEE LICENSE IN LICENSE.md",
16
16
  "dependencies": {
17
- "remotion": "4.0.384"
17
+ "remotion": "4.0.385"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@types/css-font-loading-module": "0.0.14",
@@ -25,9 +25,6 @@
25
25
  "types": "dist/cjs/index.d.ts",
26
26
  "typesVersions": {
27
27
  ">=1.0": {
28
- "from-info": [
29
- "./dist/cjs/from-info.d.ts"
30
- ],
31
28
  "ABeeZee": [
32
29
  "dist/cjs/ABeeZee.d.ts"
33
30
  ],
@@ -208,6 +205,9 @@
208
205
  "Amaranth": [
209
206
  "dist/cjs/Amaranth.d.ts"
210
207
  ],
208
+ "Amarna": [
209
+ "dist/cjs/Amarna.d.ts"
210
+ ],
211
211
  "AmaticSC": [
212
212
  "dist/cjs/AmaticSC.d.ts"
213
213
  ],
@@ -451,6 +451,15 @@
451
451
  "B612Mono": [
452
452
  "dist/cjs/B612Mono.d.ts"
453
453
  ],
454
+ "BBHBartle": [
455
+ "dist/cjs/BBHBartle.d.ts"
456
+ ],
457
+ "BBHBogle": [
458
+ "dist/cjs/BBHBogle.d.ts"
459
+ ],
460
+ "BBHHegarty": [
461
+ "dist/cjs/BBHHegarty.d.ts"
462
+ ],
454
463
  "BIZUDGothic": [
455
464
  "dist/cjs/BIZUDGothic.d.ts"
456
465
  ],
@@ -916,6 +925,9 @@
916
925
  "Caudex": [
917
926
  "dist/cjs/Caudex.d.ts"
918
927
  ],
928
+ "Cause": [
929
+ "dist/cjs/Cause.d.ts"
930
+ ],
919
931
  "Caveat": [
920
932
  "dist/cjs/Caveat.d.ts"
921
933
  ],
@@ -1678,6 +1690,9 @@
1678
1690
  "Geologica": [
1679
1691
  "dist/cjs/Geologica.d.ts"
1680
1692
  ],
1693
+ "Geom": [
1694
+ "dist/cjs/Geom.d.ts"
1695
+ ],
1681
1696
  "Georama": [
1682
1697
  "dist/cjs/Georama.d.ts"
1683
1698
  ],
@@ -1738,6 +1753,9 @@
1738
1753
  "GolosText": [
1739
1754
  "dist/cjs/GolosText.d.ts"
1740
1755
  ],
1756
+ "GoogleSans": [
1757
+ "dist/cjs/GoogleSans.d.ts"
1758
+ ],
1741
1759
  "GoogleSansCode": [
1742
1760
  "dist/cjs/GoogleSansCode.d.ts"
1743
1761
  ],
@@ -2524,6 +2542,9 @@
2524
2542
  "LifeSavers": [
2525
2543
  "dist/cjs/LifeSavers.d.ts"
2526
2544
  ],
2545
+ "Lilex": [
2546
+ "dist/cjs/Lilex.d.ts"
2547
+ ],
2527
2548
  "LilitaOne": [
2528
2549
  "dist/cjs/LilitaOne.d.ts"
2529
2550
  ],
@@ -4561,6 +4582,9 @@
4561
4582
  "SedgwickAveDisplay": [
4562
4583
  "dist/cjs/SedgwickAveDisplay.d.ts"
4563
4584
  ],
4585
+ "Sekuya": [
4586
+ "dist/cjs/Sekuya.d.ts"
4587
+ ],
4564
4588
  "Sen": [
4565
4589
  "dist/cjs/Sen.d.ts"
4566
4590
  ],
@@ -5409,6 +5433,9 @@
5409
5433
  ],
5410
5434
  "ZillaSlabHighlight": [
5411
5435
  "dist/cjs/ZillaSlabHighlight.d.ts"
5436
+ ],
5437
+ "from-info": [
5438
+ "./dist/cjs/from-info.d.ts"
5412
5439
  ]
5413
5440
  }
5414
5441
  },