如何在黑莓应用程序中使用Telugu字体

时间:2012-05-16 09:27:45

标签: blackberry fonts blackberry-eclipse-plugin true-type-fonts

enter image description here作为我在Blackberry / Java开发方面的新手,我不知道如何在我的Blackberry中使用" telugu" 字体应用。请举个例子。

enter image description here 看看三个模拟器之间的区别     9300-OS6无法显示     9790-os7仅在此设备中显示。     9900-os7甚至OS7都没有显示。

1 个答案:

答案 0 :(得分:1)

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);
    }
}

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