Copy link to clipboard
Copied
I am making a AIR Desktop (Windows) application using Animate 18.0.2.
In Animate library I have incorporated some fonts I wish to use (and set up the linkage):
I use this code to dinamically select Roboto font:
var fontTitolo = new Roboto_titolo();
var formatoTitolo:TextFormat = new TextFormat();
formatoTitolo.font = fontTitolo.fontName;
formatoTitolo.size = 30;
var titolo:TextField = new TextField();
titolo.textColor = 0x163467;
titolo.defaultTextFormat = formatoTitolo;
titolo.htmlText = "hello";
titolo.x = 10;
titolo.y = 10;
titolo.width = 300;
titolo.height = 200;
titolo.multiline = true;
titolo.wordWrap = true;
titolo.antiAliasType = AntiAliasType.ADVANCED;
titolo.sharpness = 100;
titolo.thickness = 100;
container.addChild(titolo);
But when I execute the build (.exe) on a PC where the Roboto fonts I have incorporated aren’t installed also on the Operating System the texts are displayed in Times New Roman. On a PC where the fonts are installed on the Operating System the texts are displayed in right fonts.
Please help...
Hi.
if possible try to use a text field already placed on stage (created at authortime by the Animate CC IDE) and you won't face this problem.
But if you do need to add your text field by code at runtime, you're gonna need to specify this in the app descriptor XML.
<embedFonts>
<font>
<fontName>Life is goofy</fontName>
<fontPath>life_is_goofy.ttf</fontPath>
</font>
</embedFonts>
You can also put your text field inside of a Movie Clip and at runtime
...Copy link to clipboard
Copied
did you assign that linkage id/class?
Copy link to clipboard
Copied
Yes, I have embed the fonts and set the linkage.
For example the embedded font Roboto have the linkage "Roboto_titolo" and I call it in this line of the code (see the full code on my first post):
var fontTitolo = new Roboto_titolo();
Thank you.
Copy link to clipboard
Copied
attach a screenshot of your library showing your font's been assigned that linkage.
Copy link to clipboard
Copied
Thank you kglad.
This is the screenshot you asked me:
Copy link to clipboard
Copied
there's no problem with your code/linkage: it works for me.
if you mask your text, do you see it? if so, it's embedding.
Copy link to clipboard
Copied
Thank you.
Can you explain how do you mean with "mask your text" or send me an example file?
Copy link to clipboard
Copied
place a mask over your textfield. do you see the text ("hello")?
Copy link to clipboard
Copied
Ok, I will do the test.
Meanwhile I have prepared a test project that shows the problem.
WeTransfer link: WeTransfer
The compiled build is here: "Test font incorporati\composizione\test.app\test.exe".
If I run the application and I have Roboto fonts installed on Windows I see the correct font:
If I remove the Roboto fonts from Windows system the Roboto texts appears in something like Times New Roman even if the Roboto fonts are embedded in the Animate library:
I've included the Roboto fonts file in the ZIP if you want install / uninstall on Windows ("Test font incorporati\Font Roboto").
The source file is "Test font incorporati\test.fla". In this test I have set the font of the first text via TextFormat and of the second text via HTML.
Thank you.
Copy link to clipboard
Copied
i don't see that:
Copy link to clipboard
Copied
Do you mean that running the application you don't see the correct fonts? This is the problem! I see the Roboto font on application only if the Roboto is installed on the system even if the Roboto fonts are embedded in the Animate library. Othewise I see Time New Roman instead of Roboto:
I need that the application uses the embedded Roboto font even if the font is not installed on Windows.
Thank you.
Copy link to clipboard
Copied
What happens if you replace
titolo.htmlText = "hello";
with
titolo.text = "hello";
?
Copy link to clipboard
Copied
The result is the same.
I have used
titolo.text = "This is Roboto with text";
for the the highlighted text:
As you can see when I remove the Roboto font from the system the text is yet displayed in Times New Roman. Roboto should instead look like this:
If you can, download the example in the previous post and let me know if you find a solution.
Thank you.
Copy link to clipboard
Copied
Hi.
if possible try to use a text field already placed on stage (created at authortime by the Animate CC IDE) and you won't face this problem.
But if you do need to add your text field by code at runtime, you're gonna need to specify this in the app descriptor XML.
<embedFonts>
<font>
<fontName>Life is goofy</fontName>
<fontPath>life_is_goofy.ttf</fontPath>
</font>
</embedFonts>
You can also put your text field inside of a Movie Clip and at runtime add the Movie Clip containing the text field not the text field itself.
Regards,
JC
Copy link to clipboard
Copied
Thank you JoãoCésar!!!!!!!!
The suggestion to modify the XML descriptor did not solve the problem... but the suggestion to use text field inside a MovieClip and add this at runtime is the solution!
Copy link to clipboard
Copied
You're welcome!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now