Micro DVD - Format - Control Codes

Control Codes

The font size cannot be configured in .sub files, only in player, but the font style of the subtitle displayed may be changed using control codes. The available control codes and their purpose are given:

The control code y defines font style.

{0}{25}{y:i}Hello!

"Hello!" is displayed in italic.

{0}{25}{y:b}Hello!

"Hello!" is displayed in bold.

{0}{25}{y:u}Hello!

"Hello!" is underlined.

{0}{25}{y:s}Hello!

"Hello!" is stroked.

The control code f defines font name.

{0}{25}{f:fontname}Hello!

"Hello!" is displayed using the defined font, with the string "fontname" determining the desired font. For example:

{0}{25}{f:Arial}Hello!

"Hello!" is displayed in the Arial typeface.

The control code s defines font size.

{0}{25}{s:size}Hello!

"Hello!" is displayed at the defined font size, with the string "size" determining the desired size as an integer number. For example:

{0}{25}{s:10}Hello!

"Hello!" is displayed at the font size of 10.

The control code c defines font color.

{0}{25}{c:$BBGGRR}Hello!

"Hello!" is displayed in a defined color. The color format is: $BBGGRR (8 bits blue, 8 bits green and 8 bits red). For example:

{0}{25}{c:$0000FF}Hello!

"Hello!" is displayed in full intensity red.

Note that this is not standard RGB color model, instead the color order is reversed.

The control code P defines subtitle position relative to video.

{0}{25}{P:X,Y}Hello!

"Hello!" is displayed at the coordinates (X,Y).

Each line in the subtitle normally displays as a single line. However, the pipe character may be used to break a single line into multiple lines. For example:

{0}{25}Hello! How are you?

The above code displays as follows:

Hello! How are you?

On the other hand,

{0}{25}Hello!|How are you?

The above code displays as follows:

Hello!

How are you?

In this case, it is possible to define display values of each line or the whole subtitle line . If the control code is in upper case, it affects the whole subtitle line. If the control code is in lower case, it affects only the line it is contained in. For example:

{0}{25}{Y:i}Hello!|How are you?

The above code will display as two lines of italic text. But,

{0}{25}{y:i}Hello!|{y:b}How are you?

The above code will display as two lines; the first line in italic, and the second line in bold. Note that if no more code is used after a pipe character, the following lines will retain the same formatting. Note that the subtitle positioning code P must be logically always used in uppercase.

It is also possible to use multiple codes at once. Here is an example:

{0}{25}{c:$0000ff}{y:b,u}{f:DeJaVuSans}{s:12}Hello!

"Hello!" will be displayed underlined and in bold, in red and in the DeJaVuSans font at 12 points.

The default display values for a complete subtitle file may be defined using {DEFAULT}, which will override particular line formattings. For example, the following code may be used to display all subtitle line using DeJaVuSans at 10 points and in blue:

{DEFAULT}{C:$FF0000}{F:DeJaVuSans}{S:10}

This line of code may be placed anywhere in the subtitle file. Also note that in this case, all control codes are in uppercase. There is also a code Hto define a particular character set to use:

{DEFAULT}{H:Greek}

Defines that the Greek character set should be used. This code can be used only in the {DEFAULT} line.

Read more about this topic:  Micro DVD, Format

Famous quotes containing the words control and/or codes:

    The awareness that health is dependent upon habits that we control makes us the first generation in history that to a large extent determines its own destiny.
    Jimmy Carter (James Earl Carter, Jr.)

    We must trust infinitely to the beneficent necessity which shines through all laws. Human nature expresses itself in them as characteristically as in statues, or songs, or railroads, and an abstract of the codes of nations would be an abstract of the common conscience.
    Ralph Waldo Emerson (1803–1882)