返回 AiToEarn
1 # Text
2
3 Text editing includes content, position, size, style, orientation, and animation. Treat the MCP contract
4 below as hard input and readback requirements. Treat the later editorial guidance as quality guidance that
5 the MCP does not necessarily enforce.
6
7 ## MCP Text Contract
8
9 ### Field Placement
10
11 Place `content`, `offset_x`, and `offset_y` at the root of each text Add or Update item. Apply the same
12 rule to `shared.add` and `shared.update`. Do not place these fields inside `text_style`; `text_style`
13 only carries typography, appearance, orientation, text-box alignment, and text animation.
14
15 `content` accepts at most 10,000 characters. `offset_x` and `offset_y` must be integers. These fields
16 apply only to text elements.
17
18 ### Adding Text
19
20 Every text Add must provide both `horizon` and `vertical`. Use `left`, `center`, or `right` for
21 `horizon`, and `top`, `center`, or `bottom` for `vertical`. Text does not support `pos_x` or `pos_y`.
22
23 Do not provide `width` or `height` when adding text. New horizontal text uses 80% of the canvas width
24 and derives its height from the rendered content. New vertical text uses 80% of the canvas height and
25 derives its width from the rendered content. Always provide meaningful `content`; otherwise the editor's
26 placeholder text may remain.
27
28 Use concrete values in tool calls rather than enum-like expressions such as `"center" | "left"`.
29 For example, the following `edit_element` argument fragment adds one text element; include `project_id` when required by the current schema:
30
31 ```json
32 {
33 "adds": [
34 {
35 "type": "text",
36 "from_time_ms": 0,
37 "duration_ms": 3000,
38 "horizon": "center",
39 "vertical": "bottom",
40 "content": "Hello World",
41 "offset_y": -100,
42 "text_style": {
43 "font_size": 40,
44 "text_align": "center"
45 }
46 }
47 ]
48 }
49 ```
50
51 Omit `track_id` to use automatic track selection. Provide an existing compatible text-track ID only when
52 the text must be placed on that specific track.
53
54 ### Updating Text Size
55
56 For existing horizontal text, only `width` may be updated; do not provide `height`. For existing vertical
57 text, only `height` may be updated; do not provide `width`. Use `text_style.font_size` to change glyph size.
58
59 `font_size` must be an integer from 1 to 1000 and uses the same pixel coordinate scale as the canvas.
60
61 ### Text Orientation and Alignment
62
63 Use `text_style.text_align` for horizontal text, with `left`, `center`, or `right`. Use
64 `text_style.alignment` for vertical text, with `top`, `center`, or `bottom`. Do not provide both fields
65 in the same item. Setting either field also selects the corresponding horizontal or vertical orientation.
66
67 These fields are alternative writing orientations, not two independent positioning axes. Even
68 `{"text_align": "center", "alignment": "center"}` is invalid. To center horizontal text on the canvas,
69 use root-level `horizon: "center"` and `vertical: "center"`, with only `text_style.text_align: "center"`
70 for alignment inside the text box. Omit both style alignment fields when an update should preserve the
71 existing orientation and alignment.
72
73 For horizontal text, `\n` starts a new row. For vertical text, `\n` starts a new column.
74
75 ### Text Positioning
76
77 Use `horizon` and `vertical` for semantic nine-grid placement. Reserve root-level `offset_x` and `offset_y`
78 for fine adjustment and collision avoidance. A positive `offset_x` moves text right, and a negative value
79 moves it left. A positive `offset_y` moves text down, and a negative value moves it up.
80
81 The MCP keeps text within a 10-pixel safe inset on every canvas edge. Offsets are clamped to that safe
82 area. If the rendered text itself is larger than the available safe area, the entire edit batch is rejected.
83 Reduce the font size, shorten the content, or, when updating existing text, adjust the supported fixed axis.
84
85 ### Text Style
86
87 `text_style` supports `text_res`, `font_type`, `font_size`, `font_color`, `bold`, `italic`, `underline`,
88 `background_color`, `background_border_size`, `border`, `text_align`, `alignment`, and `text_animation`.
89
90 Use the editor's `#RRGGBBAA` format for colors. `background_border_size` must be a non-negative integer
91 in canvas pixels and expands the background equally on all four sides. A value of `0` keeps the background
92 at the rendered text bounds.
93
94 Use `list_resources` to obtain `font_type` and `text_res` IDs. The default font is `思源黑体 Bold`.
95 The public MCP contract does not expose text shadows, rich-text spans, or multiple colors inside one text
96 element. When individual words require different styles, use separate text elements and position them
97 explicitly.
98
99 ### Text Animation Contract
100
101 `text_style.text_animation` may contain `in`, `out`, and `loop`, and must contain at least one stage.
102 Each stage must provide both `resource_id` and an integer `duration_ms` of at least 100 milliseconds.
103
104 Use `list_resources` to obtain the matching resource category:
105
106 - `in`: `enter_animation`
107 - `out`: `out_animation`
108 - `loop`: `loop_animation`
109
110 The MCP validates the animation structure and minimum stage duration. It does not verify that the combined
111 animation duration leaves enough time to read the text.
112
113 ### Shared Text Defaults
114
115 In `shared.add` and `shared.update`, keep `content`, `offset_x`, and `offset_y` at the template root and
116 place styling fields inside `text_style`. Each shared template must declare `type: "text"`. An individual
117 Add or Update item overrides the corresponding shared value; nested style objects are merged.
118
119 Check the merged style as well as each individual item: `shared.update.text_style.text_align` plus an
120 item's `text_style.alignment` still supplies both fields and is rejected (the same applies to adds).
121 For a batch mixing horizontal and vertical text, omit alignment fields from the shared template and
122 set the appropriate one per item. When correcting this error, check both shared and item styles;
123 retain only the field for the intended orientation. Do not copy an entire readback style into an update
124 when only a few properties need changing.
125
126 ### Verification
127
128 After adding or updating text, call `inspect_elements` for the affected element IDs. Read `content`,
129 `offset_x`, and `offset_y` from the element root. Read typography, appearance, orientation, alignment, and
130 animation from `text_style`.
131
132 Text inspection does not expose `pos_x` or `pos_y`. Use `horizon`, `vertical`, `offset_x`, and `offset_y`
133 as the public positioning contract. Read back the final values instead of treating a successful write as
134 proof that the requested layout was preserved.
135
136 ## Editorial Guidance
137
138 ### Text Size
139
140 Derive a visually appropriate integer `font_size` from the canvas. For ordinary subtitles, start around
141 3.75% of the long edge. As editorial guidance, text intended for normal viewing should generally remain
142 between 1.5% and 12% of the long edge, depending on its role and viewing context.
143
144 Recommended proportions for common text types, using a canvas long edge of 1920:
145
146 | Text type | Recommended long-edge ratio | Default | At 1920 long edge |
147 |---|---:|---:|---:|
148 | Standard film/documentary subtitles | 3.5%–4.2% | 3.75% | 72 |
149 | Landscape talking-head subtitles | 3.8%–4.5% | 4.1% | 79 |
150 | Portrait mobile subtitles | 4.2%–5.0% | 4.5% | 86 |
151 | Emphasis subtitles for short video | 4.8%–6.0% | 5.4% | 104 |
152 | Large opening hook | 6%–9% | 7.5% | 144 |
153 | Main video title | 5.5%–8% | 6.5% | 125 |
154 | Chapter/transition title | 4%–5.5% | 4.5% | 86 |
155 | Quote/key point | 3.8%–5.5% | 4.5% | 86 |
156 | Informational text | 2.6%–3.6% | 3% | 58 |
157 | Lower-third primary name | 2.5%–3.2% | 2.8% | 54 |
158 | Lower-third role/description | 1.8%–2.4% | 2.1% | 40 |
159 | Label/corner badge | 2%–2.8% | 2.4% | 46 |
160 | CTA text | 3.2%–4.5% | 3.8% | 73 |
161 | Price/data/countdown | 7%–12% | 9% | 173 |
162 | Watermark/account | 1.2%–1.8% | 1.5% | 29 |
163 | Source/note | 1.5%–2.2% | 1.8% | 35 |
164 | Disclaimer | 1.8%–2.5% | 2.1% | 40 |
165 | End-card title | 6%–9% | 7% | 134 |
166 | End-card description | 2.8%–3.8% | 3.2% | 61 |
167 | Credits | 2.2%–3.2% | 2.6% | 50 |
168
169 ### Text Style
170
171 Basic text styling includes font, decorative text, color, bold, italic, underline, background, and border.
172 Decorative text is generally suitable for short titles, but not recommended for subtitles, body text, or
173 explanatory text. Bold and underline are for emphasis. Unless the request or visual context calls for them,
174 prefer the default font and avoid unnecessary decorative text, bold, italic, or underline styling.
175
176 ### Text Animation
177
178 The following timing rules are editorial quality guidance, not MCP validation rules. Keep the combined
179 entrance and exit duration within the text display duration, and keep a loop cycle within that duration.
180 Leave enough stable display time after the entrance animation for the viewer to read the text. As a starting
181 point, keep stable reading time at least 1.5 times the entrance-animation duration.
182
183 ### Scene-Aware Text
184
185 Determine the role of the text before choosing its position and style. Subtitles make dialogue readable,
186 informational text identifies people, places, or steps, and display titles create mood and memorable
187 moments. Do not use all three to repeat the same information. Leave the frame free of text when the
188 visuals already communicate the intended message.
189
190 #### Position
191
192 - Place dialogue subtitles at the bottom center by default and limit them to two lines. In landscape video,
193 keep the bottom of the text about 6%–10% above the bottom edge of the canvas.
194 - For portrait video on short-form platforms, move subtitles into the lower-middle region to avoid controls
195 on the right and titles or progress indicators at the bottom. Inspect representative frames to ensure the
196 text does not cover important gestures, people, or objects.
197 - Use a lower-left or lower-right information block for names and roles. Place locations, chapter titles,
198 and opening keywords in the center or in negative space beside the subject.
199 - Keep labels near the person, product, or action they describe, but never cover faces, important actions,
200 product details, or existing on-screen text.
201 - Use the nine-grid values to express semantic placement. Reserve `offset_x` and `offset_y` for collision
202 avoidance and fine adjustment. The MCP's 10 px inset prevents overflow; it is not a recommended visual
203 margin.
204
205 #### Color
206
207 - Use white or near-white for ordinary subtitles. Add a dark stroke or translucent background when
208 needed to preserve readability across both bright and dark shots.
209 - `text_style.background_color` uses a `#RRGGBBAA` color string. `text_style.background_border_size`
210 uses a non-negative integer in Canvas pixels to expand the background equally on all four sides of
211 the text; `0` makes the background fit the text's rendered bounds.
212 - Use color only when it carries meaning, such as identifying a keyword, number, product name, brand,
213 correct or incorrect state, or speaker. Because one text element has one `font_color`, split words that
214 require distinct colors into separate text elements and position them explicitly.
215 - Keep one primary accent color throughout a video and add at most one status color when necessary. The same
216 color should always communicate the same meaning, so decorative color does not compete with information.
217 - Color does not replace contrast. If colored text blends into the footage, add a stroke or background, or
218 move the text to a clearer region.
219
220 #### Decorative Text
221
222 - Use decorative text for opening titles, location reveals, chapter cards, brand slogans, festive moments,
223 and a small number of key quotes. Keep it brief; Chinese display text should usually contain 2–8 characters.
224 - Use a clear standard typeface for dialogue subtitles, explanatory body text, instructions, specifications,
225 prices, and disclaimers.
226 - Match the typeface, texture, and animation to the video's tone, and keep the treatment consistent throughout
227 the video. Do not add decorative text merely because a resource is available.
228 - Reduce decoration, or switch to standard text on a background panel, when the footage is visually busy,
229 moves quickly, or requires the viewer to follow an important action.
230
231 #### Common Choices
232
233 | Scenario | Position | Color and style |
234 | --- | --- | --- |
235 | Film or documentary dialogue | Bottom center | White standard typeface with a dark stroke or translucent background; no decorative text |
236 | Talking-head or educational short | Lower-middle region | White body text with a small number of keywords in one accent color |
237 | Vlog or cinematic location reveal | Center or negative space | Larger type in white, a theme color, or context-appropriate decorative text |
238 | Person's name and role | Lower left or lower right | Larger name and smaller role; reserve brand color for a small label or bar |
239 | Promotional benefit, price, or slogan | Center or beside the subject | One key message per shot; use a brand or high-contrast color; short phrases may use decorative text |
240 | Tutorial annotation or product callout | Near the referenced object | Give colors consistent category meanings; add an arrow or background when needed |
241
241 lines MARKDOWN