video: ass subtitle format (WIP)
This commit is contained in:
parent
62a8f05d1a
commit
2e1622fc88
2 changed files with 26 additions and 14 deletions
|
@ -222,6 +222,13 @@ class AssParser {
|
||||||
if (scale != null) extraStyle = extraStyle.copyWith(scaleY: scale.toDouble() / 100);
|
if (scale != null) extraStyle = extraStyle.copyWith(scaleY: scale.toDouble() / 100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'fsp':
|
||||||
|
{
|
||||||
|
// \fsp: letter spacing
|
||||||
|
final spacing = double.tryParse(param);
|
||||||
|
textStyle = textStyle.copyWith(letterSpacing: spacing);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'i':
|
case 'i':
|
||||||
// \i: italics
|
// \i: italics
|
||||||
textStyle = textStyle.copyWith(fontStyle: param == '1' ? FontStyle.italic : FontStyle.normal);
|
textStyle = textStyle.copyWith(fontStyle: param == '1' ? FontStyle.italic : FontStyle.normal);
|
||||||
|
@ -289,7 +296,6 @@ class AssParser {
|
||||||
case 'org': // \org: rotation origin
|
case 'org': // \org: rotation origin
|
||||||
// TODO TLAD [subtitles] MAY support the following
|
// TODO TLAD [subtitles] MAY support the following
|
||||||
case 'fe': // \fe: font encoding
|
case 'fe': // \fe: font encoding
|
||||||
case 'fsp': // \fsp: letter spacing
|
|
||||||
case 'pbo': // \pbo: baseline offset
|
case 'pbo': // \pbo: baseline offset
|
||||||
case 'q': // \q: wrap style
|
case 'q': // \q: wrap style
|
||||||
// border size
|
// border size
|
||||||
|
|
|
@ -102,19 +102,25 @@ class VideoSubtitles extends StatelessWidget {
|
||||||
final spans = kv.value.map((v) {
|
final spans = kv.value.map((v) {
|
||||||
final span = v.textSpan;
|
final span = v.textSpan;
|
||||||
final style = span.style;
|
final style = span.style;
|
||||||
return position != null && style != null
|
if (position == null || style == null) return span;
|
||||||
? TextSpan(
|
|
||||||
|
final letterSpacing = style.letterSpacing;
|
||||||
|
final shadows = style.shadows;
|
||||||
|
return TextSpan(
|
||||||
text: span.text,
|
text: span.text,
|
||||||
style: style.copyWith(
|
style: style.copyWith(
|
||||||
shadows: style.shadows
|
letterSpacing: letterSpacing != null ? letterSpacing * viewScale : null,
|
||||||
?.map((v) => Shadow(
|
shadows: shadows != null
|
||||||
|
? shadows
|
||||||
|
.map((v) => Shadow(
|
||||||
color: v.color,
|
color: v.color,
|
||||||
offset: v.offset * viewScale,
|
offset: v.offset * viewScale,
|
||||||
blurRadius: v.blurRadius * viewScale,
|
blurRadius: v.blurRadius * viewScale,
|
||||||
))
|
))
|
||||||
.toList()),
|
.toList()
|
||||||
)
|
: null,
|
||||||
: span;
|
),
|
||||||
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
final drawingPaths = extraStyle.drawingPaths;
|
final drawingPaths = extraStyle.drawingPaths;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue