@remotion/google-fonts 4.0.369 → 4.0.371
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/CossetteTexte.js +5 -5
- package/dist/cjs/CossetteTitre.js +5 -5
- package/dist/cjs/MomoSignature.d.ts +40 -0
- package/dist/cjs/MomoSignature.js +31 -0
- package/dist/cjs/MomoTrustDisplay.d.ts +40 -0
- package/dist/cjs/MomoTrustDisplay.js +31 -0
- package/dist/cjs/MomoTrustSans.d.ts +70 -0
- package/dist/cjs/MomoTrustSans.js +61 -0
- package/dist/cjs/NotoNaskhArabic.js +21 -21
- package/dist/cjs/NotoSansSyriacWestern.d.ts +80 -0
- package/dist/cjs/NotoSansSyriacWestern.js +71 -0
- package/dist/cjs/Parastoo.d.ts +6 -1
- package/dist/cjs/Parastoo.js +19 -14
- package/dist/cjs/Zain.js +17 -17
- package/dist/cjs/index.js +20 -0
- package/dist/esm/CossetteTexte.mjs +5 -5
- package/dist/esm/CossetteTitre.mjs +5 -5
- package/dist/esm/MomoSignature.mjs +139 -0
- package/dist/esm/MomoTrustDisplay.mjs +139 -0
- package/dist/esm/MomoTrustSans.mjs +169 -0
- package/dist/esm/NotoNaskhArabic.mjs +21 -21
- package/dist/esm/NotoSansSyriacWestern.mjs +179 -0
- package/dist/esm/Parastoo.mjs +19 -14
- package/dist/esm/Zain.mjs +17 -17
- package/dist/esm/index.mjs +20 -0
- package/package.json +14 -3
package/dist/cjs/Parastoo.js
CHANGED
|
@@ -5,9 +5,10 @@ const base_1 = require("./base");
|
|
|
5
5
|
const getInfo = () => ({
|
|
6
6
|
fontFamily: 'Parastoo',
|
|
7
7
|
importName: 'Parastoo',
|
|
8
|
-
version: '
|
|
8
|
+
version: 'v3',
|
|
9
9
|
url: 'https://fonts.googleapis.com/css2?family=Parastoo:ital,wght@0,400;0,500;0,600;0,700',
|
|
10
10
|
unicodeRanges: {
|
|
11
|
+
arabic: 'U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1',
|
|
11
12
|
vietnamese: 'U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB',
|
|
12
13
|
'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
14
|
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',
|
|
@@ -15,28 +16,32 @@ const getInfo = () => ({
|
|
|
15
16
|
fonts: {
|
|
16
17
|
normal: {
|
|
17
18
|
'400': {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
latin: 'https://fonts.gstatic.com/s/parastoo/
|
|
19
|
+
arabic: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrShiRwxw.woff2',
|
|
20
|
+
vietnamese: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrYhiRwxw.woff2',
|
|
21
|
+
'latin-ext': 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrZhiRwxw.woff2',
|
|
22
|
+
latin: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrXhiQ.woff2',
|
|
21
23
|
},
|
|
22
24
|
'500': {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
latin: 'https://fonts.gstatic.com/s/parastoo/
|
|
25
|
+
arabic: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrShiRwxw.woff2',
|
|
26
|
+
vietnamese: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrYhiRwxw.woff2',
|
|
27
|
+
'latin-ext': 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrZhiRwxw.woff2',
|
|
28
|
+
latin: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrXhiQ.woff2',
|
|
26
29
|
},
|
|
27
30
|
'600': {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
latin: 'https://fonts.gstatic.com/s/parastoo/
|
|
31
|
+
arabic: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrShiRwxw.woff2',
|
|
32
|
+
vietnamese: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrYhiRwxw.woff2',
|
|
33
|
+
'latin-ext': 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrZhiRwxw.woff2',
|
|
34
|
+
latin: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrXhiQ.woff2',
|
|
31
35
|
},
|
|
32
36
|
'700': {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
latin: 'https://fonts.gstatic.com/s/parastoo/
|
|
37
|
+
arabic: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrShiRwxw.woff2',
|
|
38
|
+
vietnamese: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrYhiRwxw.woff2',
|
|
39
|
+
'latin-ext': 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrZhiRwxw.woff2',
|
|
40
|
+
latin: 'https://fonts.gstatic.com/s/parastoo/v3/-F6yfj90ITQ4d9euQXrXhiQ.woff2',
|
|
36
41
|
},
|
|
37
42
|
},
|
|
38
43
|
},
|
|
39
|
-
subsets: ['latin', 'latin-ext', 'vietnamese'],
|
|
44
|
+
subsets: ['arabic', 'latin', 'latin-ext', 'vietnamese'],
|
|
40
45
|
});
|
|
41
46
|
exports.getInfo = getInfo;
|
|
42
47
|
exports.fontFamily = 'Parastoo';
|
package/dist/cjs/Zain.js
CHANGED
|
@@ -5,7 +5,7 @@ const base_1 = require("./base");
|
|
|
5
5
|
const getInfo = () => ({
|
|
6
6
|
fontFamily: 'Zain',
|
|
7
7
|
importName: 'Zain',
|
|
8
|
-
version: '
|
|
8
|
+
version: 'v4',
|
|
9
9
|
url: 'https://fonts.googleapis.com/css2?family=Zain:ital,wght@0,200;0,300;0,400;0,700;0,800;0,900;1,300;1,400',
|
|
10
10
|
unicodeRanges: {
|
|
11
11
|
arabic: 'U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1',
|
|
@@ -14,38 +14,38 @@ const getInfo = () => ({
|
|
|
14
14
|
fonts: {
|
|
15
15
|
italic: {
|
|
16
16
|
'300': {
|
|
17
|
-
arabic: 'https://fonts.gstatic.com/s/zain/
|
|
18
|
-
latin: 'https://fonts.gstatic.com/s/zain/
|
|
17
|
+
arabic: 'https://fonts.gstatic.com/s/zain/v4/sykx-y9lm7soMND1OSiH_PLAnlQ.woff2',
|
|
18
|
+
latin: 'https://fonts.gstatic.com/s/zain/v4/sykx-y9lm7soMND1OSiH-fLA.woff2',
|
|
19
19
|
},
|
|
20
20
|
'400': {
|
|
21
|
-
arabic: 'https://fonts.gstatic.com/s/zain/
|
|
22
|
-
latin: 'https://fonts.gstatic.com/s/zain/
|
|
21
|
+
arabic: 'https://fonts.gstatic.com/s/zain/v4/syky-y9lm7soMND9lwqSxtM.woff2',
|
|
22
|
+
latin: 'https://fonts.gstatic.com/s/zain/v4/syky-y9lm7soMND9kgqS.woff2',
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
normal: {
|
|
26
26
|
'200': {
|
|
27
|
-
arabic: 'https://fonts.gstatic.com/s/zain/
|
|
28
|
-
latin: 'https://fonts.gstatic.com/s/zain/
|
|
27
|
+
arabic: 'https://fonts.gstatic.com/s/zain/v4/sykz-y9lm7soOBrshSi3--rE.woff2',
|
|
28
|
+
latin: 'https://fonts.gstatic.com/s/zain/v4/sykz-y9lm7soOBrshS23-w.woff2',
|
|
29
29
|
},
|
|
30
30
|
'300': {
|
|
31
|
-
arabic: 'https://fonts.gstatic.com/s/zain/
|
|
32
|
-
latin: 'https://fonts.gstatic.com/s/zain/
|
|
31
|
+
arabic: 'https://fonts.gstatic.com/s/zain/v4/sykz-y9lm7soOH7vhSi3--rE.woff2',
|
|
32
|
+
latin: 'https://fonts.gstatic.com/s/zain/v4/sykz-y9lm7soOH7vhS23-w.woff2',
|
|
33
33
|
},
|
|
34
34
|
'400': {
|
|
35
|
-
arabic: 'https://fonts.gstatic.com/s/zain/
|
|
36
|
-
latin: 'https://fonts.gstatic.com/s/zain/
|
|
35
|
+
arabic: 'https://fonts.gstatic.com/s/zain/v4/syk8-y9lm7soMNDNkBKW.woff2',
|
|
36
|
+
latin: 'https://fonts.gstatic.com/s/zain/v4/syk8-y9lm7soMNXNkA.woff2',
|
|
37
37
|
},
|
|
38
38
|
'700': {
|
|
39
|
-
arabic: 'https://fonts.gstatic.com/s/zain/
|
|
40
|
-
latin: 'https://fonts.gstatic.com/s/zain/
|
|
39
|
+
arabic: 'https://fonts.gstatic.com/s/zain/v4/sykz-y9lm7soOG7ohSi3--rE.woff2',
|
|
40
|
+
latin: 'https://fonts.gstatic.com/s/zain/v4/sykz-y9lm7soOG7ohS23-w.woff2',
|
|
41
41
|
},
|
|
42
42
|
'800': {
|
|
43
|
-
arabic: 'https://fonts.gstatic.com/s/zain/
|
|
44
|
-
latin: 'https://fonts.gstatic.com/s/zain/
|
|
43
|
+
arabic: 'https://fonts.gstatic.com/s/zain/v4/sykz-y9lm7soOHLrhSi3--rE.woff2',
|
|
44
|
+
latin: 'https://fonts.gstatic.com/s/zain/v4/sykz-y9lm7soOHLrhS23-w.woff2',
|
|
45
45
|
},
|
|
46
46
|
'900': {
|
|
47
|
-
arabic: 'https://fonts.gstatic.com/s/zain/
|
|
48
|
-
latin: 'https://fonts.gstatic.com/s/zain/
|
|
47
|
+
arabic: 'https://fonts.gstatic.com/s/zain/v4/sykz-y9lm7soOFbqhSi3--rE.woff2',
|
|
48
|
+
latin: 'https://fonts.gstatic.com/s/zain/v4/sykz-y9lm7soOFbqhS23-w.woff2',
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
},
|
package/dist/cjs/index.js
CHANGED
|
@@ -4752,6 +4752,21 @@ const getAvailableFonts = () => [
|
|
|
4752
4752
|
importName: 'Molle',
|
|
4753
4753
|
load: () => Promise.resolve().then(() => __importStar(require('./Molle'))),
|
|
4754
4754
|
},
|
|
4755
|
+
{
|
|
4756
|
+
fontFamily: 'Momo Signature',
|
|
4757
|
+
importName: 'MomoSignature',
|
|
4758
|
+
load: () => Promise.resolve().then(() => __importStar(require('./MomoSignature'))),
|
|
4759
|
+
},
|
|
4760
|
+
{
|
|
4761
|
+
fontFamily: 'Momo Trust Display',
|
|
4762
|
+
importName: 'MomoTrustDisplay',
|
|
4763
|
+
load: () => Promise.resolve().then(() => __importStar(require('./MomoTrustDisplay'))),
|
|
4764
|
+
},
|
|
4765
|
+
{
|
|
4766
|
+
fontFamily: 'Momo Trust Sans',
|
|
4767
|
+
importName: 'MomoTrustSans',
|
|
4768
|
+
load: () => Promise.resolve().then(() => __importStar(require('./MomoTrustSans'))),
|
|
4769
|
+
},
|
|
4755
4770
|
{
|
|
4756
4771
|
fontFamily: 'Mona Sans',
|
|
4757
4772
|
importName: 'MonaSans',
|
|
@@ -5817,6 +5832,11 @@ const getAvailableFonts = () => [
|
|
|
5817
5832
|
importName: 'NotoSansSyriacEastern',
|
|
5818
5833
|
load: () => Promise.resolve().then(() => __importStar(require('./NotoSansSyriacEastern'))),
|
|
5819
5834
|
},
|
|
5835
|
+
{
|
|
5836
|
+
fontFamily: 'Noto Sans Syriac Western',
|
|
5837
|
+
importName: 'NotoSansSyriacWestern',
|
|
5838
|
+
load: () => Promise.resolve().then(() => __importStar(require('./NotoSansSyriacWestern'))),
|
|
5839
|
+
},
|
|
5820
5840
|
{
|
|
5821
5841
|
fontFamily: 'Noto Sans TC',
|
|
5822
5842
|
importName: 'NotoSansTC',
|
|
@@ -110,7 +110,7 @@ var loadFonts = (meta, style, options) => {
|
|
|
110
110
|
var getInfo = () => ({
|
|
111
111
|
fontFamily: "Cossette Texte",
|
|
112
112
|
importName: "CossetteTexte",
|
|
113
|
-
version: "
|
|
113
|
+
version: "v3",
|
|
114
114
|
url: "https://fonts.googleapis.com/css2?family=Cossette+Texte:ital,wght@0,400;0,700",
|
|
115
115
|
unicodeRanges: {
|
|
116
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",
|
|
@@ -119,12 +119,12 @@ var getInfo = () => ({
|
|
|
119
119
|
fonts: {
|
|
120
120
|
normal: {
|
|
121
121
|
"400": {
|
|
122
|
-
"latin-ext": "https://fonts.gstatic.com/s/cossettetexte/
|
|
123
|
-
latin: "https://fonts.gstatic.com/s/cossettetexte/
|
|
122
|
+
"latin-ext": "https://fonts.gstatic.com/s/cossettetexte/v3/S6ukw4pDXzTb-m1kPi_7eV-ciM08zvFg1w.woff2",
|
|
123
|
+
latin: "https://fonts.gstatic.com/s/cossettetexte/v3/S6ukw4pDXzTb-m1kPi_7eV-ciM0yzvE.woff2"
|
|
124
124
|
},
|
|
125
125
|
"700": {
|
|
126
|
-
"latin-ext": "https://fonts.gstatic.com/s/cossettetexte/
|
|
127
|
-
latin: "https://fonts.gstatic.com/s/cossettetexte/
|
|
126
|
+
"latin-ext": "https://fonts.gstatic.com/s/cossettetexte/v3/S6unw4pDXzTb-m1kPi_7eV-ciMWJ6-RR9sv9DQ.woff2",
|
|
127
|
+
latin: "https://fonts.gstatic.com/s/cossettetexte/v3/S6unw4pDXzTb-m1kPi_7eV-ciMWJ6-Rf9ss.woff2"
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
},
|
|
@@ -110,7 +110,7 @@ var loadFonts = (meta, style, options) => {
|
|
|
110
110
|
var getInfo = () => ({
|
|
111
111
|
fontFamily: "Cossette Titre",
|
|
112
112
|
importName: "CossetteTitre",
|
|
113
|
-
version: "
|
|
113
|
+
version: "v3",
|
|
114
114
|
url: "https://fonts.googleapis.com/css2?family=Cossette+Titre:ital,wght@0,400;0,700",
|
|
115
115
|
unicodeRanges: {
|
|
116
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",
|
|
@@ -119,12 +119,12 @@ var getInfo = () => ({
|
|
|
119
119
|
fonts: {
|
|
120
120
|
normal: {
|
|
121
121
|
"400": {
|
|
122
|
-
"latin-ext": "https://fonts.gstatic.com/s/cossettetitre/
|
|
123
|
-
latin: "https://fonts.gstatic.com/s/cossettetitre/
|
|
122
|
+
"latin-ext": "https://fonts.gstatic.com/s/cossettetitre/v3/11hYGpvKz1nGbxMXUWz9OdPzuhEQpva08Q.woff2",
|
|
123
|
+
latin: "https://fonts.gstatic.com/s/cossettetitre/v3/11hYGpvKz1nGbxMXUWz9OdPzuhEepvY.woff2"
|
|
124
124
|
},
|
|
125
125
|
"700": {
|
|
126
|
-
"latin-ext": "https://fonts.gstatic.com/s/cossettetitre/
|
|
127
|
-
latin: "https://fonts.gstatic.com/s/cossettetitre/
|
|
126
|
+
"latin-ext": "https://fonts.gstatic.com/s/cossettetitre/v3/11hbGpvKz1nGbxMXUWz9OdPzuhmlg-OF0N0PRQ.woff2",
|
|
127
|
+
latin: "https://fonts.gstatic.com/s/cossettetitre/v3/11hbGpvKz1nGbxMXUWz9OdPzuhmlg-OL0N0.woff2"
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
},
|
|
@@ -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/MomoSignature.ts
|
|
110
|
+
var getInfo = () => ({
|
|
111
|
+
fontFamily: "Momo Signature",
|
|
112
|
+
importName: "MomoSignature",
|
|
113
|
+
version: "v2",
|
|
114
|
+
url: "https://fonts.googleapis.com/css2?family=Momo+Signature:ital,wght@0,400",
|
|
115
|
+
unicodeRanges: {
|
|
116
|
+
vietnamese: "U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB",
|
|
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
|
+
vietnamese: "https://fonts.gstatic.com/s/momosignature/v2/RrQJbop99C51b06IDAuFoM0yCpcgO8i5PA.woff2",
|
|
124
|
+
"latin-ext": "https://fonts.gstatic.com/s/momosignature/v2/RrQJbop99C51b06IDAuFoM0yCpchO8i5PA.woff2",
|
|
125
|
+
latin: "https://fonts.gstatic.com/s/momosignature/v2/RrQJbop99C51b06IDAuFoM0yCpcvO8g.woff2"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
subsets: ["latin", "latin-ext", "vietnamese"]
|
|
130
|
+
});
|
|
131
|
+
var fontFamily = "Momo Signature";
|
|
132
|
+
var loadFont = (style, options) => {
|
|
133
|
+
return loadFonts(getInfo(), style, options);
|
|
134
|
+
};
|
|
135
|
+
export {
|
|
136
|
+
loadFont,
|
|
137
|
+
getInfo,
|
|
138
|
+
fontFamily
|
|
139
|
+
};
|
|
@@ -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/MomoTrustDisplay.ts
|
|
110
|
+
var getInfo = () => ({
|
|
111
|
+
fontFamily: "Momo Trust Display",
|
|
112
|
+
importName: "MomoTrustDisplay",
|
|
113
|
+
version: "v2",
|
|
114
|
+
url: "https://fonts.googleapis.com/css2?family=Momo+Trust+Display:ital,wght@0,400",
|
|
115
|
+
unicodeRanges: {
|
|
116
|
+
vietnamese: "U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB",
|
|
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
|
+
vietnamese: "https://fonts.gstatic.com/s/momotrustdisplay/v2/WWXPlieNYgyPZLyBUuEkKZFhFHyjqb1el2ZMBgM.woff2",
|
|
124
|
+
"latin-ext": "https://fonts.gstatic.com/s/momotrustdisplay/v2/WWXPlieNYgyPZLyBUuEkKZFhFHyjqb1elmZMBgM.woff2",
|
|
125
|
+
latin: "https://fonts.gstatic.com/s/momotrustdisplay/v2/WWXPlieNYgyPZLyBUuEkKZFhFHyjqb1emGZM.woff2"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
subsets: ["latin", "latin-ext", "vietnamese"]
|
|
130
|
+
});
|
|
131
|
+
var fontFamily = "Momo Trust Display";
|
|
132
|
+
var loadFont = (style, options) => {
|
|
133
|
+
return loadFonts(getInfo(), style, options);
|
|
134
|
+
};
|
|
135
|
+
export {
|
|
136
|
+
loadFont,
|
|
137
|
+
getInfo,
|
|
138
|
+
fontFamily
|
|
139
|
+
};
|