Welcome!

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

Reply
Developer
Posts: 192
Registered: ‎01-12-2010
My Device: Bold
My Carrier: ZAIN
Accepted Solution

Font Settings

Dear Guys,

I have been stuck something very basic but i dont what is causing this problem.

 

Font Error

above screenshot is what i want to achieve has anyone added custom fonts to their application

 

 

rgds

 Nadir Firfire

 

Developer
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: Font Settings

What kind of problem are you having? You can certainly set the font for a particular field. You can also use FontManager.setApplicationFont (or Font.setDefaultFont in the pre-5.0 api) to change all fields in your application.




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Developer
Posts: 2,268
Registered: ‎07-08-2009
My Device: various
My Carrier: various

Re: Font Settings

1. Use FontFamily.getFontFamilies() to get all font families and populate an ObjectChoiceField

2. Once font family is selected, use FontFamily.forName(fontFamilyName) to get font family.

3. Use NumericChoiceField to choose font size.

4. Use fontFamily.getFont(int style, int height) to get the font.

5. Use field.setFont(font) to set font in the field.

6. Use updateLayout() (I don't believe invalidate() is sufficient in this case) to refresh the screen.

7. Once the user presses OK, heed Ted_Hopp's advice and set that font as the default for your application.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
Posts: 192
Registered: ‎01-12-2010
My Device: Bold
My Carrier: ZAIN

Re: Font Settings

Dear Ted_Hopp / Arkadyz,

 

let me try this sugesstion since i have done almost what you have said.

but let me try one more time and get back to you....

 

 

rgds

Nadir Firfire

Developer
Posts: 192
Registered: ‎01-12-2010
My Device: Bold
My Carrier: ZAIN

Re: Font Settings

Dear Guys,

One small question...

 

I want to set two fonts on my application

 

one iam doing usign the field.setFont

and other setDefaultFont will setdefault font over write the effect of field.setFont

 

 

rgds

Nadir Firfire

Highlighted
Developer
Posts: 1,305
Registered: ‎01-21-2009
My Device: Not Specified

Re: Font Settings

No. The default font is used only when no font has been specified using Field.setFont. When you set a (non-null) font using Field.setFont, the default font is ignored, even if the default font is later changed.




Solved? click "Accept as solution". Helpful? give kudos by clicking on the star.
Developer
Posts: 192
Registered: ‎01-12-2010
My Device: Bold
My Carrier: ZAIN

Re: Font Settings