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
Original issue reported on code.google.com by
net.just...@googlemail.com
on 14 Apr 2013 at 4:23