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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
Saltzmeyer
Posts: 22
Registered: ‎09-02-2009
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.

Please use plain text.
Developer
paulhaenel
Posts: 220
Registered: ‎09-09-2008
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.
Please use plain text.
Developer
Saltzmeyer
Posts: 22
Registered: ‎09-02-2009

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.

Please use plain text.