@remotion/google-fonts 4.0.486 → 4.0.488
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/cjs/Geomini.d.ts +62 -0
- package/dist/cjs/Geomini.js +53 -0
- package/dist/cjs/HiburMono.d.ts +40 -0
- package/dist/cjs/HiburMono.js +31 -0
- package/dist/cjs/NotoSerifOldUyghur.js +4 -4
- package/dist/cjs/index.js +10 -0
- package/dist/esm/Geomini.mjs +191 -0
- package/dist/esm/HiburMono.mjs +169 -0
- package/dist/esm/NotoSerifOldUyghur.mjs +4 -4
- package/dist/esm/index.mjs +10 -0
- package/package.json +8 -2
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export declare const getInfo: () => {
|
|
2
|
+
fontFamily: string;
|
|
3
|
+
importName: string;
|
|
4
|
+
version: string;
|
|
5
|
+
url: string;
|
|
6
|
+
unicodeRanges: {
|
|
7
|
+
'latin-ext': string;
|
|
8
|
+
latin: string;
|
|
9
|
+
};
|
|
10
|
+
fonts: {
|
|
11
|
+
normal: {
|
|
12
|
+
'200': {
|
|
13
|
+
'latin-ext': string;
|
|
14
|
+
latin: string;
|
|
15
|
+
};
|
|
16
|
+
'300': {
|
|
17
|
+
'latin-ext': string;
|
|
18
|
+
latin: string;
|
|
19
|
+
};
|
|
20
|
+
'400': {
|
|
21
|
+
'latin-ext': string;
|
|
22
|
+
latin: string;
|
|
23
|
+
};
|
|
24
|
+
'500': {
|
|
25
|
+
'latin-ext': string;
|
|
26
|
+
latin: string;
|
|
27
|
+
};
|
|
28
|
+
'600': {
|
|
29
|
+
'latin-ext': string;
|
|
30
|
+
latin: string;
|
|
31
|
+
};
|
|
32
|
+
'700': {
|
|
33
|
+
'latin-ext': string;
|
|
34
|
+
latin: string;
|
|
35
|
+
};
|
|
36
|
+
'800': {
|
|
37
|
+
'latin-ext': string;
|
|
38
|
+
latin: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
subsets: string[];
|
|
43
|
+
};
|
|
44
|
+
export declare const fontFamily: "Geomini";
|
|
45
|
+
type Variants = {
|
|
46
|
+
normal: {
|
|
47
|
+
weights: '200' | '300' | '400' | '500' | '600' | '700' | '800';
|
|
48
|
+
subsets: 'latin' | 'latin-ext';
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export declare const loadFont: <T extends "normal">(style?: T | undefined, options?: {
|
|
52
|
+
weights?: Variants[T]["weights"][] | undefined;
|
|
53
|
+
subsets?: Variants[T]["subsets"][] | undefined;
|
|
54
|
+
document?: Document | undefined;
|
|
55
|
+
ignoreTooManyRequestsWarning?: boolean | undefined;
|
|
56
|
+
} | undefined) => {
|
|
57
|
+
fontFamily: string;
|
|
58
|
+
fonts: Record<string, Record<string, Record<string, string>>>;
|
|
59
|
+
unicodeRanges: Record<string, string>;
|
|
60
|
+
waitUntilDone: () => Promise<undefined>;
|
|
61
|
+
};
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
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: 'Geomini',
|
|
7
|
+
importName: 'Geomini',
|
|
8
|
+
version: 'v2',
|
|
9
|
+
url: 'https://fonts.googleapis.com/css2?family=Geomini:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800',
|
|
10
|
+
unicodeRanges: {
|
|
11
|
+
'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',
|
|
12
|
+
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',
|
|
13
|
+
},
|
|
14
|
+
fonts: {
|
|
15
|
+
normal: {
|
|
16
|
+
'200': {
|
|
17
|
+
'latin-ext': 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2',
|
|
18
|
+
latin: 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2',
|
|
19
|
+
},
|
|
20
|
+
'300': {
|
|
21
|
+
'latin-ext': 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2',
|
|
22
|
+
latin: 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2',
|
|
23
|
+
},
|
|
24
|
+
'400': {
|
|
25
|
+
'latin-ext': 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2',
|
|
26
|
+
latin: 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2',
|
|
27
|
+
},
|
|
28
|
+
'500': {
|
|
29
|
+
'latin-ext': 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2',
|
|
30
|
+
latin: 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2',
|
|
31
|
+
},
|
|
32
|
+
'600': {
|
|
33
|
+
'latin-ext': 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2',
|
|
34
|
+
latin: 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2',
|
|
35
|
+
},
|
|
36
|
+
'700': {
|
|
37
|
+
'latin-ext': 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2',
|
|
38
|
+
latin: 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2',
|
|
39
|
+
},
|
|
40
|
+
'800': {
|
|
41
|
+
'latin-ext': 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2',
|
|
42
|
+
latin: 'https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
subsets: ['latin', 'latin-ext'],
|
|
47
|
+
});
|
|
48
|
+
exports.getInfo = getInfo;
|
|
49
|
+
exports.fontFamily = 'Geomini';
|
|
50
|
+
const loadFont = (style, options) => {
|
|
51
|
+
return (0, base_1.loadFonts)((0, exports.getInfo)(), style, options);
|
|
52
|
+
};
|
|
53
|
+
exports.loadFont = loadFont;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const getInfo: () => {
|
|
2
|
+
fontFamily: string;
|
|
3
|
+
importName: string;
|
|
4
|
+
version: string;
|
|
5
|
+
url: string;
|
|
6
|
+
unicodeRanges: {
|
|
7
|
+
ethiopic: string;
|
|
8
|
+
'latin-ext': string;
|
|
9
|
+
latin: string;
|
|
10
|
+
};
|
|
11
|
+
fonts: {
|
|
12
|
+
normal: {
|
|
13
|
+
'400': {
|
|
14
|
+
ethiopic: string;
|
|
15
|
+
'latin-ext': string;
|
|
16
|
+
latin: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
subsets: string[];
|
|
21
|
+
};
|
|
22
|
+
export declare const fontFamily: "Hibur Mono";
|
|
23
|
+
type Variants = {
|
|
24
|
+
normal: {
|
|
25
|
+
weights: '400';
|
|
26
|
+
subsets: 'ethiopic' | 'latin' | 'latin-ext';
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare const loadFont: <T extends "normal">(style?: T | undefined, options?: {
|
|
30
|
+
weights?: Variants[T]["weights"][] | undefined;
|
|
31
|
+
subsets?: Variants[T]["subsets"][] | undefined;
|
|
32
|
+
document?: Document | undefined;
|
|
33
|
+
ignoreTooManyRequestsWarning?: boolean | undefined;
|
|
34
|
+
} | undefined) => {
|
|
35
|
+
fontFamily: string;
|
|
36
|
+
fonts: Record<string, Record<string, Record<string, string>>>;
|
|
37
|
+
unicodeRanges: Record<string, string>;
|
|
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: 'Hibur Mono',
|
|
7
|
+
importName: 'HiburMono',
|
|
8
|
+
version: 'v1',
|
|
9
|
+
url: 'https://fonts.googleapis.com/css2?family=Hibur+Mono:ital,wght@0,400',
|
|
10
|
+
unicodeRanges: {
|
|
11
|
+
ethiopic: 'U+030E, U+1200-1399, U+2D80-2DDE, U+AB01-AB2E, U+1E7E0-1E7E6, U+1E7E8-1E7EB, U+1E7ED-1E7EE, U+1E7F0-1E7FE',
|
|
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
|
+
ethiopic: 'https://fonts.gstatic.com/s/hiburmono/v1/R70fjyoFkv6fKPKNWxXXiDy0Ugv4.woff2',
|
|
19
|
+
'latin-ext': 'https://fonts.gstatic.com/s/hiburmono/v1/R70fjyoFkv6fKPKNWxXXiCO0Ugv4.woff2',
|
|
20
|
+
latin: 'https://fonts.gstatic.com/s/hiburmono/v1/R70fjyoFkv6fKPKNWxXXiC20Ug.woff2',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
subsets: ['ethiopic', 'latin', 'latin-ext'],
|
|
25
|
+
});
|
|
26
|
+
exports.getInfo = getInfo;
|
|
27
|
+
exports.fontFamily = 'Hibur Mono';
|
|
28
|
+
const loadFont = (style, options) => {
|
|
29
|
+
return (0, base_1.loadFonts)((0, exports.getInfo)(), style, options);
|
|
30
|
+
};
|
|
31
|
+
exports.loadFont = loadFont;
|
|
@@ -5,7 +5,7 @@ const base_1 = require("./base");
|
|
|
5
5
|
const getInfo = () => ({
|
|
6
6
|
fontFamily: 'Noto Serif Old Uyghur',
|
|
7
7
|
importName: 'NotoSerifOldUyghur',
|
|
8
|
-
version: '
|
|
8
|
+
version: 'v5',
|
|
9
9
|
url: 'https://fonts.googleapis.com/css2?family=Noto+Serif+Old+Uyghur:ital,wght@0,400',
|
|
10
10
|
unicodeRanges: {
|
|
11
11
|
'old-uyghur': 'U+0640, U+10AF2, U+10F70-10F89',
|
|
@@ -15,9 +15,9 @@ const getInfo = () => ({
|
|
|
15
15
|
fonts: {
|
|
16
16
|
normal: {
|
|
17
17
|
'400': {
|
|
18
|
-
'old-uyghur': 'https://fonts.gstatic.com/s/notoserifolduyghur/
|
|
19
|
-
'latin-ext': 'https://fonts.gstatic.com/s/notoserifolduyghur/
|
|
20
|
-
latin: 'https://fonts.gstatic.com/s/notoserifolduyghur/
|
|
18
|
+
'old-uyghur': 'https://fonts.gstatic.com/s/notoserifolduyghur/v5/v6-KGZbLJFKIhClqUYqXDiGnrVoFRCW6JdwXm8K6GlWM.woff2',
|
|
19
|
+
'latin-ext': 'https://fonts.gstatic.com/s/notoserifolduyghur/v5/v6-KGZbLJFKIhClqUYqXDiGnrVoFRCW6JdwXI-OfJ2w.woff2',
|
|
20
|
+
latin: 'https://fonts.gstatic.com/s/notoserifolduyghur/v5/v6-KGZbLJFKIhClqUYqXDiGnrVoFRCW6JdwXLeOf.woff2',
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
},
|
package/dist/cjs/index.js
CHANGED
|
@@ -2877,6 +2877,11 @@ const getAvailableFonts = () => [
|
|
|
2877
2877
|
importName: 'Geom',
|
|
2878
2878
|
load: () => Promise.resolve().then(() => __importStar(require('./Geom'))),
|
|
2879
2879
|
},
|
|
2880
|
+
{
|
|
2881
|
+
fontFamily: 'Geomini',
|
|
2882
|
+
importName: 'Geomini',
|
|
2883
|
+
load: () => Promise.resolve().then(() => __importStar(require('./Geomini'))),
|
|
2884
|
+
},
|
|
2880
2885
|
{
|
|
2881
2886
|
fontFamily: 'Georama',
|
|
2882
2887
|
importName: 'Georama',
|
|
@@ -3227,6 +3232,11 @@ const getAvailableFonts = () => [
|
|
|
3227
3232
|
importName: 'HiMelody',
|
|
3228
3233
|
load: () => Promise.resolve().then(() => __importStar(require('./HiMelody'))),
|
|
3229
3234
|
},
|
|
3235
|
+
{
|
|
3236
|
+
fontFamily: 'Hibur Mono',
|
|
3237
|
+
importName: 'HiburMono',
|
|
3238
|
+
load: () => Promise.resolve().then(() => __importStar(require('./HiburMono'))),
|
|
3239
|
+
},
|
|
3230
3240
|
{
|
|
3231
3241
|
fontFamily: 'Hina Mincho',
|
|
3232
3242
|
importName: 'HinaMincho',
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// src/base.ts
|
|
2
|
+
import { continueRender, delayRender } from "remotion";
|
|
3
|
+
import { NoReactInternals } from "remotion/no-react";
|
|
4
|
+
|
|
5
|
+
// src/resolve-font-subsets.ts
|
|
6
|
+
var isChunkSubset = (subset) => /^\[\d+\]$/.test(subset);
|
|
7
|
+
var compareChunkSubsets = (a, b) => {
|
|
8
|
+
return Number(a.slice(1, -1)) - Number(b.slice(1, -1));
|
|
9
|
+
};
|
|
10
|
+
var resolveFontSubsetKeys = ({
|
|
11
|
+
availableSubsetKeys,
|
|
12
|
+
metaSubsets,
|
|
13
|
+
requestedSubset
|
|
14
|
+
}) => {
|
|
15
|
+
if (availableSubsetKeys.includes(requestedSubset)) {
|
|
16
|
+
return [requestedSubset];
|
|
17
|
+
}
|
|
18
|
+
if (!metaSubsets.includes(requestedSubset)) {
|
|
19
|
+
return [requestedSubset];
|
|
20
|
+
}
|
|
21
|
+
const chunkSubsets = availableSubsetKeys.filter(isChunkSubset).sort(compareChunkSubsets);
|
|
22
|
+
return chunkSubsets.length === 0 ? [requestedSubset] : chunkSubsets;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/base.ts
|
|
26
|
+
var loadedFonts = {};
|
|
27
|
+
var withResolvers = function() {
|
|
28
|
+
let resolve;
|
|
29
|
+
let reject;
|
|
30
|
+
const promise = new Promise((res, rej) => {
|
|
31
|
+
resolve = res;
|
|
32
|
+
reject = rej;
|
|
33
|
+
});
|
|
34
|
+
return { promise, resolve, reject };
|
|
35
|
+
};
|
|
36
|
+
var loadFontFaceOrTimeoutAfter20Seconds = (fontFace) => {
|
|
37
|
+
const timeout = withResolvers();
|
|
38
|
+
const int = setTimeout(() => {
|
|
39
|
+
timeout.reject(new Error("Timed out loading Google Font"));
|
|
40
|
+
}, 18000);
|
|
41
|
+
return Promise.race([
|
|
42
|
+
fontFace.load().then(() => {
|
|
43
|
+
clearTimeout(int);
|
|
44
|
+
}),
|
|
45
|
+
timeout.promise
|
|
46
|
+
]);
|
|
47
|
+
};
|
|
48
|
+
var loadFonts = (meta, style, options) => {
|
|
49
|
+
const weightsAndSubsetsAreSpecified = Array.isArray(options?.weights) && Array.isArray(options?.subsets) && options.weights.length > 0 && options.subsets.length > 0;
|
|
50
|
+
if (NoReactInternals.ENABLE_V5_BREAKING_CHANGES && !weightsAndSubsetsAreSpecified) {
|
|
51
|
+
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.");
|
|
52
|
+
}
|
|
53
|
+
const promises = [];
|
|
54
|
+
const styles = style ? [style] : Object.keys(meta.fonts);
|
|
55
|
+
let fontsLoaded = 0;
|
|
56
|
+
for (const style2 of styles) {
|
|
57
|
+
if (typeof FontFace === "undefined") {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (!meta.fonts[style2]) {
|
|
61
|
+
throw new Error(`The font ${meta.fontFamily} does not have a style ${style2}`);
|
|
62
|
+
}
|
|
63
|
+
const weights = options?.weights ?? Object.keys(meta.fonts[style2]);
|
|
64
|
+
for (const weight of weights) {
|
|
65
|
+
if (!meta.fonts[style2][weight]) {
|
|
66
|
+
throw new Error(`The font ${meta.fontFamily} does not have a weight ${weight} in style ${style2}`);
|
|
67
|
+
}
|
|
68
|
+
const requestedSubsets = options?.subsets ?? Object.keys(meta.fonts[style2][weight]);
|
|
69
|
+
const availableSubsetKeys = Object.keys(meta.fonts[style2][weight]);
|
|
70
|
+
const subsets = [
|
|
71
|
+
...new Set(requestedSubsets.flatMap((requestedSubset) => resolveFontSubsetKeys({
|
|
72
|
+
availableSubsetKeys,
|
|
73
|
+
metaSubsets: meta.subsets,
|
|
74
|
+
requestedSubset
|
|
75
|
+
})))
|
|
76
|
+
];
|
|
77
|
+
for (const subset of subsets) {
|
|
78
|
+
let font = meta.fonts[style2]?.[weight]?.[subset];
|
|
79
|
+
if (!font) {
|
|
80
|
+
throw new Error(`weight: ${weight} subset: ${subset} is not available for '${meta.fontFamily}'`);
|
|
81
|
+
}
|
|
82
|
+
let fontKey = `${meta.fontFamily}-${style2}-${weight}-${subset}`;
|
|
83
|
+
const previousPromise = loadedFonts[fontKey];
|
|
84
|
+
if (previousPromise) {
|
|
85
|
+
promises.push(previousPromise);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const baseLabel = `Fetching ${meta.fontFamily} font ${JSON.stringify({
|
|
89
|
+
style: style2,
|
|
90
|
+
weight,
|
|
91
|
+
subset
|
|
92
|
+
})}`;
|
|
93
|
+
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`;
|
|
94
|
+
const handle = delayRender(label, { timeoutInMilliseconds: 60000 });
|
|
95
|
+
fontsLoaded++;
|
|
96
|
+
const fontFace = new FontFace(meta.fontFamily, `url(${font}) format('woff2')`, {
|
|
97
|
+
weight,
|
|
98
|
+
style: style2,
|
|
99
|
+
unicodeRange: meta.unicodeRanges[subset]
|
|
100
|
+
});
|
|
101
|
+
let attempts = 2;
|
|
102
|
+
const tryToLoad = () => {
|
|
103
|
+
if (fontFace.status === "loaded") {
|
|
104
|
+
continueRender(handle);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const promise = loadFontFaceOrTimeoutAfter20Seconds(fontFace).then(() => {
|
|
108
|
+
(options?.document ?? document).fonts.add(fontFace);
|
|
109
|
+
continueRender(handle);
|
|
110
|
+
}).catch((err) => {
|
|
111
|
+
loadedFonts[fontKey] = undefined;
|
|
112
|
+
if (attempts === 0) {
|
|
113
|
+
throw err;
|
|
114
|
+
} else {
|
|
115
|
+
attempts--;
|
|
116
|
+
tryToLoad();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
loadedFonts[fontKey] = promise;
|
|
120
|
+
promises.push(promise);
|
|
121
|
+
};
|
|
122
|
+
tryToLoad();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (fontsLoaded > 20 && !options?.ignoreTooManyRequestsWarning) {
|
|
126
|
+
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".`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
fontFamily: meta.fontFamily,
|
|
131
|
+
fonts: meta.fonts,
|
|
132
|
+
unicodeRanges: meta.unicodeRanges,
|
|
133
|
+
waitUntilDone: () => Promise.all(promises).then(() => {
|
|
134
|
+
return;
|
|
135
|
+
})
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// src/Geomini.ts
|
|
140
|
+
var getInfo = () => ({
|
|
141
|
+
fontFamily: "Geomini",
|
|
142
|
+
importName: "Geomini",
|
|
143
|
+
version: "v2",
|
|
144
|
+
url: "https://fonts.googleapis.com/css2?family=Geomini:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800",
|
|
145
|
+
unicodeRanges: {
|
|
146
|
+
"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",
|
|
147
|
+
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"
|
|
148
|
+
},
|
|
149
|
+
fonts: {
|
|
150
|
+
normal: {
|
|
151
|
+
"200": {
|
|
152
|
+
"latin-ext": "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2",
|
|
153
|
+
latin: "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2"
|
|
154
|
+
},
|
|
155
|
+
"300": {
|
|
156
|
+
"latin-ext": "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2",
|
|
157
|
+
latin: "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2"
|
|
158
|
+
},
|
|
159
|
+
"400": {
|
|
160
|
+
"latin-ext": "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2",
|
|
161
|
+
latin: "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2"
|
|
162
|
+
},
|
|
163
|
+
"500": {
|
|
164
|
+
"latin-ext": "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2",
|
|
165
|
+
latin: "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2"
|
|
166
|
+
},
|
|
167
|
+
"600": {
|
|
168
|
+
"latin-ext": "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2",
|
|
169
|
+
latin: "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2"
|
|
170
|
+
},
|
|
171
|
+
"700": {
|
|
172
|
+
"latin-ext": "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2",
|
|
173
|
+
latin: "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2"
|
|
174
|
+
},
|
|
175
|
+
"800": {
|
|
176
|
+
"latin-ext": "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szdAud5b.woff2",
|
|
177
|
+
latin: "https://fonts.gstatic.com/s/geomini/v2/Yq6U-L2BVyv2_q37szlAuQ.woff2"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
subsets: ["latin", "latin-ext"]
|
|
182
|
+
});
|
|
183
|
+
var fontFamily = "Geomini";
|
|
184
|
+
var loadFont = (style, options) => {
|
|
185
|
+
return loadFonts(getInfo(), style, options);
|
|
186
|
+
};
|
|
187
|
+
export {
|
|
188
|
+
loadFont,
|
|
189
|
+
getInfo,
|
|
190
|
+
fontFamily
|
|
191
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// src/base.ts
|
|
2
|
+
import { continueRender, delayRender } from "remotion";
|
|
3
|
+
import { NoReactInternals } from "remotion/no-react";
|
|
4
|
+
|
|
5
|
+
// src/resolve-font-subsets.ts
|
|
6
|
+
var isChunkSubset = (subset) => /^\[\d+\]$/.test(subset);
|
|
7
|
+
var compareChunkSubsets = (a, b) => {
|
|
8
|
+
return Number(a.slice(1, -1)) - Number(b.slice(1, -1));
|
|
9
|
+
};
|
|
10
|
+
var resolveFontSubsetKeys = ({
|
|
11
|
+
availableSubsetKeys,
|
|
12
|
+
metaSubsets,
|
|
13
|
+
requestedSubset
|
|
14
|
+
}) => {
|
|
15
|
+
if (availableSubsetKeys.includes(requestedSubset)) {
|
|
16
|
+
return [requestedSubset];
|
|
17
|
+
}
|
|
18
|
+
if (!metaSubsets.includes(requestedSubset)) {
|
|
19
|
+
return [requestedSubset];
|
|
20
|
+
}
|
|
21
|
+
const chunkSubsets = availableSubsetKeys.filter(isChunkSubset).sort(compareChunkSubsets);
|
|
22
|
+
return chunkSubsets.length === 0 ? [requestedSubset] : chunkSubsets;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/base.ts
|
|
26
|
+
var loadedFonts = {};
|
|
27
|
+
var withResolvers = function() {
|
|
28
|
+
let resolve;
|
|
29
|
+
let reject;
|
|
30
|
+
const promise = new Promise((res, rej) => {
|
|
31
|
+
resolve = res;
|
|
32
|
+
reject = rej;
|
|
33
|
+
});
|
|
34
|
+
return { promise, resolve, reject };
|
|
35
|
+
};
|
|
36
|
+
var loadFontFaceOrTimeoutAfter20Seconds = (fontFace) => {
|
|
37
|
+
const timeout = withResolvers();
|
|
38
|
+
const int = setTimeout(() => {
|
|
39
|
+
timeout.reject(new Error("Timed out loading Google Font"));
|
|
40
|
+
}, 18000);
|
|
41
|
+
return Promise.race([
|
|
42
|
+
fontFace.load().then(() => {
|
|
43
|
+
clearTimeout(int);
|
|
44
|
+
}),
|
|
45
|
+
timeout.promise
|
|
46
|
+
]);
|
|
47
|
+
};
|
|
48
|
+
var loadFonts = (meta, style, options) => {
|
|
49
|
+
const weightsAndSubsetsAreSpecified = Array.isArray(options?.weights) && Array.isArray(options?.subsets) && options.weights.length > 0 && options.subsets.length > 0;
|
|
50
|
+
if (NoReactInternals.ENABLE_V5_BREAKING_CHANGES && !weightsAndSubsetsAreSpecified) {
|
|
51
|
+
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.");
|
|
52
|
+
}
|
|
53
|
+
const promises = [];
|
|
54
|
+
const styles = style ? [style] : Object.keys(meta.fonts);
|
|
55
|
+
let fontsLoaded = 0;
|
|
56
|
+
for (const style2 of styles) {
|
|
57
|
+
if (typeof FontFace === "undefined") {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (!meta.fonts[style2]) {
|
|
61
|
+
throw new Error(`The font ${meta.fontFamily} does not have a style ${style2}`);
|
|
62
|
+
}
|
|
63
|
+
const weights = options?.weights ?? Object.keys(meta.fonts[style2]);
|
|
64
|
+
for (const weight of weights) {
|
|
65
|
+
if (!meta.fonts[style2][weight]) {
|
|
66
|
+
throw new Error(`The font ${meta.fontFamily} does not have a weight ${weight} in style ${style2}`);
|
|
67
|
+
}
|
|
68
|
+
const requestedSubsets = options?.subsets ?? Object.keys(meta.fonts[style2][weight]);
|
|
69
|
+
const availableSubsetKeys = Object.keys(meta.fonts[style2][weight]);
|
|
70
|
+
const subsets = [
|
|
71
|
+
...new Set(requestedSubsets.flatMap((requestedSubset) => resolveFontSubsetKeys({
|
|
72
|
+
availableSubsetKeys,
|
|
73
|
+
metaSubsets: meta.subsets,
|
|
74
|
+
requestedSubset
|
|
75
|
+
})))
|
|
76
|
+
];
|
|
77
|
+
for (const subset of subsets) {
|
|
78
|
+
let font = meta.fonts[style2]?.[weight]?.[subset];
|
|
79
|
+
if (!font) {
|
|
80
|
+
throw new Error(`weight: ${weight} subset: ${subset} is not available for '${meta.fontFamily}'`);
|
|
81
|
+
}
|
|
82
|
+
let fontKey = `${meta.fontFamily}-${style2}-${weight}-${subset}`;
|
|
83
|
+
const previousPromise = loadedFonts[fontKey];
|
|
84
|
+
if (previousPromise) {
|
|
85
|
+
promises.push(previousPromise);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const baseLabel = `Fetching ${meta.fontFamily} font ${JSON.stringify({
|
|
89
|
+
style: style2,
|
|
90
|
+
weight,
|
|
91
|
+
subset
|
|
92
|
+
})}`;
|
|
93
|
+
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`;
|
|
94
|
+
const handle = delayRender(label, { timeoutInMilliseconds: 60000 });
|
|
95
|
+
fontsLoaded++;
|
|
96
|
+
const fontFace = new FontFace(meta.fontFamily, `url(${font}) format('woff2')`, {
|
|
97
|
+
weight,
|
|
98
|
+
style: style2,
|
|
99
|
+
unicodeRange: meta.unicodeRanges[subset]
|
|
100
|
+
});
|
|
101
|
+
let attempts = 2;
|
|
102
|
+
const tryToLoad = () => {
|
|
103
|
+
if (fontFace.status === "loaded") {
|
|
104
|
+
continueRender(handle);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const promise = loadFontFaceOrTimeoutAfter20Seconds(fontFace).then(() => {
|
|
108
|
+
(options?.document ?? document).fonts.add(fontFace);
|
|
109
|
+
continueRender(handle);
|
|
110
|
+
}).catch((err) => {
|
|
111
|
+
loadedFonts[fontKey] = undefined;
|
|
112
|
+
if (attempts === 0) {
|
|
113
|
+
throw err;
|
|
114
|
+
} else {
|
|
115
|
+
attempts--;
|
|
116
|
+
tryToLoad();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
loadedFonts[fontKey] = promise;
|
|
120
|
+
promises.push(promise);
|
|
121
|
+
};
|
|
122
|
+
tryToLoad();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (fontsLoaded > 20 && !options?.ignoreTooManyRequestsWarning) {
|
|
126
|
+
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".`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
fontFamily: meta.fontFamily,
|
|
131
|
+
fonts: meta.fonts,
|
|
132
|
+
unicodeRanges: meta.unicodeRanges,
|
|
133
|
+
waitUntilDone: () => Promise.all(promises).then(() => {
|
|
134
|
+
return;
|
|
135
|
+
})
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// src/HiburMono.ts
|
|
140
|
+
var getInfo = () => ({
|
|
141
|
+
fontFamily: "Hibur Mono",
|
|
142
|
+
importName: "HiburMono",
|
|
143
|
+
version: "v1",
|
|
144
|
+
url: "https://fonts.googleapis.com/css2?family=Hibur+Mono:ital,wght@0,400",
|
|
145
|
+
unicodeRanges: {
|
|
146
|
+
ethiopic: "U+030E, U+1200-1399, U+2D80-2DDE, U+AB01-AB2E, U+1E7E0-1E7E6, U+1E7E8-1E7EB, U+1E7ED-1E7EE, U+1E7F0-1E7FE",
|
|
147
|
+
"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",
|
|
148
|
+
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"
|
|
149
|
+
},
|
|
150
|
+
fonts: {
|
|
151
|
+
normal: {
|
|
152
|
+
"400": {
|
|
153
|
+
ethiopic: "https://fonts.gstatic.com/s/hiburmono/v1/R70fjyoFkv6fKPKNWxXXiDy0Ugv4.woff2",
|
|
154
|
+
"latin-ext": "https://fonts.gstatic.com/s/hiburmono/v1/R70fjyoFkv6fKPKNWxXXiCO0Ugv4.woff2",
|
|
155
|
+
latin: "https://fonts.gstatic.com/s/hiburmono/v1/R70fjyoFkv6fKPKNWxXXiC20Ug.woff2"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
subsets: ["ethiopic", "latin", "latin-ext"]
|
|
160
|
+
});
|
|
161
|
+
var fontFamily = "Hibur Mono";
|
|
162
|
+
var loadFont = (style, options) => {
|
|
163
|
+
return loadFonts(getInfo(), style, options);
|
|
164
|
+
};
|
|
165
|
+
export {
|
|
166
|
+
loadFont,
|
|
167
|
+
getInfo,
|
|
168
|
+
fontFamily
|
|
169
|
+
};
|
|
@@ -140,7 +140,7 @@ var loadFonts = (meta, style, options) => {
|
|
|
140
140
|
var getInfo = () => ({
|
|
141
141
|
fontFamily: "Noto Serif Old Uyghur",
|
|
142
142
|
importName: "NotoSerifOldUyghur",
|
|
143
|
-
version: "
|
|
143
|
+
version: "v5",
|
|
144
144
|
url: "https://fonts.googleapis.com/css2?family=Noto+Serif+Old+Uyghur:ital,wght@0,400",
|
|
145
145
|
unicodeRanges: {
|
|
146
146
|
"old-uyghur": "U+0640, U+10AF2, U+10F70-10F89",
|
|
@@ -150,9 +150,9 @@ var getInfo = () => ({
|
|
|
150
150
|
fonts: {
|
|
151
151
|
normal: {
|
|
152
152
|
"400": {
|
|
153
|
-
"old-uyghur": "https://fonts.gstatic.com/s/notoserifolduyghur/
|
|
154
|
-
"latin-ext": "https://fonts.gstatic.com/s/notoserifolduyghur/
|
|
155
|
-
latin: "https://fonts.gstatic.com/s/notoserifolduyghur/
|
|
153
|
+
"old-uyghur": "https://fonts.gstatic.com/s/notoserifolduyghur/v5/v6-KGZbLJFKIhClqUYqXDiGnrVoFRCW6JdwXm8K6GlWM.woff2",
|
|
154
|
+
"latin-ext": "https://fonts.gstatic.com/s/notoserifolduyghur/v5/v6-KGZbLJFKIhClqUYqXDiGnrVoFRCW6JdwXI-OfJ2w.woff2",
|
|
155
|
+
latin: "https://fonts.gstatic.com/s/notoserifolduyghur/v5/v6-KGZbLJFKIhClqUYqXDiGnrVoFRCW6JdwXLeOf.woff2"
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
},
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2839,6 +2839,11 @@ export const getAvailableFonts = () => [
|
|
|
2839
2839
|
importName: 'Geom',
|
|
2840
2840
|
load: () => import('./Geom.mjs'),
|
|
2841
2841
|
},
|
|
2842
|
+
{
|
|
2843
|
+
fontFamily: 'Geomini',
|
|
2844
|
+
importName: 'Geomini',
|
|
2845
|
+
load: () => import('./Geomini.mjs'),
|
|
2846
|
+
},
|
|
2842
2847
|
{
|
|
2843
2848
|
fontFamily: 'Georama',
|
|
2844
2849
|
importName: 'Georama',
|
|
@@ -3189,6 +3194,11 @@ export const getAvailableFonts = () => [
|
|
|
3189
3194
|
importName: 'HiMelody',
|
|
3190
3195
|
load: () => import('./HiMelody.mjs'),
|
|
3191
3196
|
},
|
|
3197
|
+
{
|
|
3198
|
+
fontFamily: 'Hibur Mono',
|
|
3199
|
+
importName: 'HiburMono',
|
|
3200
|
+
load: () => import('./HiburMono.mjs'),
|
|
3201
|
+
},
|
|
3192
3202
|
{
|
|
3193
3203
|
fontFamily: 'Hina Mincho',
|
|
3194
3204
|
importName: 'HinaMincho',
|
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.
|
|
6
|
+
"version": "4.0.488",
|
|
7
7
|
"description": "Use Google Fonts in Remotion",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"module": "dist/esm/index.mjs",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"remotion": "4.0.
|
|
19
|
+
"remotion": "4.0.488"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/css-font-loading-module": "0.0.14",
|
|
@@ -1731,6 +1731,9 @@
|
|
|
1731
1731
|
"Geom": [
|
|
1732
1732
|
"dist/cjs/Geom.d.ts"
|
|
1733
1733
|
],
|
|
1734
|
+
"Geomini": [
|
|
1735
|
+
"dist/cjs/Geomini.d.ts"
|
|
1736
|
+
],
|
|
1734
1737
|
"Georama": [
|
|
1735
1738
|
"dist/cjs/Georama.d.ts"
|
|
1736
1739
|
],
|
|
@@ -1941,6 +1944,9 @@
|
|
|
1941
1944
|
"HiMelody": [
|
|
1942
1945
|
"dist/cjs/HiMelody.d.ts"
|
|
1943
1946
|
],
|
|
1947
|
+
"HiburMono": [
|
|
1948
|
+
"dist/cjs/HiburMono.d.ts"
|
|
1949
|
+
],
|
|
1944
1950
|
"HinaMincho": [
|
|
1945
1951
|
"dist/cjs/HinaMincho.d.ts"
|
|
1946
1952
|
],
|