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?
Hariyemadzisawira nhaka yedu. Down the scud and win!