03-12-2009 02:38 PM
Hi,
How can I set the font size to a system font size. For example, if I wanted to set the font to the same size as it appears when you set the size to 10 under the Options screen.
Thanks.
Solved! Go to Solution.
03-12-2009 03:46 PM
03-12-2009 03:54 PM
Not quite, unless from Font.getDefault() I can get the size (again, not in pixels).
I want to allow the user to select the font size for use within my program:
ie: 7,8,9,10... or System font size
And since the screen resolution is different for various devices, I can't just set the height using the setHeight(int pixels) method, since a size 10 on one device will require a different height than a size 10 on another device.
I'd like for my font heights (7,8,9, etc) to match up with the devices...
THanks!
03-12-2009 04:31 PM
03-12-2009 04:47 PM
03-13-2009 02:26 PM
FYI:
FOund it:
public Font derive(int style,
int height,
int units)
Set units to Ui.UNITS_pt, then specify the size with the height variable
03-24-2009 03:50 PM - edited 03-24-2009 03:55 PM
Okay so i have just spent the past 2 hours googling and searching including this forum on a simple example on how to set the font size for a handheld application and ran across this forum posting several times. I am not clear on how to implement the Font on the handheld.
Could you clarify exactly how to use the Font.derive please.
I tried the following but eclipse is yelling at me.
Font f = new Font();
Font.derive(Font.PLAIN, 10, Ui.UNITS_pt);
super.getActiveScreen().setFont(f);
Current time is 3:55pm EST. I am online for chat at PowerMountain Chat just enter in any user name to connect or post response to this forum please.
03-30-2009 01:04 PM
04-26-2009 04:46 PM
Hey, just in case someone else is wondering, here is the solution:
// First, derive the default font and modify it to be PLAIN and 10 pt
Font myFont = Font.getDefault().derive(Font.PLAIN, 10);
// Then, set the font to what you derived above
graphics.setFont(myFont );
// Then draw the text
graphics.drawText("Hello World", xpos, ypos);
07-09-2012 04:48 AM
Hey, Thanks it Works..Thanks a lot..I solved my Problem..