Change font size depending on DPI

100 views
Skip to first unread message

Th3B1gBull

unread,
Mar 24, 2014, 4:17:09 PM3/24/14
to codenameone...@googlegroups.com
Good evening,

I'm having troubles changing the font's size....

On Iphone the text is kinda to big, so some texts are not shown completely,
on the other hand, on the htc one the texts are extremly small so that it can't be used.

How could I change the font size to fit different screens ?

Shai Almog

unread,
Mar 25, 2014, 1:56:58 AM3/25/14
to codenameone...@googlegroups.com
That is part of the native theme, fonts are adapted to DPI automatically.
iOS defaults to large font in the title area with a 3d shadow for older versions.
You can customize all fonts in the theme easily: http://www.codenameone.com/how-do-i---create-a-simple-theme.html

Th3B1gBull

unread,
Mar 28, 2014, 10:28:06 AM3/28/14
to codenameone...@googlegroups.com
Thank you, but actually thats not what It looks like.
I mean on the Iphone 3GS simulator every string looks ok. On the 5s emulator 2 of the texts are not fully visible.
For example Location -> Loca...   and so on.... and on the other side on the HTC ONE the texts are extremly small ?

What can I do, if it is like you say and it should be adapted automatically but for me it seems totaly weired? 

Th3B1gBull

unread,
Mar 28, 2014, 10:39:55 AM3/28/14
to codenameone...@googlegroups.com
I understand the themes and co... and yea can customize stuff there, but that would'nt solve this problem, would it ? 
Also I wanted to report that it happend to me that the designer crashed completely so that the application was completly lost, so I had to copy all my files into a new project. I also have screenshots for this. 

Shai Almog

unread,
Mar 28, 2014, 1:56:14 PM3/28/14
to codenameone...@googlegroups.com
The HTC simulator is misconfigured.
Did you actually try this on devices?
Some text won't fit everywhere, this has nothing to do with the DPI, text matches millimeters.

Th3B1gBull

unread,
Mar 28, 2014, 2:13:20 PM3/28/14
to codenameone...@googlegroups.com
No, I did not try it on a IOS device, but sry it makes no sense that it fits on a 3gs and not on a 5s ? the 5s has higher resolution?

Shai Almog

unread,
Mar 29, 2014, 4:06:05 AM3/29/14
to codenameone...@googlegroups.com
It has a higher resolution so it has a larger font and larger padding/margin. 
It should be exactly double but these things aren't always 100% accurate.

Th3B1gBull

unread,
Mar 29, 2014, 8:52:48 AM3/29/14
to codenameone...@googlegroups.com
Well, okay. But so what can I do ?
Just make the font smaller?

Shai Almog

unread,
Mar 29, 2014, 12:34:28 PM3/29/14
to codenameone...@googlegroups.com
That's an option, you can also shrink the padding. You can disable ends with 3 points or make the text shorter.
Reply all
Reply to author
Forward
0 new messages