PhotoDune

embedfonts=true + htmlText?

370 posts
  • Bought between 1 and 9 items
  • Has been a member for 4-5 years
  • New Zealand
Polaradine says

Is it possible to get the fonts embedded when using htmlText? Took me a long time to track it down to being embedfonts that was making my text disappear :P facepalms

1666 posts
  • Elite Author
  • Sold between 50 000 and 100 000 dollars
  • Author had a Free File of the Month
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Europe
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
+1 more
Tean says

What code are you using to embed font?

7456 posts
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 5-6 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX moderator says

yes you can use embedded fonts… are you using CSS as well?

370 posts
  • Bought between 1 and 9 items
  • Has been a member for 4-5 years
  • New Zealand
Polaradine says
What code are you using to embed font?
[Embed(source = "C:/Windows/Fonts/arial.ttf", fontName = "Arial", fontWeight = "normal", advancedAntiAliasing = "true", mimeType = "application/x-font")] 
public var ARIAL:Class

I’ve also tried embedding in library in the flash IDE . I can embed fonts and have some htmlText set once, but when I try to update the text it disappears unless I set embedfonts=false. I am using CSS too but I’ve tried testing without and the problem remains.

Here is the code I used that does’nt work with embedfonts set to true:

import flash.text.TextFormat
import flash.text.TextField
import flash.text.AntiAliasType

var format1:TextFormat = new TextFormat();
var textfield:TextField    

format1.font= "Arial";
format1.size=12;
format1.color = 0x888888

textfield = new TextField();
textfield.x=0
textfield.y =0;
textfield.width = 100
textfield.height = 30
textfield.embedFonts=true;
textfield.antiAliasType=AntiAliasType.ADVANCED;
textfield.htmlText = "text" 
textfield.setTextFormat(format1);
textfield.border = true
textfield.wordWrap = true

addChild(textfield)

textfield.htmlText = "newText" 
118 posts
  • Bought between 1 and 9 items
  • Europe
  • Exclusive Author
  • Has been a member for 4-5 years
  • Sold between 1 000 and 5 000 dollars
komapeb says
When you update the text you have to:
textfield.setTextFormat(format1);
or you can try:
textfield.defaultTextFormat = format1;
4132 posts
  • Bought between 1 and 9 items
  • Brazil
  • Community Superstar
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Sold between 5 000 and 10 000 dollars
tsafi says

Small change that’s all base on your code ….

var format1:TextFormat = new TextFormat();
var textfield:TextField  
/////////////////////////////  
var _Font:MyFont= new MyFont();/////Libary font
format1.font= _Font.fontName; ///name the Libary font and you are set 
/////////////////////////////
format1.size=12;
format1.color = 0x888888

textfield = new TextField();
textfield.x=50
textfield.y =50;
textfield.width = 100
textfield.height = 30
textfield.embedFonts=true;
textfield.antiAliasType=AntiAliasType.ADVANCED;
textfield.htmlText = "text" 
textfield.setTextFormat(format1);
textfield.border = true
textfield.wordWrap = true

addChild(textfield)
7456 posts
  • Attended a Community Meetup
  • Community Moderator
  • Has been a member for 5-6 years
  • United Kingdom
  • Contributed a Tutorial to a Tuts+ Site
  • Won a Competition
  • Contributed a Blog Post
  • Beta Tester
  • Bought between 50 and 99 items
+4 more
MSFX moderator says
What code are you using to embed font?
[Embed(source = "C:/Windows/Fonts/arial.ttf", fontName = "Arial", fontWeight = "normal", advancedAntiAliasing = "true", mimeType = "application/x-font")] 
public var ARIAL:Class

isn’t that the flex embed method, not sure if it works within flash?

i’d follow tsafi’s change in code.. you have to initialise the font from the library at runtime…

http://www.adobe.com/devnet/flash/quickstart/embedding_fonts/

1666 posts
  • Elite Author
  • Sold between 50 000 and 100 000 dollars
  • Author had a Free File of the Month
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Europe
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
+1 more
Tean says

Yes, it works in flash cs4:

http://www.adobe.com/devnet/flash/articles/embed_metadata_04.html

and komapeb already gave the answer, he needs to re-apply textFormat after updating text.

5040 posts The Dude Abides
  • United States
  • Elite Author
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
+4 more
CodingJack says

isn’t that the flex embed method, not sure if it works within flash?

yeah I think that only works in Flex. But here’s a cool workaround:

http://www.mokisystems.com/blog/flash-as3-loading-fonts/

5040 posts The Dude Abides
  • United States
  • Elite Author
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Contributed a Tutorial to a Tuts+ Site
  • Author had a Free File of the Month
+4 more
CodingJack says
Yes, it works in flash cs4:

http://www.adobe.com/devnet/flash/articles/embed_metadata_04.html

and komapeb already gave the answer, he needs to re-apply textFormat after updating text.

nice!

by
by
by
by
by