如何在blackberry app中永久加载字体(字体管理器只加载一次),加载时间很长

时间:2012-06-01 04:36:29

标签: blackberry

if(FontManager.getInstance()。load(“gautami.ttf”,“gautami”,FontManager.APPLICATION_FONT)== FontManager.SUCCESS)

        {
        try{

         _fontFamily1  = FontFamily.forName("gautami");//_fontFamily1 = FontFamily.forName("aerial");
    } catch(ClassNotFoundException e) {
            _fontFamily1 = Font.getDefault().getFontFamily();
    }
     _headFont = _fontFamily1.getFont(Font.PLAIN,_size);

     super.setFont(_headFont);

}

1 个答案:

答案 0 :(得分:1)

只需使用正确的标志:

        int result = FontManager.getInstance().load("mtfont.ttf", "myfont", FontManager.SYSTEM_FONT); 
        // With the APPLICATION_FONT flag, the font is not available in system options and will be removed after exiting your app. However, it will be available during this time for others app to use.

        // Wit the SYSTEM_FONT flag, the font will be available in the system options, will be stored in persistent memory and will be reloaded on each reboot.