Hi,
I have had lots of problems with this in the past - be careful you
are not embedding the font in the IDE for any of your text fields, I
think it clashes.
Where is "MyriadProFont" coming from in your App?
Glen
On 15/09/2010 08:46, Jiri wrote:
He Keith,
thanks for pointing that out to me. I tried and it still wont show any
text.
When I enumerate the fonts, and using the code provided by Keith I get
this output
embeddedFonts Array (@367abf39)
[0] flash.text.Font (@369a56c1)
fontName "MyriadProFont"
fontStyle "regular"
fontType "embedded"
[1] flash.text.Font (@369a5701)
fontName "MyriadProBoldFont"
fontStyle "bold"
fontType "embedded"
[2] flash.text.Font (@369a5761)
fontName "MyriadProFont"
fontStyle "bold"
fontType "embedded"
[3] flash.text.Font (@369a57a1)
fontName "MyriadProRegularFont"
fontStyle "regular"
fontType "embedded"
length 4
So although regsitering two fonts to the Font class, it shows 4 Font
instances in the embeddedFonts??
Anybody has another take?
Jiri
On 14-09-10 22:39, Keith Reinfeld wrote:
The fontNames for each embedded font need to be distinct from one
another.
Use Font.registerFont(Class); to make the embedded fonts available to
loaded swfs.
Use the fontName when assigning format.font;
<code>
[Embed( source='../../../../../fonts/myriad
pro/MyriadPro-Bold.otf',
fontName='MyriadProBoldFont',
unicodeRange='U+0010-U+00FC', fontWeight =
'bold',
fontFamily="Myriad Pro Bold",
mimeType='application/x-font-truetype',
embedAsCFF="false"
)]
public static var MyriadProBoldFont:Class;
// Make the font available to loaded swfs
Font.registerFont(MyriadProBoldFont);
[Embed( source='../../../../../fonts/myriad
pro/MyriadPro-Regular.otf',
fontName='MyriadProRegularFont',
unicodeRange='U+0010-U+00FC', fontWeight
= 'normal',
fontFamily="Myriad Pro Regular",
mimeType='application/x-font-truetype',
embedAsCFF="false"
)]
public static var MyriadProRegularFont:Class;
// Make the font available to loaded swfs
Font.registerFont(MyriadProRegularFont);
</code>
Then:
<code>
var tField:TextField = _sprite.getChildByName("field") as TextField;
addFormatting( treatmentTimeInfo , STD_LABEL_FONT_SIZE , WHITE);
function addFormatting(tField:TextField):void{
var format:TextFormat = new TextFormat()
format.font = "MyriadProBoldFont";
format.bold = true;
tField.defaultTextFormat = format;
tField.embedFonts = true;
tField.setTextFormat( format );
tField.text = "some_text"
}
</code>
HTH
Regards,
Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders