How to repliacte the system's font size in ttf?

11 views
Skip to first unread message

romanca...@gmail.com

unread,
Feb 16, 2017, 9:45:22 PM2/16/17
to CodenameOne Discussions

Hi! i read somewhere that the system's fonts resizes itself depending on the device resolution.

because i want to reproduce that beheavior i do the following code, but im not sure if im doing well or i need to consider another device circunstance:

my code is:

       fontSmallSize = (int) (Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL).getHeight());
        fontMediumSize = (int) (Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM).getHeight());
        fontLargeSize = (int) (Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE).getHeight());


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,
Feb 17, 2017, 1:51:26 AM2/17/17
to CodenameOne Discussions, romanca...@gmail.com
Hi,
I would recommend sizing a font in millimeters which IMO is more convenient.
http://stackoverflow.com/questions/42287374/change-button-text-font-size-in-codename-one
Reply all
Reply to author
Forward
0 new messages