PDA

View Full Version : problems with embedFonts


Taldos
03-30-2002, 06:44 PM
ahoy!

am dynamically creating a textField.

_root.createTextField("firstText", 1, 300, this._y, 300, 100);
myFormat = new TextFormat()
myFormat.bold = 1;
_root.firstText.text = "just testing";
_root.firstText.setTextFormat(myFormat);
_root.firstText.embedFonts = 1;

I am trying to do this because i want to use the _rotation option on my text field. however, if the fonts are not embed text vanishes.
but, even when i do place the embed call text still vanishes. am unsure as to what might be the problem. any ideas?

blooo
05-10-2002, 01:03 AM
In order to use embedFonts, you first have to add the font to your library. (Add Fonts from the library menu). Then, make sure the linkage of the font is set to "Export for ActionScript"

Fade
05-10-2002, 02:02 AM
Blooo,

I've been having the same issue as Taldos. Thanks for clearing it up for me (and hopefully him as well)! :)

Good luck on your proj. Taldos! :D

Thanks,
--FADE

Billy T
09-14-2002, 06:41 PM
I can't get this to work properly

I have added a font to my library (checked the boxes for bold and italic as well), set its linkage name as "thaFont" and am try to use it in a text box with

_root.createTextField("newText",1,50,50,100,300);
newText.text="hi";
newText.font="thaFont";
newText.embedFonts=true;

but it ain't working :(

what am I doing wrong?

Thanks

Billy T
09-14-2002, 06:52 PM
ok I figured it out

the link to the font in the library has to be done within a TextFormat object

If anyone wants an example see attached

cheers

tg
10-21-2002, 07:38 PM
thanks billyt... this helped me out a bunch.

Billy T
10-21-2002, 11:32 PM
you're more than welcome ;)

dbonneville
10-22-2002, 07:21 PM
I'm having a similar problem. I want to do the same but draw the text box dynamically and have it be an input box, set to HTML true and display htmlText, and I can't get it to work. It just disappears. I put the font in the library, to no avail so far. Here's my code...

//create main text box
this.createTextField("typingArea1",100,-330,-100.5,659,242);

typingArea1.html = true;
typingArea1.htmlText = "my new text<br>and another line";

typingArea1.wordWrap = true;
typingArea1.multiline = true;
typingArea1.border = true;
typingArea1.background = true;
typingArea1.backgroundColor = 0xFFFFFF;
typingArea1.autoSize = "left";
typingArea1.type = "input";

currentFormat = new TextFormat();
currentFormat.font = "Arial";
currentFormat.size = 24;
currentFormat.color = 0xFF0000;

typingArea1.embedFonts = true;

typingArea1.setTextFormat(currentFormat);

Thanks for any help or suggestions on this. Is this an order of precedence problem?

tg
10-22-2002, 07:26 PM
if you've put your font in your library, then set up a linkage for it... use a linkage name like 'myFont'
then in your code:

//change:
//currentFormat.font = "Arial";
//to:
currentFormat.font = "myFont";

and giver a whirl.

dbonneville
10-22-2002, 07:46 PM
I put in the fonts (several of them) and gave them names, and did one as you say, "myFont". I have linkage set up to export for actionscript, first frame. I have a trace that even shows that the font name is beeing seen by flash without a problem, but yet the face on screen at runtime is still Times Roman, and jagged too, when it should be smooth.

Here is my current code:

//create main text box
this.createTextField("typingArea1",100,-330,-100.5,659,242);

typingArea1.wordWrap = true;
typingArea1.multiline = true;
typingArea1.border = true;
typingArea1.background = true;
typingArea1.backgroundColor = 0xFFFFFF;
typingArea1.autoSize = "left";
typingArea1.type = "input";

typingArea1.html = true;
typingArea1.htmlText = "my new text<br>line two";

currentFormat = new TextFormat();
currentFormat.embedFonts = true;
currentFormat.size = 50;
currentFormat.color = 0xFF0000;
currentFormat.font = "myFont";

typingArea1.setTextFormat(currentFormat)

/////////////

trace(typingArea1._y+" right here");
trace(typingArea1._width);
trace(typingArea1.backgroundColor);
trace(typingArea1.text);
trace(typingArea1.htmlText);
trace("font = "+currentFormat.font);

typingArea1.setTextFormat(currentFormat)

What on earth could still be wrong? Thanks for your eyes on this one!

Doug

dbonneville
10-22-2002, 07:47 PM
woops...that last line is in there twice due to cutting and pasting, but it makes no difference, it still runs the same...

doug

tg
10-22-2002, 09:34 PM
change:
currentFormat.embedFonts = true;
to:
typingArea1.embedFonts=true;

dbonneville
10-22-2002, 10:13 PM
I got it! That works!!

Now, let's try one more thing to complicate matters, but potentially pull off something cool.

My ambition was to first get this to work, then to take that model and break it apart like this:

Create an empty movie, but have the font in the library, linkage set up for the right name, but check "export for actionscript" on it, with first frame checked too.

LoadMovie that new swf into another movie, and access the font using the linkage name.

I have been at it for 3 hours now and CANNOT get it to work. The font just won't pull.

Is there some other way to get at a font embedded in another clip? I can't figure out anyway to do it, though I've heard people have infact loaded and used fonts from standalone swfs...

Any ideas on that one? Thanks!

Doug

tg
10-22-2002, 11:50 PM
i got around it by putting the font in the library of the movie taht does the loading...
if that doesn't work for you, then do a search here, i know billy t was looking into something like this for a while, but i don't know if he found a solution for it.

bitterclarence
02-05-2003, 01:46 PM
Thanks for input on this thread, this helped me out too.

dgarcia182
09-01-2005, 02:28 AM
Just one more note for anyone else who hits this annoying problem.

For me this does not work:

var thistformat:TextFormat;
thistformat = new TextFormat();
thistformat.font = "myFont";

var thistf:TextField;
createTextField("tf", this.getNextHighestDepth(), 0, 200, 100, 10);
thistf = TextField(eval("tf"));
thistf.type = "dynamic";
thistf.embedFonts = true;
thistf.html = true;

thistf.setTextFormat(thistformat);
thistf.htmlText = "<p>Hi there</p>";

But if I switch it so that the last two lines are:

thistf.htmlText = "<p>Hi there</p>";
thistf.setTextFormat(thistformat);

It works fine!

oldnewbie
09-01-2005, 05:50 AM
First, you shouldn't be posting MX2004 specific syntax in this MX and LOWER only forum (This is not a MX2004 forum!)...

Second, you should look into TextField.setNewTextFormat and not only TextField.setTextFormat... One is used for text assigned before the format, and the other assigned after the format... ;)