|
<< Click To Display Table Of Contents >> You Are Here: Macros For Effects > General Resources > Using Text |
The following table provides an overview of all functions to modify text:
Function |
Description |
void EditableTextSetText(string value) |
Sets the text to display. |
string EditableTextGetText() |
Returns the currently displayed text. |
void EditableTextSetTextRotationMode(int value) |
Sets the text Rotation mode. See below for a list of constants. |
int EditableTextGetTextRotationMode() |
Returns the current text Rotation mode. See below for a list of constants. |
void EditableTextSetTextSplittingMode(int value) |
Sets the text Splitting mode. See below for a list of constants. |
int EditableTextGetTextSplittingMode() |
Returns the current text Splitting mode. See below for a list of constants. |
void EditableTextSetRepeatText(int value) |
Use value 1 (TRUE) to activate Repeat Text, which means that the text is repeated to fill empty space. Use value 0 (FALSE) to deactivate it. |
int EditableTextGetRepeatText() |
Returns 1 (TRUE) if Repeat Text is activated, otherwise 0 (FALSE). |
void EditableTextToggleRepeatText() |
Activates or deactivates Repeat Text, depending on the current state. |
void EditableTextSetReverseWords(int value) |
Use value 1 (TRUE) to invert the words' order, for example "Music makes the light" becomes "light the makes Music". Use value 0 (FALSE) to use the default setting. |
int EditableTextGetReverseWords() |
Returns 1 (TRUE) if the words' order is inverted, otherwise 0 (FALSE). |
void EditableTextToggleReverseWords() |
Inverts the words' order or uses the default setting, depending on the current state. |
void EditableTextSetReverseCharacters(int value) |
Use value 1 (TRUE) to invert the characters' order, for example "Music makes the light" becomes "thgil eht sekam cisuM". Use value 0 (FALSE) to use the default setting. |
int EditableTextGetReverseCharacters() |
Returns 1 (TRUE) if the characters' order is inverted, otherwise 0 (FALSE). |
void EditableTextToggleReverseCharacters() |
Inverts the characters' order or uses the default setting, depending on the current state. |
void EditableTextSetFontFaceName(string value) |
Sets the font face name. Valid values for value should not exceed a length of 31 characters. |
string EditableTextGetFontFaceName() |
Returns the current font face name. |
void EditableTextSetFontHeight(int value) |
Sets the font height. Valid values for value can be positive or negative. However, positive and negative values are interpreted differently. Value 0 uses a default font height. |
int EditableTextGetFontHeight() |
Returns the current font height. |
void EditableTextSetFontWidth(int value) |
Sets the font width. Valid values for value should be positive. |
int EditableTextGetFontWidth() |
Returns the current font width. |
void EditableTextSetFontWeight(int value) |
Sets the font weight. Valid values for value range from 0 to 1000. |
int EditableTextGetFontWeight() |
Returns the current font weight. |
void EditableTextSetFontItalic(int value) |
Use value 1 (TRUE) to display italic text. Use value 0 (FALSE) to use the default setting. |
int EditableTextGetFontItalic() |
Returns 1 (TRUE) if the displayed text is italic, otherwise 0 (FALSE). |
void EditableTextToggleFontItalic() |
Displays italic text or uses the default setting, depending on the current state. |
void EditableTextSetFontUnderline(int value) |
Use value 1 (TRUE) to display underlined text. Use value 0 (FALSE) to use the default setting. |
int EditableTextGetFontUnderline() |
Returns 1 (TRUE) if the displayed text is underlined, otherwise 0 (FALSE). |
void EditableTextToggleFontUnderline() |
Displays underlined text or uses the default setting, depending on the current state. |
void EditableTextSetFontStrikeOut(int value) |
Use value 1 (TRUE) to display struck out text. Use value 0 (FALSE) to use the default setting. |
int EditableTextGetFontStrikeOut() |
Returns 1 (TRUE) if the displayed text is struck out, otherwise 0 (FALSE). |
void EditableTextToggleFontStrikeOut() |
Displays struck out text or uses the default setting, depending on the current state. |
Not all effects which use text offer the text rotation mode, the text splitting mode, or the possibilities to render repeated text and to reverse the words/characters. Therefore, the appropriate functions are only available if the effect offers the features.
Constant |
Description |
|---|---|
int ROTATION_CCW_0 |
Does not activate Rotation. Is the same as ROTATION_CW_0. |
int ROTATION_CCW_90 |
Rotates by 90 degrees in counter-clockwise direction. Is the same as ROTATION_CW_270. |
int ROTATION_CCW_180 |
Rotates by 180 degrees in counter-clockwise direction. Is the same as ROTATION_CW_180. |
int ROTATION_CCW_270 |
Rotates by 270 degrees in counter-clockwise direction. Is the same as ROTATION_CW_90. |
int ROTATION_CW_0 |
Does not activate Rotation. Is the same as ROTATION_CCW_0. |
int ROTATION_CW_90 |
Rotates by 90 degrees in clockwise direction. Is the same as ROTATION_CCW_270. |
int ROTATION_CW_180 |
Rotates by 180 degrees in clockwise direction. Is the same as ROTATION_CCW_180. |
int ROTATION_CW_270 |
Rotates by 270 degrees in clockwise direction. Is the same as ROTATION_CCW_90. |
Constant |
Description |
|---|---|
int TEXT_SPLITTING_NONE |
Treats the whole text as a single object. |
int TEXT_SPLITTING_WORDS |
Treats every word of the text as a separate object. |
int TEXT_SPLITTING_CHARACTERS |
Treats every character of the text as a separate object. |
This macro example parses the displayed text for comma-separated format tags: "italic", "bold" and font face names are recognized. Numbers are interpreted as font height. It works with the »SCE Graph effect, for example. Just set the shape type to text and edit it. For example, set the text to "italic, Comic Sans MS, 16" and the text is displayed automatically with this format. Of course, the same text is displayed on the matrix. That is why this is only a test scenario.
@scriptname="";
@author="";
@version="";
@description="";
void InitEffect()
{
SetShapeType(SHAPE_TYPE_TEXT);
}
void PreRenderEffect()
{
// default values
int fontHeight = 12;
int fontWeight = 400;
int isItalic = false;
string faceName = "MS Sans Serif";
string text = EditableTextGetText(), token;
string tokens[];
// parse values
tokenize(text, ",", tokens);
for (int i = 0; i < tokens.length; i++)
{
token = tokens[i];
tolower(token); // compare keywords case-insensitive
strip(token); // remove whitespace around keywords
if (token.length == 0)
continue;
else if (isnum(token) == true)
fontHeight = (int)token;
else if (token == "bold")
fontWeight = 800;
else if (token == "italic")
isItalic = true;
else
faceName = token;
}
// set values
EditableTextSetFontHeight(fontHeight);
EditableTextSetFontWeight(fontWeight);
EditableTextSetFontItalic(isItalic);
EditableTextSetFontFaceName(faceName);
}
void PostRenderEffect()
{
}
void MatrixSizeChanged()
{
InitEffect();
}
| MADRIX 3.23. |
| [Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100% |
|
Previous Next
|
|
Enable Automatic Translation | Activer La Traduction Automatique | 启用自动翻译 |