09-23-2012 07:57 AM
on 7.0 Font.getDefault().getHeight() it giveds me 27
on 7.1 Font.getDefault().getHeight() it gives me 32
I want to have the font set based on the width + height of the screen.If scnreen is 640..i want it 27.
if screen is 320, i want it 12..
how can I do this? on what logic?
right now I am doign this
final int fSize = Display.getWidth()/25;
Font font1 = getFont().derive(Font.BOLD, fSize);
basically 640/25 = 25 font size lol
09-23-2012 02:43 PM
Can I recommend that you use points and not pixels when determining Font size. points are a fixed physical size, so will appear the same physical size on the screen regardless of the resolution of the screen. This means you do not have to do any calculations. And remember that screen size and screen resolution are two completely different things. Your font size will depend on the resolution of the device, devices with higher density of pixels (more dpi) will require more pixels.
Anyway, to define fonts using points, define the font using Ui.UNITS_pt. 1 point == 1/72 inch, most users will have their default font set to 8 or 9 points.
09-23-2012 03:10 PM
09-23-2012 04:29 PM
Have a look at the tutorials you will find here:
especially the last one that talks about handling the various screen sizes and resolutions.