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: 57
Registered: ‎04-14-2009
My Device: Not Specified

How to define the custom font for j2me apps in BlackBerry

Hi,

 

I am developing a j2me application. In that, I am using Canvas for display purpose.

 

On that canvas, I have to show some info to the user (as a help content) in very small letters.

 

I am using the code:
public void paint(Graphics g)

{

Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN,Font.SIZE_SMALL); 

g.setFont(font);

g.drawString("(c) myCompanyName v1.4.5",15,220,Graphics.LEFT|Graphics.TOP); 

}

 

the above code works, but the content is not fit into the device. I want the font size to be as smaller as possible.

 

Is there any way to define custom font (very small font) and apply for canvas.

 

Thanks,

Manoj. 

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: How to define the custom font for j2me apps in BlackBerry

For custom font of desired size and style, you can create a image of those alphabetical characters and then clip each char and draw image on the screen.

Use Search. "Accept Solution" If the problem is resolved.
Highlighted
Developer
Posts: 59
Registered: ‎01-02-2009
My Device: Not Specified

Re: How to define the custom font for j2me apps in BlackBerry

 


manukumar wrote:

Hi,

 

I am developing a j2me application. In that, I am using Canvas for display purpose.

 

On that canvas, I have to show some info to the user (as a help content) in very small letters.

 

I am using the code:
public void paint(Graphics g)

{

Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN,Font.SIZE_SMALL); 

g.setFont(font);

g.drawString("(c) myCompanyName v1.4.5",15,220,Graphics.LEFT|Graphics.TOP); 

}

 

the above code works, but the content is not fit into the device. I want the font size to be as smaller as possible.

 

Is there any way to define custom font (very small font) and apply for canvas.

 

Thanks,

Manoj. 


 

 

Life can be stressful, especially when coding for a device that won't let you do the neat things other people are able to do. It stresses you out even more when someone says "up can't do it" "only if you use a UI app"

 

Welcome to the world of coding, we're here to help.

 

http://supportforums.blackberry.com/t5/Java-Development/Smallest-J2ME-Font-on-Blackberry-BOLD-plain-...

 

Check out my long tutorial regaurding how to fix this annoying problem...what's that?

 

tldr?  you say...my tutorial is too long so you didn't read?

 

it's ok..just scroll down to the bottom of the tut and grab my code and test it haha.

 

Enjoy :-)

 

--Jlover53

/************** BelowZeroSoft ***********

www.belowzerosoft.com

Using creativity to blow your mind through software 1 step at a time.

*/