Search code examples
blackberryfontsblackberry-eclipse-plugintruetype

How to use Telugu font in blackberry application


enter image description hereAs I'm novice in Blackberry/Java development, I don't know how to use "telugu" font in my Blackberry application. Please give an example.

enter image description here see the difference between three simulators 9300-OS6 not displaying 9790-os7 displays only in this device . 9900-os7 even OS7 it is not displaying.


Solution

  • import net.rim.device.api.system.*;
    import net.rim.device.api.ui.*; 
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.ui.component.*;
    import java.util.*;
    
    public class FontLoadingDemo extends UiApplication
    {
        public static void main(String[] args)
        {
            FontLoadingDemo app = new FontLoadingDemo();
            app.enterEventDispatcher();
        }
    
        public FontLoadingDemo()
        {
            pushScreen(new FontLoadingDemoScreen());
        }
    }
    
    class FontLoadingDemoScreen extends MainScreen
    {   
        public FontLoadingDemoScreen()
        {
            setTitle("Font Loading Demo");
    
            LabelField helloWorld = new LabelField("Hello World");
    
            if (FontManager.getInstance().load("Myfont.ttf", "MyFont", FontManager.APPLICATION_FONT) == FontManager.SUCCESS) 
            {
                try 
                {
                    FontFamily typeface = FontFamily.forName("MyFont");
                    Font myFont = typeface.getFont(Font.PLAIN, 50);
                    helloWorld.setFont(myFont); 
                }
                catch (ClassNotFoundException e) 
                {
                    System.out.println(e.getMessage());
                }
            }
            add(helloWorld);
        }
    }
    

    Source: http://docs.blackberry.com/en/developers/deliverables/11958/Load_and_use_a_custom_font_899948_11.jsp