Forums: Flash:

 

Embedded fonts. (AS1)

first
 

scudsucker Embedded fonts. (AS1)

EDIT- Bugger, wrong forum. Please move....


It's been a while since I've done this. I have some HTML text that needs to be styled with an embedded font.

I have created 3 fonts in the library, Myriad_Pro, Myriad_Pro_Bold, and Myriad_Pro_Italic.

I have textfields set to use the font Myriad_Pro (working), but certain html must be either bold or italic.

I have tried using a loaded in style-sheet:


.italic {
font-family:Myriad_Pro_Italic;
}
.bold {
font-family:Myriad_Pro_Bold;
}

Applied to the style sheet..

var format = new TextField.StyleSheet();
var path = "includes/style.css";
format.load(path);


txtContent.embedFonts=true;
txtContent.styleSheet=format;
txtContent.html=true;
txtContent.htmlText="<span class='italic'>this should be italic</span> and <span class='bold'>and this is bold</span>"

gives me simply "and" - there is no text in the spans.

Alternatively, using

var format = new TextField.StyleSheet();

var styleObj:Object = new Object();
styleObj.fontWeight = "bold";
styleObj.fontFamily = "Myriad_Pro_Bold"
format.setStyle("bold", styleObj);
delete styleObj;

styleObj:Object = new Object();
styleObj.fontWeight = "normal";
styleObj.fontFamily = "Myriad_Pro_Italic"
format.setStyle("italic", styleObj);
delete styleObj;


and applying as above, there is no change to the text at all.

I cannot find a clear, decent example/tutorial. Any suggestions or pointers?


__________________________
Hmbeh.
quote
 

Stickman

Create two movie clips in the timeline but outside the stage, one with some bold text and one with italic text, in the appropriate font(s).

Stupid, but it's worked for me in the past.

StickBlog - random developer stuff
quote
 

scudsucker

Right- that seems to support the many threads I read, saying, embed the font in the old-school way.

Will give it a try, thanks.


__________________________
Hmbeh.
quote
 

JLM

if you use html enabled in text field you might only need one to embed, if you load in a swf with a textfield with embedded fonts into same application domain you can reuse the lib symbol without messing with the registering fonts or other nigtmare ways etc... and only load in the styles needed as textfields in symbols in movies.

 
first
 

Forums: Flash: Embedded fonts. (AS1)

 
New Post
 
You must be logged in to post