File tree Expand file tree Collapse file tree 4 files changed +60
-0
lines changed
Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,13 @@ shaka.extern.Cue = class {
255255 */
256256 this . backgroundImage ;
257257
258+ /**
259+ * Text border.
260+ * @type {!string }
261+ * @exportDoc
262+ */
263+ this . border ;
264+
258265 /**
259266 * Text font size in px or em (e.g. '100px'/'100em').
260267 * @type {string }
@@ -283,6 +290,20 @@ shaka.extern.Cue = class {
283290 */
284291 this . fontFamily ;
285292
293+ /**
294+ * Text letter spacing.
295+ * @type {!string }
296+ * @exportDoc
297+ */
298+ this . letterSpacing ;
299+
300+ /**
301+ * Text opacity.
302+ * @type {!number }
303+ * @exportDoc
304+ */
305+ this . opacity ;
306+
286307 /**
287308 * Text decoration. A combination of underline, overline
288309 * and line through. Empty array means no decoration.
Original file line number Diff line number Diff line change @@ -129,6 +129,12 @@ shaka.text.Cue = class {
129129 */
130130 this . backgroundImage = '' ;
131131
132+ /**
133+ * @override
134+ * @exportInterface
135+ */
136+ this . border = '' ;
137+
132138 /**
133139 * @override
134140 * @exportInterface
@@ -153,6 +159,18 @@ shaka.text.Cue = class {
153159 */
154160 this . fontFamily = '' ;
155161
162+ /**
163+ * @override
164+ * @exportInterface
165+ */
166+ this . letterSpacing = '' ;
167+
168+ /**
169+ * @override
170+ * @exportInterface
171+ */
172+ this . opacity = 1 ;
173+
156174 /**
157175 * @override
158176 * @exportInterface
Original file line number Diff line number Diff line change @@ -511,6 +511,12 @@ shaka.text.TtmlTextParser = class {
511511 cue . backgroundColor = backgroundColor ;
512512 }
513513
514+ const border = TtmlTextParser . getStyleAttribute_ (
515+ cueElement , region , styles , 'border' ) ;
516+ if ( border ) {
517+ cue . border = border ;
518+ }
519+
514520 const fontFamily = TtmlTextParser . getStyleAttribute_ (
515521 cueElement , region , styles , 'fontFamily' ) ;
516522 if ( fontFamily ) {
@@ -561,6 +567,18 @@ shaka.text.TtmlTextParser = class {
561567 }
562568 }
563569
570+ const letterSpacing = TtmlTextParser . getStyleAttribute_ (
571+ cueElement , region , styles , 'letterSpacing' ) ;
572+ if ( letterSpacing && letterSpacing . match ( TtmlTextParser . unitValues_ ) ) {
573+ cue . letterSpacing = letterSpacing ;
574+ }
575+
576+ const opacity = TtmlTextParser . getStyleAttribute_ (
577+ cueElement , region , styles , 'opacity' ) ;
578+ if ( opacity ) {
579+ cue . opacity = opacity ;
580+ }
581+
564582 // Text decoration is an array of values which can come both from the
565583 // element's style or be inherited from elements' parent nodes. All of those
566584 // values should be applied as long as they don't contradict each other. If
Original file line number Diff line number Diff line change @@ -229,8 +229,10 @@ shaka.ui.TextDisplayer = class {
229229 captionsStyle . whiteSpace = 'pre-line' ;
230230 captions . textContent = cue . payload ;
231231 captionsStyle . backgroundColor = cue . backgroundColor ;
232+ captionsStyle . border = cue . border ;
232233 captionsStyle . color = cue . color ;
233234 captionsStyle . direction = cue . direction ;
235+ captionsStyle . opacity = cue . opacity ;
234236
235237 if ( cue . backgroundImage ) {
236238 captionsStyle . backgroundImage = 'url(\'' + cue . backgroundImage + '\')' ;
@@ -270,6 +272,7 @@ shaka.ui.TextDisplayer = class {
270272 captionsStyle . fontWeight = cue . fontWeight . toString ( ) ;
271273 captionsStyle . fontSize = cue . fontSize ;
272274 captionsStyle . fontStyle = cue . fontStyle ;
275+ captionsStyle . letterSpacing = cue . letterSpacing ;
273276
274277 // The line attribute defines the positioning of the text container inside
275278 // the video container.
You can’t perform that action at this time.
0 commit comments