conscience1 / hxswfml

Automatically exported from code.google.com/p/hxswfml
0 stars 0 forks source link

Some adjustments for haxe3 TTF classes with minimal test case. #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
some haxe3 compatibility changes.

format.ttf.Constants
please add ";" to end of line 333

format.ttf.Reader

please change line 10 to
var tablesHash:StringMap<Bytes>;

and line 81-83 to
    function readDirectory(header:Header):Array<Entry>
    {
        tablesHash = new StringMap();

Enclosed a test case.

-cp src
-swf bin/test.swf
-main Main
-swf-version 10
-cmd open bin/test.swf

package;
import format.ttf.Data;
class Main
{   static function main()
    {   var loada = new flash.net.URLLoader(new flash.net.URLRequest('Arial.ttf'));
        loada.dataFormat = flash.net.URLLoaderDataFormat.BINARY;
        loada.addEventListener( flash.events.Event.COMPLETE, function(e){
            var reader:{
                readHeader:Void->Header,readDirectory:Header->Array<Entry>,
                readNameTable:haxe.io.Bytes->Array<NameRecord>,
                tablesHash:haxe.ds.StringMap<haxe.io.Bytes>,
                fontName:String
            } = cast new format.ttf.Reader( 
                new haxe.io.BytesInput( haxe.io.Bytes.ofData( e.target.data ) ));
            var directory = reader.readDirectory(reader.readHeader());
            var nameData = reader.readNameTable(reader.tablesHash.get("_name"));
            trace( 'Font name: ' + reader.fontName );
        });
    }
}

Original issue reported on code.google.com by net.just...@googlemail.com on 14 Apr 2013 at 4:23

GoogleCodeExporter commented 9 years ago
Thanks for reporting. hxswfml has been updated for haxe3

Original comment by adn...@gmail.com on 26 Apr 2013 at 1:25