I have been using this class.  It does not require embedding the fonts, just
pass it the rotation attribute.

 

<Extended:RotatableLabel text="Inquiry Navigator" rotation="-90"
fontSize="10" fontWeight="bold" />

 

/**

 * Author: Lior Gonnen

 * Date: 17-Nov-2007

 * 

 * Please visit: http://liorgonnen.blogspot.com

 */

 

package org.pace2020.appbox.components

{

                import flash.display.BitmapData;

                import flash.display.DisplayObject;

                

                import mx.controls.Label;

                

                /**

                 * Use this Label class instead of the standard
mx.controls.Label to allow text rotation

                 * (using the 'rotation' property) without using embedded
fonts!

                 */

                public class RotatableLabel extends mx.controls.Label

                {                  

                    private var _labelBitmap : BitmapData = null;

                    

                    /**

                     * updateDisplayList is used to draw a rotated bitmap of
the label

                     */ 

                    protected override function
updateDisplayList(unscaledWidth : Number, unscaledHeight : Number) : void {

 
super.updateDisplayList(unscaledWidth, unscaledHeight);

                                                

                                                // 1. Make sure that the
width and the height are greater than zero, otherwise we have nothing to do.

                                                // 2. Make sure rotation is
different than zero, otherwise the label will show normally

                                                // 3. Draw the label into a
bitmap, and then draw it onto the label, since the label is rotated

                                                //    the bitmap will be
displayed rotated as well. Nice, ha? ;-)

                                                if (unscaledWidth > 0 &&
unscaledHeight > 0 && rotation != 0) {

 
graphics.clear();

                                                                _labelBitmap
= getBitmapData(this);

                                                                if
(_labelBitmap) {            

 
graphics.beginBitmapFill(_labelBitmap);

 
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);

 
graphics.endFill();

                                                                }

                                                }              

                                }

                                

                                /**

                                 * Create a bitmap from a displayObject

                                 * @param target The displayObject to draw

                                 * @return The drawn bitmap

                                 */

                                public static function getBitmapData(target
: DisplayObject) : BitmapData

                                {

                                                var bd : BitmapData = new
BitmapData(target.width, target.height, true, 0.0);

                                                bd.draw(target);

                                                return bd;

                                }

                }

}

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of linko27
Sent: Monday, March 03, 2008 7:07 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Vertical Labels

 

<mx:Label rotation="90" text="thanks"/>

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ,
Tom Chiverton <[EMAIL PROTECTED]>
wrote:
>
> On Monday 03 Mar 2008, linko27 wrote:
> > Yes rotated!
> 
> Make sure it's using an embedded font, and then use something like
the Rotate 
> effect or style.
> 
> -- 



Reply via email to