Copy link to clipboard
Copied
Hey all! I have the following expression in a template:
comp("_CHANGE_LANGUAGE_HERE_").layer("Story01_End").text.sourceText.split("§").join("\r");
text.sourceText.style.setFont("Oswald-Bold");
The first part grabs a text from a tsv file, selects a language using a dropdown and adds line breaks based on the "§" symbols in that text. That works fine. We've recently added a new language that requres a different font (Omnes vs OmnesGreek, both from Adobe Fonts), because it can't display the greek letters.
So I'm planning to change the font to the Greek version, if the dropdown "GR" is selected. However, as a basic proof of concept I'm trying it without any of that logic here, just trying to override the font panel font with the new font (in the example Oswald-Bold is selected, that's a copy error but I can't edit the code snippet, ignore that).
But this doesn't work. With the first bit of code, I can change the language and it supplies the text from the tsv. As soon as I add the setFont line, it changes the font – but reverts the text to the default content of the text box, which is simply empty.
Am I combining these wrong? This should be possible, right?
(If I place the setFont line first, it just does nothing at all)
M
Thank you!
I haven't tested this, but try it this way:
txt = comp("_CHANGE_LANGUAGE_HERE_").layer("Story01_End").text.sourceText.split("§").join("\r");
text.sourceText.style.setFont("Oswald-Bold").setText(txt);
Copy link to clipboard
Copied
I haven't tested this, but try it this way:
txt = comp("_CHANGE_LANGUAGE_HERE_").layer("Story01_End").text.sourceText.split("§").join("\r");
text.sourceText.style.setFont("Oswald-Bold").setText(txt);
Copy link to clipboard
Copied
It does! Thanks a bunch and have a happy weekend 🙂