Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions TextDocument.fontStyle does not work – any thoughts?

  • TextDocument.fontStyle does not work – any thoughts?

    Posted by Ryan Mcadam on August 15, 2018 at 6:12 pm

    Hey all,

    I know this is a scripting question and not an expression question but I didn’t see a scripting form.

    Windows 10
    After Effects 2018 v15.1.2
    Font using: Gotham

    I’m creating a UI tool that lets me change font and style of a text layer/s with the click of a button. I can access the TextDocument easy enough and it’s font property, but the fontStyle property doesn’t seem to work. I’ve checked scripting documentation and all over the web. Can’t find a solution.

    Code:
    TextDocument.font = "Gotham"; //This works
    TextDocument.fontStyle = "bold"; //This does not

    Note: If I hyphenate the font name and style (“Gotham-Bold”) and push that into the font property of the text document it will work! But, only for that particular pairing and nothing else.

    Any suggestions you guys have would be awesome. Thank you so much.

    Ryan

    Ryan Mcadam replied 7 years, 11 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    August 15, 2018 at 6:15 pm

    I think fontStyle is read-only.

    Dan

  • Ryan Mcadam

    August 15, 2018 at 6:40 pm

    Thanks for the response, Dan.

    Looks like your right.
    It is a Read-only attribute.
    Any idea on how to change that using Extendscript?

  • Dan Ebberts

    August 15, 2018 at 6:42 pm

    I don’t think there’s a way.

    Dan

  • Ryan Mcadam

    August 15, 2018 at 6:53 pm

    I got a suggestion from David Torno. He suggested I set the text font and style manually then read the value via script. The script value returned was different from the UI value I input manually. So all I had to do was set the text font and style manually get the value via script and then use that value in my variable to make the script work.

    Thanks again for the help, Dan.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy