Size according resolution

59 views
Skip to first unread message

romanca...@gmail.com

unread,
Nov 13, 2016, 9:27:27 PM11/13/16
to CodenameOne Discussions
HI Shai! what is the right method to resize fonts and objects according the device resolution?

thanks!!!

If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA
Desktop OS
Simulator
Device

Shai Almog

unread,
Nov 14, 2016, 12:24:50 AM11/14/16
to CodenameOne Discussions, romanca...@gmail.com
Hi,
see http://codenameone.com/manual/basics.html
This is implicit. For images use multi-image, 9-piece borders. Fonts are automatically resized as long as you don't use pixels.
Message has been deleted

Dave Dyer

unread,
Nov 14, 2016, 10:21:23 PM11/14/16
to CodenameOne Discussions, romanca...@gmail.com
This may be true if you NEVER ask for a font with a particular size, but If you do
then you have to make your own adjustment.  My internal logic for font size is
calibrated for a nominal 12 point font on a 96 DPI screen, and when I ask for
a derived font, I ask for <actual DPI>*size/96

If you're trying to do something genericly "bigger/smaller", beware that it can be quite difficult
to determine what size a font you're given is, as some starting fonts (even truetype fonts)
do not have a reliable size, and that size they claim to be doesn't correspond directly to the size
you'd get if you asked for one the size they say they are.


Shai Almog

unread,
Nov 15, 2016, 12:01:19 AM11/15/16
to CodenameOne Discussions, romanca...@gmail.com
Dave we had this discussion before, you aren't using Codename One correctly.

Codename One supports millimeter font sizes which are very portable and adapt to display sizes with native fonts.

Dave Dyer

unread,
Nov 15, 2016, 4:36:43 PM11/15/16
to CodenameOne Discussions, romanca...@gmail.com
This is true if you're using the GUI designer to set your styles and determine all your font choices.

My application already had it's own basic font and size selection, and (more important) a lot of logic
to select fonts to fit text into ad-hoc boxes.

Reply all
Reply to author
Forward
0 new messages