Using Text

   Print  Previous  Next

Functions Provided For Setting 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 TRUE to activate Repeat Text, which means that the text is repeated to fill empty space. Use value FALSE to deactivate it.

int EditableTextGetRepeatText()

Returns TRUE if Repeat Text is activated, otherwise FALSE.

void EditableTextToggleRepeatText()

Activates or deactivates Repeat Text, depending on the current state.

void EditableTextSetReverseWords(int value)

Use value TRUE to invert the words' order, for example "Music makes the light" becomes "light the makes Music". Use value FALSE to use the default setting.

int EditableTextGetReverseWords()

Returns TRUE if the words' order is inverted, otherwise FALSE.

void EditableTextToggleReverseWords()

Inverts the words' order or uses the default setting, depending on the current state.

void EditableTextSetReverseCharacters(int value)

Use value TRUE to invert the characters' order, for example "Music makes the light" becomes "thgil eht sekam cisuM". Use value FALSE to use the default setting.

int EditableTextGetReverseCharacters()

Returns TRUE if the characters' order is inverted, otherwise 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 TRUE to display italic text. Use value FALSE to use the default setting.

int EditableTextGetFontItalic()

Returns TRUE if the displayed text is italic, otherwise FALSE.

void EditableTextToggleFontItalic()

Displays italic text or uses the default setting, depending on the current state.

void EditableTextSetFontUnderline(int value)

Use value TRUE to display underlined text. Use value FALSE to use the default setting.

int EditableTextGetFontUnderline()

Returns TRUE if the displayed text is underlined, otherwise FALSE.

void EditableTextToggleFontUnderline()

Displays underlined text or uses the default setting, depending on the current state.

void EditableTextSetFontStrikeOut(int value)

Use value TRUE to display struck out text. Use value FALSE to use the default setting.

int EditableTextGetFontStrikeOut()

Returns TRUE if the displayed text is struck out, otherwise FALSE.

void EditableTextToggleFontStrikeOut()

Displays struck out text or uses the default setting, depending on the current state.

 

Remarks

Not all effects which use text offer the text splitting mode as well as 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.

 

Rotation Mode Constants

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.

 

Text Splitting Mode Constants

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.

 

Deprecated Functions

Deprecated functions are outdated functions and should not be used anymore.

Function/Constant

Description

void EditableTextSetContinuousText(int value)

Use EditableTextSetRepeatText instead.

int EditableTextGetContinuousText()

Use EditableTextGetRepeatText instead.

void EditableTextToggleContinuousText()

Use EditableTextToggleRepeatText instead.

 

MADRIX 2.X To MADRIX 3.X Migration Hints

The following functions and constants are not supported anymore. Please follow the hints to migrate your macros.

Function/Constant

Description

void SetText(string text)

Use EditableTextSetText(string value) instead.

string GetText()

Use EditableTextGetText() instead.

void SetContinuous(int enable)

Use EditableTextSetRepeatText(int value) instead.

int GetContinuous()

Use EditableTextGetRepeatText() instead.

void SetRotation(int angle)

Use EditableTextSetTextRotationMode(int value) with one of the above mentioned text splitting mode constants instead. Note that the former numerical values (angle) described the angle in clockwise direction.

int GetRotation()

Use EditableTextGetTextRotationMode() which returns one of the above mentioned text splitting mode constants instead. Note that the former numerical return values described the angle in clockwise direction.

void SetMode(int mode)

Use EditableTextSetTextSplittingMode(int value) with one of the above mentioned text splitting mode constants instead.

int GetMode()

Use EditableTextGetTextSplittingMode() which returns one of the above mentioned text splitting mode constants instead.

void SetFontFaceName(string name)

Use EditableTextSetFontFaceName(string value) instead.

string GetFontFaceName()

Use EditableTextGetFontFaceName() instead.

void SetFontHeight(int value)

Use EditableTextSetFontHeight(int value) instead.

int GetFontHeight()

Use EditableTextGetFontHeight() instead.

void SetFontWidth(int value)

Use EditableTextSetFontWidth(int value) instead.

int GetFontWidth()

Use EditableTextGetFontWidth() instead.

void SetFontWeight(int value)

Use EditableTextSetFontWeight(int value) instead.

int GetFontWeight()

Use EditableTextGetFontWeight() instead.

void SetFontItalic(int value)

Use EditableTextSetFontItalic(int value) instead.

int GetFontItalic()

Use EditableTextGetFontItalic() instead.

void SetFontUnderline(int value)

Use EditableTextSetFontUnderline(int value) instead.

int GetFontUnderline()

Use EditableTextGetFontUnderline() instead.

void SetFontStrikeOut(int value)

Use EditableTextSetFontStrikeOut(int value) instead.

int GetFontStrikeOut()

Use EditableTextGetFontStrikeOut() instead.

MODE_SENTENCE

Use TEXT_SPLITTING_NONE instead.

MODE_WORD

Use TEXT_SPLITTING_WORDS instead.

MODE_CHAR

Use TEXT_SPLITTING_CHARACTERS instead.

 

Example

This macro example for SCE Graph 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 = "Arial";

 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 Version: 3.6j | Script Version: 2.22
[Ctrl & +/-] = Zoom In/Out | [Ctrl & 0] = 100%
Print   Previous   Next