@remotion/google-fonts 4.0.320 → 4.0.322

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,40 @@
1
+ export declare const getInfo: () => {
2
+ fontFamily: string;
3
+ importName: string;
4
+ version: string;
5
+ url: string;
6
+ unicodeRanges: {
7
+ sunuwar: string;
8
+ 'latin-ext': string;
9
+ latin: string;
10
+ };
11
+ fonts: {
12
+ normal: {
13
+ '400': {
14
+ sunuwar: string;
15
+ 'latin-ext': string;
16
+ latin: string;
17
+ };
18
+ };
19
+ };
20
+ subsets: string[];
21
+ };
22
+ export declare const fontFamily: "Noto Sans Sunuwar";
23
+ type Variants = {
24
+ normal: {
25
+ weights: '400';
26
+ subsets: 'latin' | 'latin-ext' | 'sunuwar';
27
+ };
28
+ };
29
+ export declare const loadFont: <T extends keyof Variants>(style?: T, options?: {
30
+ weights?: Variants[T]["weights"][];
31
+ subsets?: Variants[T]["subsets"][];
32
+ document?: Document;
33
+ ignoreTooManyRequestsWarning?: boolean;
34
+ }) => {
35
+ fontFamily: import("./base").FontInfo["fontFamily"];
36
+ fonts: import("./base").FontInfo["fonts"];
37
+ unicodeRanges: import("./base").FontInfo["unicodeRanges"];
38
+ waitUntilDone: () => Promise<undefined>;
39
+ };
40
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadFont = exports.fontFamily = exports.getInfo = void 0;
4
+ const base_1 = require("./base");
5
+ const getInfo = () => ({
6
+ fontFamily: 'Noto Sans Sunuwar',
7
+ importName: 'NotoSansSunuwar',
8
+ version: 'v1',
9
+ url: 'https://fonts.googleapis.com/css2?family=Noto+Sans+Sunuwar:ital,wght@0,400',
10
+ unicodeRanges: {
11
+ sunuwar: 'U+0300-0301, U+0303, U+030D, U+0310, U+032D, U+0331, U+11BC0-11BE1, U+11BF0-11BF9',
12
+ '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',
13
+ 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',
14
+ },
15
+ fonts: {
16
+ normal: {
17
+ '400': {
18
+ sunuwar: 'https://fonts.gstatic.com/s/notosanssunuwar/v1/FwZB7_04xUkosG2xJo2gm7nF0DTfhr95kEKpA6A.woff2',
19
+ 'latin-ext': 'https://fonts.gstatic.com/s/notosanssunuwar/v1/FwZB7_04xUkosG2xJo2gm7nF0DTfhr_KsWeUOg.woff2',
20
+ latin: 'https://fonts.gstatic.com/s/notosanssunuwar/v1/FwZB7_04xUkosG2xJo2gm7nF0DTfhr_EsWc.woff2',
21
+ },
22
+ },
23
+ },
24
+ subsets: ['latin', 'latin-ext', 'sunuwar'],
25
+ });
26
+ exports.getInfo = getInfo;
27
+ exports.fontFamily = 'Noto Sans Sunuwar';
28
+ const loadFont = (style, options) => {
29
+ return (0, base_1.loadFonts)((0, exports.getInfo)(), style, options);
30
+ };
31
+ exports.loadFont = loadFont;
package/dist/cjs/index.js CHANGED
@@ -5642,6 +5642,11 @@ const getAvailableFonts = () => [
5642
5642
  importName: 'NotoSansSundanese',
5643
5643
  load: () => Promise.resolve().then(() => __importStar(require('./NotoSansSundanese'))),
5644
5644
  },
5645
+ {
5646
+ fontFamily: 'Noto Sans Sunuwar',
5647
+ importName: 'NotoSansSunuwar',
5648
+ load: () => Promise.resolve().then(() => __importStar(require('./NotoSansSunuwar'))),
5649
+ },
5645
5650
  {
5646
5651
  fontFamily: 'Noto Sans Syloti Nagri',
5647
5652
  importName: 'NotoSansSylotiNagri',
@@ -0,0 +1,139 @@
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/NotoSansSunuwar.ts
110
+ var getInfo = () => ({
111
+ fontFamily: "Noto Sans Sunuwar",
112
+ importName: "NotoSansSunuwar",
113
+ version: "v1",
114
+ url: "https://fonts.googleapis.com/css2?family=Noto+Sans+Sunuwar:ital,wght@0,400",
115
+ unicodeRanges: {
116
+ sunuwar: "U+0300-0301, U+0303, U+030D, U+0310, U+032D, U+0331, U+11BC0-11BE1, U+11BF0-11BF9",
117
+ "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",
118
+ 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"
119
+ },
120
+ fonts: {
121
+ normal: {
122
+ "400": {
123
+ sunuwar: "https://fonts.gstatic.com/s/notosanssunuwar/v1/FwZB7_04xUkosG2xJo2gm7nF0DTfhr95kEKpA6A.woff2",
124
+ "latin-ext": "https://fonts.gstatic.com/s/notosanssunuwar/v1/FwZB7_04xUkosG2xJo2gm7nF0DTfhr_KsWeUOg.woff2",
125
+ latin: "https://fonts.gstatic.com/s/notosanssunuwar/v1/FwZB7_04xUkosG2xJo2gm7nF0DTfhr_EsWc.woff2"
126
+ }
127
+ }
128
+ },
129
+ subsets: ["latin", "latin-ext", "sunuwar"]
130
+ });
131
+ var fontFamily = "Noto Sans Sunuwar";
132
+ var loadFont = (style, options) => {
133
+ return loadFonts(getInfo(), style, options);
134
+ };
135
+ export {
136
+ loadFont,
137
+ getInfo,
138
+ fontFamily
139
+ };
@@ -5605,6 +5605,11 @@ export const getAvailableFonts = () => [
5605
5605
  importName: 'NotoSansSundanese',
5606
5606
  load: () => import('./NotoSansSundanese.mjs'),
5607
5607
  },
5608
+ {
5609
+ fontFamily: 'Noto Sans Sunuwar',
5610
+ importName: 'NotoSansSunuwar',
5611
+ load: () => import('./NotoSansSunuwar.mjs'),
5612
+ },
5608
5613
  {
5609
5614
  fontFamily: 'Noto Sans Syloti Nagri',
5610
5615
  importName: 'NotoSansSylotiNagri',