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

Posts: 12
Registered: ‎01-31-2011
My Device: Not Specified

loading custom font problem

[ Edited ]


I want to load custom font for my application. my current code for loading custom font is 


if (FontManager.getInstance().load("LESLIEB_.TTF",
                "MyFont", FontManager.APPLICATION_FONT) == FontManager.SUCCESS) {
            try {
                FontFamily typeface = FontFamily.forName(IConst.FONT_MYFONT);
                font = typeface.getFont(Font.PLAIN, FONT_HEIGHT);
            } catch (ClassNotFoundException e) {


when i running the code font load fail error occurs. my .ttf file size is 32kb. my .ttf file placed in resource folder.

What am I doing wrong?



BlackBerry Development Advisor
Posts: 15,874
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: loading custom font problem

Which return value are you getting from the load call?  That will help narrow down the cause.


FontManager.SUCCESS if font loads successfully. 
FontManager.FONTS_ARRAY_FULL if too many fonts loaded. 
FontManager.MISSING_TYPEFACE_NAME if typeface name is invalid. 
FontManager.DUPLICATE_NAME if font name is duplicate. 
FontManager.DUPLICATE_DATA if font data is duplicate. 
FontManager.NO_FONT_DATA if no font data is found. 
FontManager.EXCEEDS_LIMIT if font data exceeds 60k in size. 
FontManager.MISS_RESOURCE if font file cannot be found. 
FontManager.FAILED_TO_LOAD_FILE if font data is invalid or font format is invalid.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Posts: 14
Registered: ‎10-27-2011
My Device: DEV
My Carrier: DEV

Re: loading custom font problem

i dont mean to steal the thread. but i also have a custom font im trying to load ....it works just fine on os5 devices .. yet fails to load on os7 .. i dont get an error or anything .. it just loads the default font .. ( my custom font is arabic )