weimingtom / nekonme

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

TextField rotation doesn't work on cpp/ios/android targets #163

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
var font = Assets.getFont( FONTS_ASSETS_PATH + "BradBunR.ttf" );
var tf = new TextField();
tf.selectable = false;
tf.autoSize = TextFieldAutoSize.LEFT;
var tfx = new TextFormat();
tf.embedFonts = true;
tfx.font = font.fontName;
tfx.size = 60;
tf.defaultTextFormat = tfx;
tf.text = "Hello !";
tf.rotation = 15;
Lib.current.addChild( tf );

What is the expected output? What do you see instead?
Textfield do rotation but it doesn't instead.

What version of the product are you using? On what operating system?
Today's SVN version (but it didn't work with previous versions too)

Please provide any additional information below.

Original issue reported on code.google.com by filt3...@gmail.com on 12 Dec 2011 at 4:31

GoogleCodeExporter commented 8 years ago
Note that you can rotate 90 degrees and it works fine, but not lesser angles. I 
am using haxelib latest on win7 64bit with flashdevelop, tried with various 
googledirectoryfonts. Fails on Cpp and Android, but works fine with same code 
in flash, seems to fail compile on html5 but I am unsure if that is working i 
am not using that target at the moment.

Original comment by net.just...@googlemail.com on 14 Aug 2012 at 1:48

GoogleCodeExporter commented 8 years ago
putting it in nested sprites with cacheing does not seem to help, also it if 
you have 45 degrees for the textfield and 45 for the holding sprite it renders 
at the effective 90, maybe that is obvious.

Original comment by net.just...@googlemail.com on 14 Aug 2012 at 1:59

GoogleCodeExporter commented 8 years ago
This issue is still present with NME 3.5.5

Luckily there's a workaround that should be pretty familiar to anybody who has 
spent some serious time with Flash: draw the textfield to a bitmap, then rotate 
the bitmap.

var bmpd = new BitmapData( Math.round(textField.width), 
Math.round(textField.height), false, 0xEEEEEE );
var bmp = new Bitmap( bmpd, PixelSnapping.NEVER, true );

bmpd.draw( textField );

bmp.x = 50;
bmp.y = 100;
bmp.rotation = 10;

addChild( bmp );

Original comment by rolf.brocke@gmail.com on 2 Feb 2013 at 8:55