• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

extendScript: How you can edit a font in MOGRT

Explorer ,
Jan 23, 2025 Jan 23, 2025

Copy link to clipboard

Copied

I created a MOGRT in after effect. Simple. It has a text field, as well as the ability to edit the font: size, font itself, and set bold, italic and AllCaps.
When I add this MOGRT to the timeline, I would like to change the font and font size. How can I do this except through a JSON object?

i.e. I can do
getValue(), then
JSON.parce(), replace the necessary parameters,
JSON.stringify()
and apply the changed string to the parameter.

But on some computers (it doesn't matter on macOS or windows) there were problems with inserting multiline text. if it is inserted just through setValue('multilinText') - everything is fine... But how to edit the font size or change the font itself?

TOPICS
Error or problem , SDK

Views

155

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Adobe Employee , Jan 25, 2025 Jan 25, 2025

Earlier, you implied that your JSON solution worked on some computers, but not others:

But on some computers...


That suggests that your method can work, and (as I mentioned) the next step should be for you to figure out the difference between those systems on which your approach works, and those on which it does not.

Votes

Translate

Translate
Explorer , Jan 26, 2025 Jan 26, 2025

In other words, you want to say that you can't change font or size except via JSON.

Votes

Translate

Translate
Community Expert ,
Jan 23, 2025 Jan 23, 2025

Copy link to clipboard

Copied

@Bruce Bullis 

Can you help here?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 23, 2025 Jan 23, 2025

Copy link to clipboard

Copied

But on some computers...

I think the key will be in determining what makes those 'some computers', special.

One possibility: the global ExtendScript JSON object is only available if the Libraries panel is currently visible. For more reliable JSON object availability, you may wish to use Douglas Crockford's JSON2.js

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 23, 2025 Jan 23, 2025

Copy link to clipboard

Copied

I apologize, but that wasn't the question.
I always have JSON integrated directly into the code at the very beginning of the file. Always.

Judging by these posts ( this and this, and a few others )- using JSON conversion is considered not the best result. and kind of not even supported. So how to change font size and font itself in this case?

Or is it still necessary to use JSON conversion to solve these problems?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 24, 2025 Jan 24, 2025

Copy link to clipboard

Copied

I'm glad you're not relying on the unreliable global JSON object. 🙂

Determining the difference(s) between those systems on which you see the failure, and those on which you do not, remains the best approach to resolving the issue.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 24, 2025 Jan 24, 2025

Copy link to clipboard

Copied

So how to change font size and font itself in this case?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 25, 2025 Jan 25, 2025

Copy link to clipboard

Copied

Earlier, you implied that your JSON solution worked on some computers, but not others:

But on some computers...


That suggests that your method can work, and (as I mentioned) the next step should be for you to figure out the difference between those systems on which your approach works, and those on which it does not.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 26, 2025 Jan 26, 2025

Copy link to clipboard

Copied

In other words, you want to say that you can't change font or size except via JSON.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 26, 2025 Jan 26, 2025

Copy link to clipboard

Copied

I've had success with CSV. 

Here's a sample - 

DS,component,semanticName,fontName,fontSize,leading,leadingScalar,tracking,startDate
CreativeCOW,ParaText_A,Headline,MyriadPro-Bold,120,80,1.2,30,June11-2023
CreativeCOW,ParaText_A,subHeadline - 0,MyriadPro-Bold,32,NA,NA,42,June11-2023
CreativeCOW,ParaText_A,subHeadline - 1,MyriadPro-Regular,32,NA,NA,42,June11-2023
CreativeCOW,ParaText_A,subHeadline - 2,MyriadPro-Regular,32,NA,NA,42,June11-2023
CreativeCOW,ParaText_A,Para Text -1,MyriadPro-Regular,34,34,1.2,34,June11-2023
CreativeCOW,ParaText_A,Para Text -2,MyriadPro-Regular,34,34,1.2,34,June11-2023
CreativeCOW,ParaText_A,ParaText Highlight -1,MyriadPro-Regular,30,30,1.2,30,June11-2023
CreativeCOW,ParaText_A,ParaText Highlight -2,MyriadPro-Bold,30,30,1.2,30,June11-2023
CreativeCOW,ParaText_A,Footer- CREATIVE,MyriadPro-Regular,36,20,1.2,36,June11-2023
CreativeCOW,ParaText_A,Footer- COW,MyriadPro-Bold,36,20,1.2,36,June11-2023
CreativeCOW,ParaText_A,Footer- .NET,MyriadPro-Regular,36,20,1.2,36,June11-2023
CreativeCOW,ParaText_A,Footer- Quote,MyriadPro-Semibold,32,15,1.2,32,June11-2023
CreativeCOW,ParaText_A,Quote_subText1,MyriadPro-Semibold,32,28,1.2,32,June11-2023

And if you drop the CSV into the AE Timeline and your Expressions reference the timeline instance of the CSV/data, in PPro, you can load up an alternative CSV from the MoGRT (Properties Panel in v25 - Essential Graphics Panel v24 and earlier), from a Timeline instance of the MoGRT.

HTH


Very Advanced After Effects Training | Adaptive & Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 26, 2025 Jan 26, 2025

Copy link to clipboard

Copied

LATEST

I know what you're talking about, but it's not the answer.
Now I can change everything via JSON. But it works with a single line of text - always, but with multiline text in several lines - not always. and although I do not plan multiline text, but I would like to know how to properly change the font, size, and other parameters without JSON.parse()....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines