AS3 target, FlashDevelop: embed normal, bold, italic style of the same font problem

491 views
Skip to first unread message

Tom

unread,
Nov 15, 2012, 7:02:58 AM11/15/12
to haxe...@googlegroups.com
Hi!

Any suggestion how to embed the proper way bold, italic and normal style of a font?
I want to use it in a TextField.htmlText, with <b>, <i>, etc., but not working - only the regular font shows up. If the TextFormat.font is set to the bold font name, then this shows up only.
I don't want to set <font face="...">, just <b>, <i>, ...

In FlashDevelop I rightclicked on the fonts, and added to the Library - I tried with auto generated name/ID, and with specified, but no success.
And yes, I set the TextField.embedFonts = true. :)

Any suggestion or solution?

Philippe Elsass

unread,
Nov 15, 2012, 7:39:55 AM11/15/12
to haxe...@googlegroups.com
Not sure about the Haxe way, but the easiest solution will probably be to use the Flex SDK to generate a font library SWF.
 
FlashDevelop includes a "Font Library" AS3 class Template which will be available in AS3 projects. You can create an Empty AS3 project in your Haxe project folder.
 
This template class offers lots of information on how to embed fonts - make sure you embed each font variant (regular, bold, italic, bold-italic) as required and give them all the same "font family" name that you'll use as the font name in the TextField.
 
You can copy this AS3 class in your Haxe project (and delete the AS3 project) and build it using the Quick Build (Ctrl+F8) feature.
 
The resulting SWF can be loaded or embedded - but it must have been executed first for the fonts to be available.





--
Philippe

Tom

unread,
Nov 15, 2012, 8:20:27 AM11/15/12
to haxe...@googlegroups.com
I want to chose this solution to the last resort.
I prefer the TTF files, because it can be replaced anytime easily.

polic...@google.com

unread,
Dec 13, 2012, 9:59:51 PM12/13/12
to haxe...@googlegroups.com
Hi All,

I have a problem regarding the font face. I have this html text value to put in the textbox :

<font face="Bodoni SvtyTwo ITC TT BookIta" size="19">ENORMOUS  FUN</font><br>AN EVEN BIGGER VALUE;

My textbox was already set in "Bodoni SvtyTwo ITC TT Book" to make the font of the text "AN EVEN BIGGER VALUE". I alreadt embeded both Book and BookItalic in the Library.


After I run I only see the "AN EVEN BIGGER VALUE", But the "ENORMOUS  FUN" text was missing. 

thanks,
Vowie

Tom

unread,
Dec 14, 2012, 1:12:00 AM12/14/12
to haxe...@googlegroups.com
Hi!

If You compile into Flash, than You can use this code snippet to check which fonts are registered in the swf:

        var embeddedFonts:Array<Dynamic> = flash.text.Font.enumerateFonts(false);

       
for (i in 0 ... embeddedFonts.length)
       
{
            trace
(embeddedFonts[i].fontName);
       
}

Reply all
Reply to author
Forward
0 new messages