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: 22
Registered: ‎09-02-2009
My Device: Not Specified
Accepted Solution

Use BBAlpha Serif as font for a RichTextField

How to specify that a particular RichTextField should use a specific font (such as BBAlpha Serif) instead of the Default Font? Thanx.

Developer
Posts: 220
Registered: ‎09-09-2008
My Device: Bold 9780
My Carrier: Telstra AU

Re: Use BBAlpha Serif as font for a RichTextField

Hi,

 

you create aRichTextField object

 

 

RichTextField rtf = new RichTextField();

 

The you create a font object like

 

 

Font font = Font.getDefault();

try{
   FontFamily ff = FontFamily.forName("BBAlpha Serif");
   font = ff.getFont(Font.BOLD, 18);
}catch(Exception e){}

 

 

Then all you need to do is set the font for the rtf field

 

 

rtf.setFont(font);

 

 

 

Hope this helps....

 

 

 

 

 

 

 

 

 

 

 

-----------

Follow me on twitter: twitter.com/paul.haenel

If your issue is resolved, please mark this thread as solved.

Set the "Solution" mark on the post which contains the answer to your question.
Developer
Posts: 22
Registered: ‎09-02-2009
My Device: Not Specified

Re: Use BBAlpha Serif as font for a RichTextField

Thank you Paul    (a) It worked perfectly,  (b) The code was straightforward,  (c) The code was self-documenting.