tencent cloud

TXSubtitleRenderModel
Last updated: 2025-09-19 10:14:42
TXSubtitleRenderModel
Last updated: 2025-09-19 10:14:42

TXSubtitleRenderModel Overview

VOD player subtitle style rendering parameters.

Field Details

fontColor

Text color, in ARGB format. If not set, defaults to opaque white (0xFFFFFFFF).
public int fontColor

fontSize

Font size. If fontSize is set, canvasWidth and canvasHeight must be set; otherwise, the internal system does not know what size to reference for font rendering. If fontSize is not set, the internal system will use the default font size.
public float fontSize

fontScale

Font scaling, specifically for VTT. After setting fontScale, the final font size will be multiplied by fontScale to fit the video width. The default value of fontScale is 1.0.
public float fontScale;

familyName

Font family name. On Android, the default is "Roboto". If the string is not null, it is considered set; if it is null, it is considered not set.
public String familyName

canvasWidth

canvasWidth and canvasHeight are the dimensions of the subtitle render canvas. The aspect ratio of canvasWidth and canvasHeight must match the aspect ratio of the video; otherwise, the rendered text will be deformed. If not set, the player will use the size of the current video as the render canvas size.
public int canvasWidth

canvasHeight

canvasWidth and canvasHeight define the size of the subtitle render canvas. Their aspect ratio must match the video's aspect ratio; otherwise, rendered text will be distorted. If not specified, the player will use the current video's dimensions as the render canvas size.
public int canvasHeight

isBondFontStyle

Whether it is bold text, with the default value being normal font.
public boolean isBondFontStyle

outlineWidth

stroke width, if not set, the internal will use the default stroke width.
public float outlineWidth

outlineColor

Stroke color, in ARGB format. If not set, defaults to opaque black (0xFF000000).
public int outlineColor

lineSpace

Line spacing: if lineSpace is set, canvasWidth and canvasHeight must be set; if not set, the internal will use the default line spacing.
public float lineSpace

startMargin

startMargin, endMargin, and verticalMargin define the drawing area for subtitles. If not set, use the settings in the subtitle file; if the subtitle file does not define them, use the default.
Once startMargin, endMargin, and yMargin are set, and the subtitle file defines one or more of these parameters, they will override the corresponding parameters in the subtitle file. The following diagram illustrates the meaning of these parameters in horizontal writing direction. Use the notes for each parameter to understand.

The margin along the direction of subtitle text content varies in meaning based on different writing orientations. startMargin is a proportional value with a range of [0, 1], representing the proportion relative to the video image size.
For horizontal writing direction, startMargin represents the distance from the left side of the subtitle to the left side of the video image. For example, startMargin=0.05 means the margin is 0.05 times the video width (5%).
For vertical writing direction (regardless of right-to-left or left-to-right), startMargin represents the distance from the top of the subtitle to the top of the video image. For example, startMargin=0.05 means the margin is 0.05 times the video height (5%).
public float startMargin

endMargin

Margin along the direction of subtitle text content
public float endMargin

verticalMargin

Margin in the vertical subtitle text direction
public float verticalMargin
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback