Using Font-Families with Dynamic Text

New Here ,
May 30, 2017 May 30, 2017

Copy link to clipboard

Copied

Cannot seem to find the answer to this. In Edge you used to be able to define custom font families for fonts by writing them in a CSS sequence: Helvetica, Arial, Sans-Serif, etc

In animate CC 2017 I am looking for an option that lets me do this with dynamic text (for compliance reasons.) Right now if i wanted to use a font such as Helvetica Light, I could set it as dynamic (and the only font) but with no fallback any machine that does not have it seems to just default to the system font which is much bolder. The dropdown menu in the character panel only allows me to pick one font, so is there a way to set up a sequence for dynamic text within the interface? Webfont is not an option for me since some ad networks our client is running on cannot accept external font references.

Views

1.1K

Likes

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 1 Correct answer

Adobe Community Professional , May 30, 2017 May 30, 2017
As much as it pains me to suggest this, AFAIK the only current way to achieve this is to manually edit the generated JavaScript. So if you had a line like this:var InstanceObj = new createjs.Text(InstanceTxt, "12px Helvetica Light", "#000000");You could change it to:var InstanceObj = new createjs.Text(InstanceTxt, "12px Helvetica Light, Arial, sans-serif", "#000000");

Likes

Translate

Translate
Adobe Community Professional ,
May 30, 2017 May 30, 2017

Copy link to clipboard

Copied

As much as it pains me to suggest this, AFAIK the only current way to achieve this is to manually edit the generated JavaScript. So if you had a line like this:

var InstanceObj = new createjs.Text(InstanceTxt, "12px Helvetica Light", "#000000");

You could change it to:

var InstanceObj = new createjs.Text(InstanceTxt, "12px Helvetica Light, Arial, sans-serif", "#000000");

Likes

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
New Here ,
Mar 26, 2021 Mar 26, 2021

Copy link to clipboard

Copied

LATEST

Late to the party, but I just came across a need for this and came up with a solution that saves editing the generated JavaScript. If my solution is bad, pelase let me know 😉

 

Inside the first frame where I have access to that dynamic text field, I use a regex to replace the font name:

this.textField.font = this.textField.font.replace(/(.+\s)+(?:'?.+'?)$/, "$1Font, FirstAlternate, 'Third-Font', NumberFour");

Where this.textField is the dynamic text field and your font choices are "Font, FirstAlternate, 'Third-Font', NumberFour". The first capture group captures everything that comes before the original font name (italic, bold, size), and the non-capture group at the end just discards the original font so you can put your selections in. Usually, you'll probably include the original font in your choices, but because I don't know whether it is always surrounded in single quotes or not, I thought it was safer this way.

Using that, I was able to have our first choice on devices that support it, and a fallback on devices that don't. And aside from setting that up once, I don't have to remember to change it after each publish.

Likes

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
New Here ,
Nov 17, 2017 Nov 17, 2017

Copy link to clipboard

Copied

In some versions of Indesign (Japanese, Chinese, etc), there's option to create composite fonts, where you can define different fronts for different sets of languages. It could help you.

You can download those versions by changing the language in your CC preferences (the UI will still be in English as long as your system display language is English)

This method could also help: Change default font for fallback in PDF editing and Add Text

Likes

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 Community Professional ,
Nov 17, 2017 Nov 17, 2017

Copy link to clipboard

Copied

He didn't need a composite multi-language font, he needed fallback fonts if the preferred font wasn't installed on the user's system. That's a completely different problem.

Likes

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