|
Viewing 1 to (7 Total) no styles in html5 |
Total Posts: 34
Joined: April 02, 2012
|
Hi , does anyone can tell me why i can't display bold, underline, italic text when i target html5 , although i'm not using embedded fonts ?
This exemple won't display styled text with html5 but works with flash:
var tf = new TextField();
tf.defaultTextFormat = new TextFormat("Arial", 20, 0x333333, true, true, true);
tf.text = "hello world";
Lib.current.stage.addChild(tf);
Tags:
Posted on April 10, 2012 at 6:28 AM
|
|
|
Total Posts: 2147
Joined: August 25, 2011
|
Re: no styles in html5
Flash is able to automatically work out that "Arial Bold" and "Arial Italic" are variants of the same font, and will apply bold/italic styles accordingly.
Jeash is using the resource ID of an embedded *.hash font object. You could embed multiple fonts, but you'd have to change between them by changing the font name to "ArialBold.ttf", "ArialItalic.ttf", etc.
I bet this could be improved, though, and would be a nice thing to look into 
Posted on April 13, 2012 at 8:35 PM
|
Total Posts: 261
Joined: September 08, 2011
|
Re: no styles in html5
I'm wondering why jeash must embed the fonts when you can just use canvas.fillText or directly HTML text using system fonts.
Could there be 2 text engines depending if you set embedFonts or not?
Posted on April 14, 2012 at 3:35 AM
|
Total Posts: 34
Joined: April 02, 2012
|
Re: no styles in html5
I tried this:
var font:Font = Assets.getFont("assets/fonts/VERDANA.TTF");
var format:TextFormat = new TextFormat(font.fontName, 20, 0xFF0000);
var fontBold:Font = Assets.getFont("assets/fonts/VERDANAB.TTF");
var formatB:TextFormat = new TextFormat(fontBold.fontName, 24, 0x00FF00, true);
var fontItalic:Font = Assets.getFont("assets/fonts/VERDANAI.TTF");
var formatI:TextFormat = new TextFormat(fontItalic.fontName, 16, 0x0000FF, false, true);
var tf:Texte = new Texte("Hello world", 50, 50, { embedFonts:true, defaultTextFormat:format } );
var tfB:Texte = new Texte("Hello world", 50, 150, { embedFonts:true, defaultTextFormat:formatB } );
var tfI:Texte = new Texte("Hello world", 50, 250, { embedFonts:true, defaultTextFormat:formatI } );
stage.addChild(tf);
stage.addChild(tfB);
stage.addChild(tfI);
when itarget html5 i see plain text with correct colors and sizes, but no bold or italic (Texte is a basic class extending Textfield with just some initialization parameters, if i use TextField instead, i have the same results).
In firebug, i have :
Glyph data for font 'NME_assets_fonts_verdana_ttf' does not exist, defaulting to 'Bitstream_Vera_Sans'.
I guess it's the same problem described in bug on special characters with jeash.
Posted on April 17, 2012 at 3:25 AM
|
Total Posts: 18
Joined: November 30, 2011
|
Re: no styles in html5
embedding fonts is html5 broken!
jeash does not find the glyphs in the export-folder, and for that case creates an own included font -> "Bitstream_Vera_Sans".
the glyphs for this font are stored in jeash/text/font.hx - last line..
you can try to copy generatet glyphs of your exportfolder into the font.hx-file and you should see your font...
--------
i dont know why jeash doesnt see the glyphs anymore in the export-folder, i hope there are some expert who read this 
Posted on April 19, 2012 at 9:21 AM
|
Total Posts: 34
Joined: April 02, 2012
|
Re: no styles in html5
Thanks fort he tip.
A stupid question : i can't locate the *.hx files and so, i'v been unable to find the font.hx file.
Do you know where i could find it in windows7?
Posted on April 19, 2012 at 9:48 AM
|
Total Posts: 18
Joined: November 30, 2011
|
Re: no styles in html5
@LeFabrice:
i am on a mac, so i dont know exactly in windows...
you schould find your haxe-folder and inside there is a folder lib where al library are stored (haxe/lib/jeash/text/font.hx)
@joshua:
in HTML5Installer.hx you can find the line, where the glyphs are generated:
runCommand (Path.directory (targetPath), "neko", [ NME + "/tools/command-line/html5/hxswfml.n", "ttf2hash", FileSystem.fullPath (sourcePath), "-glyphs", "32-255" ] );
and then, this line, which should go into the build.hxml, from there jeash can read the font as a ressource, but its not written..
-resource fontFile.hash@myFontname
context.HAXE_FLAGS += "\n-resource " + FileSystem.fullPath (sourcePath) + ".hash@" + font.flatName;
i cant find it weather in debug.hxml, nor in release.hxml of the export folder.
is there a simple trick in the template-files which you have forgotten?
Posted on April 19, 2012 at 10:31 AM
|