With OpenFL Command-Line Tools (3.1.3-LO0LwQ) (just ran update this morning, some of my projects no longer draw things where they used to, and draw things in different places on HTML5 vs Flash)
I modified one of the examples from openfl-samples-master to draw text on a BitmapData using a matrix. If you compile in flash vs HTML5, you’ll see the font in different places - seems to be setting position to 0,0 in HTML5?
flash (I’m drawing to -100,something)
html5 (seems to draw at 0,0)
here’s the project:
http://ded.increpare.com/~locus/transform_bug.zip
here’s the relevant code
package;
import openfl.display.Sprite;
import openfl.text.Font;
import openfl.text.TextField;
import openfl.text.TextFormat;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Matrix;
class Main extends Sprite {
public function new () {
super ();
var format = new TextFormat ("Katamotz Ikasi", 30, 0x7A0026);
var textField = new TextField ();
textField.defaultTextFormat = format;
textField.embedFonts = true;
textField.selectable = false;
textField.x = 200;
textField.y = 50;
textField.width = 200;
textField.text = "Hello World";
//addChild (textField);
var myBitmapData:BitmapData = new BitmapData(800, 200);
var m:Matrix = new Matrix();
m.identity();
m.translate(-100,100);
myBitmapData.draw(textField,m);
var bmp:Bitmap = new Bitmap(myBitmapData);
this.addChild(bmp);
}
}