Well, it's
possible, but I have my doubts about more efficient. Here's an example:
- Code: Select all
{
Tools = ordered() {
Text1_1 = TextPlus {
CtrlWZoom = false,
Inputs = {
Width = Input { Value = 1920, },
Height = Input { Value = 1080, },
["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
LayoutRotation = Input { Value = 1, },
TransformRotation = Input { Value = 1, },
Softness1 = Input { Value = 1, },
StyledText = Input { Value = "Fusion", },
Font = Input {
Value = "Symbola",
Expression = ":fontlist = {[1] = \"Open Sans\", [2] = \"Arial\", [3] = \"Courier New\", [4] = \"Papyrus\", [5] = \"Symbola\"}; index = FontPicker; return Text(fontlist[index])",
},
Style = Input { Value = "Regular", },
VerticalJustificationNew = Input { Value = 3, },
HorizontalJustificationNew = Input { Value = 3, },
FontPicker = Input { Value = 5, },
},
ViewInfo = OperatorInfo { Pos = { 452, 20.0909 } },
UserControls = ordered() {
FontPicker = {
INP_MaxAllowed = 5,
INP_Integer = true,
INPID_InputControl = "SliderControl",
INP_Default = 1,
INP_MinScale = 1,
INP_MinAllowed = 1,
LINKID_DataType = "Number",
ICS_ControlPage = "Text",
LINKS_Name = "Font Picker",
}
}
}
}
}
Part of the problem is that when you set an expression on the Font control, it doesn't display an expression box. But the expression is still there! You have to open a text editor to modify it.
First, you need to enable the multi-statement expression mode by starting the expression with a colon :
In this mode, you write the expression without line-breaks, but end each statement with a semi-colon ;
Also, you have to use an explicit "return" statement to send the results back to the control.
I enclosed the thing in double brackets [[ ]], which turns a string into a string literal, meaning all of the characters are treated as what they are instead of allowing any magic characters to do their thing. That removes the need to escape the quote marks with backslashes. The ordered table fontlist maps integers to font names, so the FontPicker control can choose from the list.
Take note that not every font has the same styles available; I set that input to "Regular" so the fonts I chose would all render without needing to futz with it.