WebvttCssStyle
@UnstableApi
public final 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 |
|---|
@DocumentedFont size unit enum. |
@DocumentedStyle flag enum. |
Constants |
|
|---|---|
static final int |
|
static final int |
|
static final int |
|
static final int |
STYLE_BOLD = 1 |
static final int |
|
static final int |
STYLE_ITALIC = 2 |
static final int |
STYLE_NORMAL = 0 |
static final int |
UNSPECIFIED = -1 |
Public constructors |
|---|
Constants
Public fields
Public constructors
Public methods
getSpecificityScore
public int getSpecificityScore(
@Nullable String id,
@Nullable String tag,
Set<String> classes,
@Nullable String voice
)
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 | |
|---|---|
@Nullable String id |
The id of the cue if present, |
@Nullable String tag |
Name of the tag, |
Set<String> classes |
An array containing the classes the tag belongs to. Must not be null. |
@Nullable String voice |
Annotated voice if present, |
| Returns | |
|---|---|
int |
The score of the match, zero if there is no match. |
getStyle
@WebvttCssStyle.StyleFlags
public int getStyle()
Returns the style or UNSPECIFIED when no style information is given.
| Returns | |
|---|---|
int |
|
setBackgroundColor
@CanIgnoreReturnValue
public WebvttCssStyle setBackgroundColor(int backgroundColor)
setFontSizeUnit
@CanIgnoreReturnValue
public WebvttCssStyle setFontSizeUnit(@WebvttCssStyle.FontSizeUnit int unit)
setRubyPosition
@CanIgnoreReturnValue
public WebvttCssStyle setRubyPosition(@TextAnnotation.Position int rubyPosition)