@@ -97,6 +97,16 @@ static public void setInteger(String key, int value) {
9797 set (key , String .valueOf (value ));
9898 }
9999
100+ static public int getScale () {
101+ if (get ("gui.scalePercent" ) == null )
102+ return 100 ;
103+ return getInteger ("gui.scalePercent" );
104+ }
105+
106+ static public int scale (int size ) {
107+ return size * getScale () / 100 ;
108+ }
109+
100110 static public Color getColorCycleColor (String name , int i ) {
101111 int cycleSize = getInteger (name + ".size" );
102112 name = String .format ("%s.%02d" , name , i % cycleSize );
@@ -125,12 +135,7 @@ static public Font getFont(String attr) {
125135 set (attr , value );
126136 font = PreferencesHelper .getFont (table , attr );
127137 }
128- int scale = getInteger ("gui.scalePercent" );
129- if (scale != 100 ) {
130- font = font
131- .deriveFont ((float ) (font .getSize ()) * (float ) scale / (float ) 100.0 );
132- }
133- return font ;
138+ return font .deriveFont ((float ) scale (font .getSize ()));
134139 }
135140
136141 /**
@@ -199,7 +204,7 @@ static public Image getLibImage(String filename, Component who) {
199204 Toolkit tk = Toolkit .getDefaultToolkit ();
200205
201206 SplitFile name = FileUtils .splitFilename (filename );
202- int scale = getInteger ( "gui.scalePercent" );
207+ int scale = getScale ( );
203208 File libFolder = Base .getContentFile ("lib" );
204209 File imageFile1x = new File (libFolder , name .basename + "." + name .extension );
205210 File imageFile2x = new File (libFolder , name .basename + "@2x." + name .extension );
0 commit comments