Jump to: Board index » General » Fusion

Lua - change font in TextPlus - Help!

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

Ziggy Uszkurat

  • Posts: 19
  • Joined: Fri Sep 04, 2015 12:45 pm

Lua - change font in TextPlus - Help!

PostFri May 19, 2017 4:12 pm

Hi there,

I'm trying to programatically change the font in Text+ using a lua script. However, I can't find the Font Attribute. Can anyone point me in the right direction?

TIA
Ziggx
Offline

Chad Capeland

  • Posts: 1476
  • Joined: Mon Nov 10, 2014 9:40 pm

Re: Lua - change font in TextPlus - Help!

PostFri May 19, 2017 5:07 pm

Text1.Font = "Wingdings" works for me
Chad Capeland
Indicated, LLC
www.floweffects.com
Offline

Ziggy Uszkurat

  • Posts: 19
  • Joined: Fri Sep 04, 2015 12:45 pm

Re: Lua - change font in TextPlus - Help!

PostFri May 19, 2017 5:28 pm

Thanks Chad - can you tell me how to query the current font name in a Text+? I'm new to lua and the developer manuals a little spartan on detail.

TIA
Ziggy
Offline

Ziggy Uszkurat

  • Posts: 19
  • Joined: Fri Sep 04, 2015 12:45 pm

Re: Lua - change font in TextPlus - Help!

PostFri May 19, 2017 5:31 pm

Aah - just figured out. Thanks anyway.
Offline

Sander de Regt

  • Posts: 557
  • Joined: Thu Nov 13, 2014 10:09 pm

Re: Lua - change font in TextPlus - Help!

PostFri May 19, 2017 9:10 pm

Do you mind sharing what you found? It may help people who stumble across this thread as well.
Offline

Ziggy Uszkurat

  • Posts: 19
  • Joined: Fri Sep 04, 2015 12:45 pm

Re: Lua - change font in TextPlus - Help!

PostSun May 21, 2017 3:27 pm

Hi Sander,

I'm only just dipping into lua so there is probably a "right" way to do this, rather than my kludge - I needed to programatically change the font, font size and line spacing in a pre-existing comp. I put the following into a lua script with the extension .lua.scriptlib in the scripts/comp folder so it would run automatically when I opened a comp.
Code: Select all
-- get a list of Text+
texts=comp:GetToolList(false,"TextPlus")
   count=0
   for i, tool in pairs(texts) do
   -- do I need to do this?
   old=tool
   -- check to see if it has the font we want to change...
   if (old:GetInput("Font")=="High Sans Serif 7") then
      -- if yes, then change font, size and line spacing
      old.Font="PRST"
      old.Size=0.075
      old.LineSpacing=1.0
   end


That's it folks!

Return to Fusion

Who is online

Users browsing this forum: No registered users and 9 guests