I have the XML and raw bitmap data for a bitmap font. I want to take the raw data and set the pixels in the BitMapData so I can make my font.
Using haxe with the flash libraries.
Whenever I run my code I keep getting this error: Error: Error #2030: End of file was encountered. at flash.display::BitmapData/setPixels()
I am trying to use this technique in haxe but it fails: https://github.com/PrimaryFeather/Starling-Framework/blob/master/starling/src/starling/text/MiniBitmapFont.as
I really don't know what the issue is. I didn't include all of the bitmap data below because it is too big but there are 310 entries.
import flash.display.BitmapData;
import flash.geom.Rectangle;
import flash.utils.ByteArray;
...
private var BITMAP_WIDTH : Int = 128;
private var BITMAP_HEIGHT : Int = 64;
private var BITMAP_DATA : Array<Float> = [
2027613533, 3413039936, 202148514, 2266925598, 4206886452, 4286853117, 2034947,
3202703399, 352977282, 2957757964, 3113652880, 2158068882, 1468709156, 2268063717,
2779310143, 2101025806, 3416509055, 4215794539, 3602168838, 1038056207, 1932393374 ];
...
public function get_texture() : BitmapFont {
var bmpData : BitmapData = new BitmapData( BITMAP_WIDTH, BITMAP_HEIGHT );
var bmpBytes : ByteArray = new ByteArray();
var numBytes : Int = BITMAP_DATA.length;
bmpBytes.position = 0;
for ( i in 0...numBytes ) {
bmpBytes.writeUnsignedInt( Std.int( BITMAP_DATA[i] ) );
}
bmpBytes.position = 0;
//bmpBytes.uncompress();
bmpData.setPixels( new Rectangle( 0, 0, BITMAP_WIDTH, BITMAP_HEIGHT ), bmpBytes );
return new BitmapFont().loadAngelCode( bmpData, XML_DATA );
}