@nxtedition/lib 26.0.14 → 26.0.16
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/ass.js +7 -4
- package/errors.js +5 -3
- package/package.json +1 -1
package/ass.js
CHANGED
|
@@ -31,8 +31,9 @@ const BASE_HEIGHT = 1080
|
|
|
31
31
|
*
|
|
32
32
|
* @typedef {object} EmbeddableSubtitleFontFace
|
|
33
33
|
* @property {string} family
|
|
34
|
-
* @property {
|
|
35
|
-
* @property {'normal'|'
|
|
34
|
+
* @property {string} name
|
|
35
|
+
* @property {'normal'|'bold'} [weight]
|
|
36
|
+
* @property {'normal'|'italic'} [style]
|
|
36
37
|
* @property {Uint8Array} data
|
|
37
38
|
*
|
|
38
39
|
* @typedef {object} Styles
|
|
@@ -351,8 +352,10 @@ function encFontFaces(fontFaces) {
|
|
|
351
352
|
* @param {EmbeddableSubtitleFontFace} fontFace
|
|
352
353
|
*/
|
|
353
354
|
function getFontName(fontFace) {
|
|
354
|
-
const { family, weight, style } = fontFace
|
|
355
|
-
|
|
355
|
+
const { name, family, weight, style } = fontFace
|
|
356
|
+
// NOTE: Seems like libass doesn't care about the font name as specified in the original spec.
|
|
357
|
+
// That is good, because then we can register more faces than the original spec allowed.
|
|
358
|
+
return name ?? `${family}_${weight === 'bold' ? 'B' : ''}${style === 'italic' ? 'I' : ''}0`
|
|
356
359
|
}
|
|
357
360
|
|
|
358
361
|
/**
|
package/errors.js
CHANGED
|
@@ -22,9 +22,11 @@ export function parseError(error) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (Array.isArray(error)) {
|
|
25
|
-
return error.length
|
|
26
|
-
?
|
|
27
|
-
:
|
|
25
|
+
return error.length === 0
|
|
26
|
+
? null
|
|
27
|
+
: error.length > 1
|
|
28
|
+
? new AggregateError(error.map(parseError).filter(Boolean))
|
|
29
|
+
: parseError(error[0])
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
if (
|