@remotion/fonts 4.0.524 → 4.0.525
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/load-font.js +19 -1
- package/dist/esm/index.mjs +19 -1
- package/package.json +3 -3
package/dist/cjs/load-font.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadFont = void 0;
|
|
4
4
|
const remotion_1 = require("remotion");
|
|
5
|
+
const no_react_1 = require("remotion/no-react");
|
|
5
6
|
const get_font_format_1 = require("./get-font-format");
|
|
6
7
|
const loadFont = async (options) => {
|
|
7
8
|
if (typeof options !== 'object' || options === null) {
|
|
@@ -14,7 +15,8 @@ const loadFont = async (options) => {
|
|
|
14
15
|
const waitForFont = (0, remotion_1.delayRender)(`Loading font ${family} (url: ${url}, format: ${format}, weight: ${weight}, style: ${style}, variant: ${variant}, ascentOverride: ${ascentOverride}, descentOverride: ${descentOverride}, display: ${display}, featureSettings: ${featureSettings}, lineGapOverride: ${lineGapOverride}, stretch: ${stretch}, unicodeRange: ${unicodeRange})`);
|
|
15
16
|
try {
|
|
16
17
|
const fontFormat = format !== null && format !== void 0 ? format : (0, get_font_format_1.getFontFormat)(url);
|
|
17
|
-
const
|
|
18
|
+
const fontData = await no_react_1.NoReactInternals.fetchFontData(url);
|
|
19
|
+
const font = new FontFace(family, fontData, {
|
|
18
20
|
ascentOverride,
|
|
19
21
|
descentOverride,
|
|
20
22
|
display,
|
|
@@ -30,6 +32,22 @@ const loadFont = async (options) => {
|
|
|
30
32
|
});
|
|
31
33
|
await font.load();
|
|
32
34
|
document.fonts.add(font);
|
|
35
|
+
no_react_1.NoReactInternals.registerFontFace({
|
|
36
|
+
ascentOverride: ascentOverride !== null && ascentOverride !== void 0 ? ascentOverride : null,
|
|
37
|
+
descentOverride: descentOverride !== null && descentOverride !== void 0 ? descentOverride : null,
|
|
38
|
+
display: display !== null && display !== void 0 ? display : null,
|
|
39
|
+
featureSettings: featureSettings !== null && featureSettings !== void 0 ? featureSettings : null,
|
|
40
|
+
fontFamily: family,
|
|
41
|
+
fontData,
|
|
42
|
+
fontUrl: url,
|
|
43
|
+
format: fontFormat,
|
|
44
|
+
lineGapOverride: lineGapOverride !== null && lineGapOverride !== void 0 ? lineGapOverride : null,
|
|
45
|
+
style: style !== null && style !== void 0 ? style : null,
|
|
46
|
+
weight: weight !== null && weight !== void 0 ? weight : null,
|
|
47
|
+
stretch: stretch !== null && stretch !== void 0 ? stretch : null,
|
|
48
|
+
unicodeRange: unicodeRange !== null && unicodeRange !== void 0 ? unicodeRange : null,
|
|
49
|
+
variant: variant !== null && variant !== void 0 ? variant : null,
|
|
50
|
+
});
|
|
33
51
|
(0, remotion_1.continueRender)(waitForFont);
|
|
34
52
|
}
|
|
35
53
|
catch (err) {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -19,6 +19,7 @@ var getFontFormat = (url) => {
|
|
|
19
19
|
};
|
|
20
20
|
// src/load-font.ts
|
|
21
21
|
import { cancelRender, continueRender, delayRender } from "remotion";
|
|
22
|
+
import { NoReactInternals } from "remotion/no-react";
|
|
22
23
|
var loadFont = async (options) => {
|
|
23
24
|
if (typeof options !== "object" || options === null) {
|
|
24
25
|
throw new TypeError(`loadFont() requires an object as its argument, but received ${typeof options === "string" ? `"${options}"` : typeof options}. If you want to load a Google Font, use the @remotion/google-fonts package instead. See: https://www.remotion.dev/docs/google-fonts/load-font`);
|
|
@@ -44,7 +45,8 @@ var loadFont = async (options) => {
|
|
|
44
45
|
const waitForFont = delayRender(`Loading font ${family} (url: ${url}, format: ${format}, weight: ${weight}, style: ${style}, variant: ${variant}, ascentOverride: ${ascentOverride}, descentOverride: ${descentOverride}, display: ${display}, featureSettings: ${featureSettings}, lineGapOverride: ${lineGapOverride}, stretch: ${stretch}, unicodeRange: ${unicodeRange})`);
|
|
45
46
|
try {
|
|
46
47
|
const fontFormat = format ?? getFontFormat(url);
|
|
47
|
-
const
|
|
48
|
+
const fontData = await NoReactInternals.fetchFontData(url);
|
|
49
|
+
const font = new FontFace(family, fontData, {
|
|
48
50
|
ascentOverride,
|
|
49
51
|
descentOverride,
|
|
50
52
|
display,
|
|
@@ -58,6 +60,22 @@ var loadFont = async (options) => {
|
|
|
58
60
|
});
|
|
59
61
|
await font.load();
|
|
60
62
|
document.fonts.add(font);
|
|
63
|
+
NoReactInternals.registerFontFace({
|
|
64
|
+
ascentOverride: ascentOverride ?? null,
|
|
65
|
+
descentOverride: descentOverride ?? null,
|
|
66
|
+
display: display ?? null,
|
|
67
|
+
featureSettings: featureSettings ?? null,
|
|
68
|
+
fontFamily: family,
|
|
69
|
+
fontData,
|
|
70
|
+
fontUrl: url,
|
|
71
|
+
format: fontFormat,
|
|
72
|
+
lineGapOverride: lineGapOverride ?? null,
|
|
73
|
+
style: style ?? null,
|
|
74
|
+
weight: weight ?? null,
|
|
75
|
+
stretch: stretch ?? null,
|
|
76
|
+
unicodeRange: unicodeRange ?? null,
|
|
77
|
+
variant: variant ?? null
|
|
78
|
+
});
|
|
61
79
|
continueRender(waitForFont);
|
|
62
80
|
} catch (err) {
|
|
63
81
|
cancelRender(err);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/fonts"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/fonts",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.525",
|
|
7
7
|
"description": "Helpers for loading local fonts into Remotion",
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"types": "dist/cjs/index.d.ts",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"remotion": "4.0.
|
|
27
|
+
"remotion": "4.0.525"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
30
|
+
"@remotion/eslint-config-internal": "4.0.525",
|
|
31
31
|
"eslint": "9.19.0",
|
|
32
32
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
33
33
|
},
|