Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
key_key
Posts: 59
Registered: ‎01-17-2011
My Device: 8520
My Carrier: Vodafone
Accepted Solution

How to draw text vertically ?

Hello Friends,

 

I want to write text vertically. I use all DrawStyle for that but i did not get success..  Please help me to write vertically text.

See the image for more clearification what i want to draw.

 

verticalText.JPG

Regards,

Krishan Kant

 

Please use plain text.
Developer
pradeep_ch
Posts: 543
Registered: ‎12-23-2010
My Device: Z10
My Carrier: Airtel

Re: How to draw text vertically ?

Hi key_key,

 

Try this code

 

 int thetaFixed = Fixed32.toFP(90);
        
        int cell_11 = Fixed32.cosd(thetaFixed);
        int cell_12 = -Fixed32.sind(thetaFixed);
                    
        int cell_21 = Fixed32.sind(thetaFixed);
        int cell_22 = Fixed32.cosd(thetaFixed);

        int[] transform = new int[] { cell_11, cell_12, cell_21, cell_22, 0, 0 };
        Font myFont = Font.getDefault().derive(Font.BOLD, 17, Ui.UNITS_px,    Font.ANTIALIAS_STANDARD, 0, transform);
        
        LabelField lab = new LabelField("Hello");
        lab.setFont(myFont);
        
        add(lab);

 

you can set this font for graphics object also in any paint method if you need.

 

Thanks.

Please use plain text.