Package com.google.android.exoplayer2.text.webvtt

## Class WebvttCssStyle

- java.lang.Object
- - com.google.android.exoplayer2.text.webvtt.WebvttCssStyle

-     public final class WebvttCssStyle
      extends Object

  Style object of a Css style block in a Webvtt file.
  See Also:
    W3C specification - Apply CSS properties

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `WebvttCssStyle.FontSizeUnit` | Font size unit enum.
    `static interface` | `WebvttCssStyle.StyleFlags` | Style flag enum.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `FONT_SIZE_UNIT_EM` |
    `static int` | `FONT_SIZE_UNIT_PERCENT` |
    `static int` | `FONT_SIZE_UNIT_PIXEL` |
    `static int` | `STYLE_BOLD` |
    `static int` | `STYLE_BOLD_ITALIC` |
    `static int` | `STYLE_ITALIC` |
    `static int` | `STYLE_NORMAL` |
    `static int` | `UNSPECIFIED` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `WebvttCssStyle()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getBackgroundColor()` |
    `boolean` | `getCombineUpright()` |
    `int` | `getFontColor()` |
    `String` | `getFontFamily()` |
    `float` | `getFontSize()` |
    `int` | `getFontSizeUnit()` |
    `int` | `getRubyPosition()` |
    `int` | `getSpecificityScore​(String id, String tag, Set<String> classes, String voice)` | Returns a value in a score system compliant with the CSS Specificity rules.
    `int` | `getStyle()` | Returns the style or `UNSPECIFIED` when no style information is given.
    `boolean` | `hasBackgroundColor()` |
    `boolean` | `hasFontColor()` |
    `boolean` | `isLinethrough()` |
    `boolean` | `isUnderline()` |
    `WebvttCssStyle` | `setBackgroundColor​(int backgroundColor)` |
    `WebvttCssStyle` | `setBold​(boolean bold)` |
    `WebvttCssStyle` | `setCombineUpright​(boolean enabled)` |
    `WebvttCssStyle` | `setFontColor​(int color)` |
    `WebvttCssStyle` | `setFontFamily​(String fontFamily)` |
    `WebvttCssStyle` | `setFontSize​(float fontSize)` |
    `WebvttCssStyle` | `setFontSizeUnit​(int unit)` |
    `WebvttCssStyle` | `setItalic​(boolean italic)` |
    `WebvttCssStyle` | `setLinethrough​(boolean linethrough)` |
    `WebvttCssStyle` | `setRubyPosition​(int rubyPosition)` |
    `void` | `setTargetClasses​(String[] targetClasses)` |
    `void` | `setTargetId​(String targetId)` |
    `void` | `setTargetTagName​(String targetTag)` |
    `void` | `setTargetVoice​(String targetVoice)` |
    `WebvttCssStyle` | `setUnderline​(boolean underline)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### UNSPECIFIED

          public static final int UNSPECIFIED

      See Also:
        Constant Field Values

    - #### STYLE_NORMAL

          public static final int STYLE_NORMAL

      See Also:
        Constant Field Values

    - #### STYLE_BOLD

          public static final int STYLE_BOLD

      See Also:
        Constant Field Values

    - #### STYLE_ITALIC

          public static final int STYLE_ITALIC

      See Also:
        Constant Field Values

    - #### STYLE_BOLD_ITALIC

          public static final int STYLE_BOLD_ITALIC

      See Also:
        Constant Field Values

    - #### FONT_SIZE_UNIT_PIXEL

          public static final int FONT_SIZE_UNIT_PIXEL

      See Also:
        Constant Field Values

    - #### FONT_SIZE_UNIT_EM

          public static final int FONT_SIZE_UNIT_EM

      See Also:
        Constant Field Values

    - #### FONT_SIZE_UNIT_PERCENT

          public static final int FONT_SIZE_UNIT_PERCENT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### WebvttCssStyle

          public WebvttCssStyle()

  - ### Method Detail

    - #### setTargetId

          public void setTargetId​(String targetId)

    - #### setTargetTagName

          public void setTargetTagName​(String targetTag)

    - #### setTargetClasses

          public void setTargetClasses​(String[] targetClasses)

    - #### setTargetVoice

          public void setTargetVoice​(String targetVoice)

    - #### 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.
      Parameters:
        `id` - The id of the cue if present, `null` otherwise.
        `tag` - Name of the tag, `null` if it refers to the entire cue.
        `classes` - An array containing the classes the tag belongs to. Must not be null.
        `voice` - Annotated voice if present, `null` otherwise.
      Returns:
        The score of the match, zero if there is no match.
      See Also:
        CSS Cascading

    - #### getStyle

          @StyleFlags
          public int getStyle()

      Returns the style or `UNSPECIFIED` when no style information is given.
      Returns:
        `UNSPECIFIED`, `STYLE_NORMAL`, `STYLE_BOLD`, `STYLE_BOLD` or `STYLE_BOLD_ITALIC`.

    - #### isLinethrough

          public boolean isLinethrough()

    - #### setLinethrough

          public WebvttCssStyle setLinethrough​(boolean linethrough)

    - #### isUnderline

          public boolean isUnderline()

    - #### setUnderline

          public WebvttCssStyle setUnderline​(boolean underline)

    - #### setBold

          public WebvttCssStyle setBold​(boolean bold)

    - #### setItalic

          public WebvttCssStyle setItalic​(boolean italic)

    - #### getFontFamily

          @Nullable
          public String getFontFamily()

    - #### setFontFamily

          public WebvttCssStyle setFontFamily​(@Nullable
                                              String fontFamily)

    - #### getFontColor

          public int getFontColor()

    - #### setFontColor

          public WebvttCssStyle setFontColor​(int color)

    - #### hasFontColor

          public boolean hasFontColor()

    - #### getBackgroundColor

          public int getBackgroundColor()

    - #### setBackgroundColor

          public WebvttCssStyle setBackgroundColor​(int backgroundColor)

    - #### hasBackgroundColor

          public boolean hasBackgroundColor()

    - #### setFontSize

          public WebvttCssStyle setFontSize​(float fontSize)

    - #### setFontSizeUnit

          public WebvttCssStyle setFontSizeUnit​(@FontSizeUnit
                                                int unit)

    - #### getFontSizeUnit

          @FontSizeUnit
          public int getFontSizeUnit()

    - #### getFontSize

          public float getFontSize()

    - #### setRubyPosition

          public WebvttCssStyle setRubyPosition​(@Position
                                                int rubyPosition)

    - #### getRubyPosition

          @Position
          public int getRubyPosition()

    - #### setCombineUpright

          public WebvttCssStyle setCombineUpright​(boolean enabled)

    - #### getCombineUpright

          public boolean getCombineUpright()