Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Text Media

Text media is used to store text data in QuickTime movies. It has a media type of 'text'.

In this section:

Text Sample Description
Text Sample Data
Hypertext and Wired Text


Text Sample Description

The text sample description contains information that defines how to interpret text media data. This sample description is based on the standard sample description header, as described in “Sample Description Atoms.”

The data format field in the sample description is always set to 'text'.

The text media handler also adds some of its own fields to the sample description.

Display flags

A 32-bit integer containing flags that describe how the text should be drawn. The following flags are defined.

Don’t auto scale

Controls text scaling. If this flag is set to 1, the text media handler reflows the text instead of scaling when the track is scaled. This flag’s value is 0x0002.

Use movie background color

Controls background color. If this flag is set to 1, the text media handler ignores the background color field in the text sample description and uses the movie’s background color instead. This flag’s value is 0x0008.

Scroll in

Controls text scrolling. If this flag is set to 1, the text media handler scrolls the text until the last of the text is in view. This flag’s value is 0x0020.

Scroll out

Controls text scrolling. If this flag is set to 1, the text media handler scrolls the text until the last of the text is gone. This flag’s value is 0x0040.

Horizontal scroll

Controls text scrolling. If this flag is set to 1, the text media handler scrolls the text horizontally; otherwise, it scrolls the text vertically. This flag’s value is 0x0080.

Reverse scroll

Controls text scrolling. If this flag is set to 1, the text media handler scrolls down (if scrolling vertically) or backward (if scrolling horizontally; note that horizontal scrolling also depends upon text justification). This flag’s value is 0x0100.

Continuous scroll

Controls text scrolling. If this flag is set to 1, the text media handler displays new samples by scrolling out the old ones. This flag’s value is 0x0200.

Drop shadow

Controls drop shadow. If this flag is set to 1, the text media handler displays the text with a drop shadow. This flag’s value is 0x1000.

Anti-alias

Controls anti-aliasing. If this flag is set to 1, the text media handler uses anti-aliasing when drawing text. This flag’s value is 0x2000.

Key text

Controls background color. If this flag is set to 1, the text media handler does not display the background color, so that the text overlay background tracks. This flag’s value is 0x4000.

Text justification

A 32-bit integer that indicates how the text should be aligned. Set this field to 0 for left-justified text, to 1 for centered text, and to –1 for right-justified text.

Background color

A 48-bit RGB color that specifies the text’s background color.

Default text box

A 64-bit rectangle that specifies an area to receive text (top, left, bottom, right). Typically this field is set to all zeros.

Reserved

A 64-bit value that must be set to 0.

Font number

A 16-bit value that must be set to 0.

Font face

A 16-bit integer that indicates the font’s style. Set this field to 0 for normal text. You can enable other style options by using one or more of the following bit masks:

0x0001 Bold

0x0002 Italic

0x0004 Underline

0x0008 Outline

0x0010 Shadow

0x0020 Condense

0x0040 Extend

Reserved

An 8-bit value that must be set to 0.

Reserved

A 16-bit value that must be set to 0.

Foreground color

A 48-bit RGB color that specifies the text’s foreground color.

Text name

A Pascal string specifying the name of the font to use to display the text.

Text Sample Data

The format of the text data is a 16-bit length word followed by the actual text. The length word specifies the number of bytes of text, not including the length word itself. Following the text, there may be one or more atoms containing additional information for drawing and searching the text.

Table 3-8 lists the currently defined text sample extensions.

Table 3-8  Text sample extensions

Text sample extension

Description

'styl'

Style information for the text. Allows you to override the default style in the sample description or to define more than one style for a sample. The data is a TextEdit style scrap.

'ftab'

Table of font names. Each table entry contains a font number (stored in a 16-bit integer) and a font name (stored in a Pascal string).This atom is required if the 'styl' atom is present.

'hlit'

Highlight information. The atom data consists of two 32-bit integers. The first contains the starting offset for the highlighted text, and the second has the ending offset. A highlight sample can be in a key frame or in a differenced frame. When it’s used in a differenced frame, the sample should contain a zero-length piece of text.

'hclr'

Highlight color. This atom specifies the 48-bit RGB color to use for highlighting.

'drpo'

Drop shadow offset. When the display flags indicate drop shadow style, this atom can be used to override the default drop shadow placement. The data consists of two 16-bit integers. The first indicates the horizontal displacement of the drop shadow, in pixels; the second, the vertical displacement.

'drpt'

Drop shadow transparency. The data is a 16-bit integer between 0 and 256 indicating the degree of transparency of the drop shadow. A value of 256 makes the drop shadow completely opaque.

'imag'

Image font data. This atom contains two more atoms. An 'idat' atom contains compressed image data to be used to draw the text when the required fonts are not available. An 'idsc' atom contains a video sample description describing the format of the compressed image data.

'metr'

Image font highlighting. This atom contains metric information that governs highlighting when an 'imag' atom is used for drawing.

Hypertext and Wired Text

Hypertext is used as an action that takes you to a Web URL; like a Web URL, it appears blue and underlined. Hypertext is stored in a text track sample atom stream as type 'htxt'. The same mechanism is used to store wired actions linked to text strings. A text string can be wired to act as a hypertext link when clicked or to perform any defined QuickTime wired action when clicked. For details on wired actions, see “Wired Action Grammar.”

The data stored is a QTAtomContainer. The root atom of hypertext in this container is a wired-text atom of type 'wtxt'. This is the parent for all individual hypertext objects.

For each hypertext item, the parent atom is of type 'htxt'. This is the atom container atom type. Two children of this atom that define the offset of the hypertext in the text stream are

kRangeStart         strt // unsigned long
kRangeEnd           end  // unsigned long

Child atoms of the parent atom are the events of type kQTEventType and the ID of the event type. The children of these event atoms follow the same format as other wired events.

 
kQTEventType, (kQTEventMouseClick, kQTEventMouseClickEnd,
                    kQTEventMouseClickEndTriggerButton,
                    kQTEventMouseEnter, kQTEventMouseExit)
...
kTextWiredObjectsAtomType, 1
    kHyperTextItemAtomType, 1..n
         kRangeStart, 1
            long
        kRangeEnd, 1
            long
 
    kAction     // The known range of track movie sprite actions
 


< Previous PageNext Page > Hide TOC


Last updated: 2007-09-04




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice