@UnstableApi
class WebvttCssStyle


Style object of a CSS style block in a WebVTT file.

See the Apply CSS properties section of the W3C specification

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
annotation WebvttCssStyle.FontSizeUnit

Font size unit enum.

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(flag = true, value = )
annotation WebvttCssStyle.StyleFlags

Style flag enum.

Constants

const Int
const Int
const Int
const Int
const Int
const Int
const Int
const Int

Public constructors

Public functions

Int
getSpecificityScore(
    id: String?,
    tag: String?,
    classes: (Mutable)Set<String!>!,
    voice: String?
)

Returns a value in a score system compliant with the CSS Specificity rules.

Int

Returns the style or UNSPECIFIED when no style information is given.

Boolean
Boolean
Boolean
Boolean
WebvttCssStyle!
WebvttCssStyle!
WebvttCssStyle!
Unit
setTargetClasses(targetClasses: Array<String!>!)
Unit
setTargetId(targetId: String!)
Unit
setTargetTagName(targetTag: String!)
Unit
setTargetVoice(targetVoice: String!)
WebvttCssStyle!

Constants

FONT_SIZE_UNIT_EM

const val FONT_SIZE_UNIT_EM = 2: Int

FONT_SIZE_UNIT_PERCENT

const val FONT_SIZE_UNIT_PERCENT = 3: Int

FONT_SIZE_UNIT_PIXEL

const val FONT_SIZE_UNIT_PIXEL = 1: Int

STYLE_BOLD

const val STYLE_BOLD = 1: Int

STYLE_BOLD_ITALIC

const val STYLE_BOLD_ITALIC = 3: Int

STYLE_ITALIC

const val STYLE_ITALIC = 2: Int

STYLE_NORMAL

const val STYLE_NORMAL = 0: Int

UNSPECIFIED

const val UNSPECIFIED = -1: Int

Public constructors

WebvttCssStyle

WebvttCssStyle()

Public functions

getSpecificityScore

fun getSpecificityScore(
    id: String?,
    tag: String?,
    classes: (Mutable)Set<String!>!,
    voice: String?
): Int

Returns a value in a score system compliant with the CSS Specificity rules.

The score works as follows:

  • Id match adds 0x40000000 to the score.
  • Each class and voice match adds 4 to the score.
  • Tag matching adds 2 to the score.
  • Universal selector matching scores 1.

See also CSS Cascading.

Parameters
id: String?

The id of the cue if present, null otherwise.

tag: String?

Name of the tag, null if it refers to the entire cue.

classes: (Mutable)Set<String!>!

An array containing the classes the tag belongs to. Must not be null.

voice: String?

Annotated voice if present, null otherwise.

Returns
Int

The score of the match, zero if there is no match.

getStyle

@WebvttCssStyle.StyleFlags
fun getStyle(): Int

Returns the style or UNSPECIFIED when no style information is given.

hasBackgroundColor

fun hasBackgroundColor(): Boolean

hasFontColor

fun hasFontColor(): Boolean

isLinethrough

fun isLinethrough(): Boolean

isUnderline

fun isUnderline(): Boolean

setLinethrough

@CanIgnoreReturnValue
fun setLinethrough(linethrough: Boolean): WebvttCssStyle!

setTargetClasses

fun setTargetClasses(targetClasses: Array<String!>!): Unit

setTargetId

fun setTargetId(targetId: String!): Unit

setTargetTagName

fun setTargetTagName(targetTag: String!): Unit

setTargetVoice

fun setTargetVoice(targetVoice: String!): Unit

setUnderline

@CanIgnoreReturnValue
fun setUnderline(underline: Boolean): WebvttCssStyle!

Public properties

backgroundColor

var backgroundColorInt

combineUpright

var combineUprightBoolean

fontColor

var fontColor: @ColorInt Int

fontFamily

var fontFamilyString?

fontSize

var fontSizeFloat