## FuSimple expression for Font Change

3dmus
Posts: 37
Joined: Sat Jan 10, 2015 3:14 am

### Simple expression for Font Change

Hey all - I was wondering something. The other day I needed to use an expression to change the font on-the-fly. I noticed that whilst you can right click the font drop down you can select "expression" . However, it doesn't show any box to enter the expression. I worked around this by copying the node to a text editor and to add the expression there. This works well, but I was wondering if there's any reason that it doesn't show the expression box? Is this a bug?

SirEdric
Fusionator
Posts: 1710
Joined: Tue Aug 05, 2014 10:04 am
Real name: Eric Westphal
Been thanked: 74 times
Contact:

### Re: Simple expression for Font Change

Looks like a bug to me, related to the FontEdit Control. Even when you try to add one of those via EditControls, it won't show up...

3dmus
Posts: 37
Joined: Sat Jan 10, 2015 3:14 am

### Re: Simple expression for Font Change

Thanks for confirming Eric

SecondMan
Posts: 3338
Joined: Thu Jul 31, 2014 5:31 pm
Been thanked: 63 times
Contact:

### Re: Simple expression for Font Change

3dmus wrote:
Sun Feb 17, 2019 7:43 am
Thanks for confirming Eric
Moving this to the Bug Tracker, thanks for reporting and confirming

Any chance you could post your setup with said expression to illustrate/reproduce?

3dmus
Posts: 37
Joined: Sat Jan 10, 2015 3:14 am

### Re: Simple expression for Font Change

Sure thing! So, for the below comp I right clicked to add an expression to the font field. This doesn't show up, but when you take it into a text editor you can see that a standard expression has been added (something like "Text(\"Open Sans"\)).

Functionality wise it works, when I add the below expression for both the Text box and the Font, it cycles through a few fonts and then displays the name of the font with the correct font (if that makes sense!). Now I have to say, that whilst it works, I've seen some erratic behaviour which sometimes disappears after re-starting Fusion. Maybe that's why they never enabled the field to appear? Not sure really.

Code: Select all

:myarray={"Arial","Century Gothic","Impact"}; index=(floor(time/24)%3)+1; return Text(myarray[index]);
Full node:

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" }, },
Font = Input {
Value = "Arial",
Expression = ":myarray={\"Arial\",\"Century Gothic\",\"Impact\"}; index=(floor(time/24)%3)+1; return Text(myarray[index]);",
},
StyledText = Input {
Value = "Arial",
Expression = ":myarray={\"Arial\",\"Century Gothic\",\"Impact\"}; index=(floor(time/24)%3)+1; return Text(myarray[index]);",
},
Style = Input { Value = "Regular", },
ManualFontKerningPlacement = Input {
Value = StyledText {
Array = {
},
Value = ""
},
},
},
ViewInfo = OperatorInfo { Pos = { 325, 138 } },
}
},
ActiveTool = "Text1_1"
}