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

Incorporated Fonts (AIR Desktop)

Community Beginner ,
Dec 08, 2018 Dec 08, 2018

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):

Screenshot_1.png

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...  

753
Translate
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

Community Expert , Dec 12, 2018 Dec 12, 2018

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>

Font embed AIR 24 / 25 [HELP]

You can also put your text field inside of a Movie Clip and at runtime

...
Translate
Community Expert ,
Dec 08, 2018 Dec 08, 2018

did you assign that linkage id/class?

Translate
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
Community Beginner ,
Dec 09, 2018 Dec 09, 2018

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.

Translate
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
Community Expert ,
Dec 09, 2018 Dec 09, 2018

attach a screenshot of your library showing your font's been assigned that linkage.

Translate
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
Community Beginner ,
Dec 10, 2018 Dec 10, 2018

Thank you kglad.

This is the screenshot you asked me:

Roboto.PNG

Translate
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
Community Expert ,
Dec 10, 2018 Dec 10, 2018

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.

Translate
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
Community Beginner ,
Dec 11, 2018 Dec 11, 2018

Thank you.

Can you explain how do you mean with "mask your text" or send me an example file?

Translate
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
Community Expert ,
Dec 11, 2018 Dec 11, 2018

place a mask over your textfield.  do you see the text ("hello")?

Translate
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
Community Beginner ,
Dec 11, 2018 Dec 11, 2018

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:

With Roboto on system.JPG

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:

No Roboto on system.JPG

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.

Translate
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
Community Expert ,
Dec 11, 2018 Dec 11, 2018

i don't see that:

Screenshot - 12_11_2018 , 9_50_26 AM.png

Translate
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
Community Beginner ,
Dec 11, 2018 Dec 11, 2018

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:

No Roboto on system.JPG

I need that the application uses the embedded Roboto font even if the font is not installed on Windows.

Thank you.

Translate
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 ,
Dec 11, 2018 Dec 11, 2018

What happens if you replace

titolo.htmlText = "hello";

with

titolo.text = "hello";

?

Translate
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
Community Beginner ,
Dec 12, 2018 Dec 12, 2018

The result is the same.

I have used

titolo.text = "This is Roboto with text";

for the the highlighted text:

with text instead htmlText.JPG

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:

Roboto.JPG

If you can, download the example in the previous post and let me know if you find a solution.

Thank you.

Translate
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
Community Expert ,
Dec 12, 2018 Dec 12, 2018

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>

Font embed AIR 24 / 25 [HELP]

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

Translate
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
Community Beginner ,
Dec 12, 2018 Dec 12, 2018

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!

Translate
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
Community Expert ,
Dec 12, 2018 Dec 12, 2018
LATEST

You're welcome!

Translate
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