PDA

View Full Version : Embed font and wordwrap issue


PKarpenko
11-28-2006, 06:19 PM
Ok, two part question.

First of all, I tried following the Embed Font example here: http://blog.bittube.com/?p=32 exactly with absolutely no results.
When I add txtField.embedFonts, the text no longer shows up, and without embedFonts, the fonts are just Times New Roman or something.

Second, when I add wordwrap = true to a text field, the text disappears. (it used to work fine. It stopped around when I started trying to embed the fonts, but it doesn't work even if I remove all embed code.) Ideas?

krikke
02-15-2007, 09:55 AM
Ok, it may be an old thread...

But I'm having the same problem. I'm using the following code to embed my font, I also inserted the font in my fla's library like we are used to embed fonts in Flash 8, AS2.


import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
//
//TEXTFIELD WITH AN EMBEDDED FONT -> not visible, embedding not working
var t:TextField = new TextField();
t.text = "'should' be embedded"
//
t.border = true;
t.autoSize = TextFieldAutoSize.LEFT;
t.embedFonts = true;
//if I don't embed the font, the textfield is visible
//
var format:TextFormat = new TextFormat();
format.font = "FFFHarmony"
//'FFFHarmony' is the name of the linkage of the font in my library
//'FFF Harmony' is the name of the font
format.size = 8
//
t.setTextFormat(format);
//
addChild(t)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TEXTFIELD WITHOUT AN EMBEDDED FONT
t2 = new TextField();
t2.autoSize = TextFieldAutoSize.LEFT;
t2.border = true;
t2.text = "not embedded font"
t2.y = 30
//
var format2:TextFormat = new TextFormat();
format2.font = "verdana";
format2.color = 0xFF0000;
format2.size = 10;
//
t2.setTextFormat(format2);
addChild(t2);

Also when I'm using t.defaultTextFormat = format, it doesn't work at all...

The link that PKarpenko provided doesn't work here either..

I hope somebody got it working so he/she can share it with us :D.

krikke

springframework
02-15-2007, 06:11 PM
I also had this problem and searached the internet and found this posted.



Adobe:



There is a bug in the Flash 9 Alpha Preview with using embedded fonts dynamically in AS 3.

Currently, the Flash IDE is not exporting the proper font when you create a font symbol in the library.




The work-around is to use the actual name of the font when specifying a custom font name.

So, a font symbol named “MyArial” will not work. But, if you rename the font symbol to “Arial”, which is the
actual name of the font, it works.

The TextFormat class expects a String for the font property. Specifying a class will not work. In the Linkage Properties dialog, please turn on export for ActionScript. And in the Font Symbol Properties dialog, please specify a custom font name that is the same as the actual font name. This font name is what TextFormat.font expects.

krikke
02-16-2007, 03:46 PM
Thanks for the info springframework, but this doesn't work either. :confused:

I'm using this code now:

import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
//
var t:TextField = new TextField();
t.text = "dsf qsdfqsdf qsdfqsdfqsdf sdfsd"
//
t.border = true;
t.autoSize = TextFieldAutoSize.LEFT;
t.embedFonts = true;
//
var format:TextFormat = new TextFormat();
format.font = "Supernatural1001"
format.size = 20
//
t.setTextFormat(format);
addChild(t)

And all I can see is a small square box representing the border around an empty string, which should be "dsf qsdfqsdf qsdfqsdfqsdf sdfsd".

I can see the textfield when I remove t.embedFonts = true;

These are my linkage settings for the font:
http://users.skynet.be/krikke/allerlei/linkage.gif
The (linkage) names are all the same as the font's name.
I think I will probably have to wait for the new Flash Player 9 release...

Has anyone succeeded in dynamically embedding a font with AS 3(and also tested it on a pc with the font uninstalled)?

krikke

daperson
04-04-2007, 08:49 PM
i have exactly same problem
ive done exactly the same as the poeple above, and tried multiple other examples
WHATS GOING ON ADOBE? :P