0

在此处输入图像描述由于我是黑莓/Java 开发的新手,我不知道如何在我的黑莓应用程序中使用“泰卢固语”字体。请举个例子。

在此处输入图像描述 查看三个模拟器之间的区别 9300-OS6 不显示 9790-os7 仅在此设备中显示。9900-os7 甚至 OS7 都不显示。

4

1 回答 1

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

于 2012-05-23T16:55:39.943 回答