Fu Simple expression for Font Change

Moderator: Chad

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

Simple expression for Font Change

#1

Post by 3dmus » Sun Feb 17, 2019 6:45 am

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?

User avatar
SirEdric
Fusionator
Posts: 1873
Joined: Tue Aug 05, 2014 10:04 am
Answers: 2
Real name: Eric Westphal
Been thanked: 112 times
Contact:

Re: Simple expression for Font Change

#2

Post by SirEdric » Sun Feb 17, 2019 7:36 am

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: 39
Joined: Sat Jan 10, 2015 3:14 am

Re: Simple expression for Font Change

#3

Post by 3dmus » Sun Feb 17, 2019 7:43 am

Thanks for confirming Eric :-)

User avatar
SecondMan
Site Admin
Posts: 3478
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 5
Location: Vancouver, Canada
Been thanked: 92 times
Contact:

Re: Simple expression for Font Change

#4

Post by SecondMan » Sun Feb 17, 2019 11:08 pm

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: 39
Joined: Sat Jan 10, 2015 3:14 am

Re: Simple expression for Font Change

#5

Post by 3dmus » Tue Feb 19, 2019 11:09 am

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"
}