Embed a custom font in an ActionScript 3 project

I want to display "Hello World" using calibri.ttf using only AC3. How should I do it?

Found two solutions on the Internet, but I can’t use them - The Adobe documentation site requires the use of Flash CS4. (I don’t know how to use this in Flex Builder) - FLEX SDK required for embedment tag method

Can I embed a font using ActionScript 3 in an ActionScript project using Flex Builder?

+3
source share
3 answers

Right-click on a library in Flash Project, and you have the option to add a font there. You can even simply create an empty dynamic text field and include all the characters you need into it.

In the settings you can specify the compilation details, so when compiling the project you can see what was included, and in both cases you should see that the font will be included.

- edit-- right, sorry, I realized that you are using Flash, my bad

you can use something like this

[Embed(source='/assets/calibri.ttf', fontName="Font", mimeType="application/x-font-truetype")]
private static var calibri:String;
+3
source

I had a similar problem in a clean AS3 mobile project where I used Daniel code (below from another answer), but it didn’t work for me.

Daniel Code

[Embed(source='/assets/calibri.ttf', fontName="Font", mimeType="application/x-font-truetype")]
private static var calibri:String;

, , embedAsCFF="false" TrueType Font (TTF), Compact Font (CFF), .

[Embed(source='/assets/calibri.ttf', fontName="Font", mimeType="application/x-font-truetype" embedAsCFF="false")]
private static var calibri:String;
+5

Flex Builder includes the Flex SDK and uses the SDK to compile. In a clean AS3 project, you should use the embed tag to embed fonts.

0
source

Source: https://habr.com/ru/post/1735849/


All Articles