Revision: 2450
http://sourceforge.net/p/swingme/code/2450
Author: yuranet
Date: 2021-06-13 14:50:52 +0000 (Sun, 13 Jun 2021)
Log Message:
-----------
font code cleanup
Modified Paths:
--------------
AndroidME/src_MIDP/javax/microedition/lcdui/Font.java
Modified: AndroidME/src_MIDP/javax/microedition/lcdui/Font.java
===================================================================
--- AndroidME/src_MIDP/javax/microedition/lcdui/Font.java 2021-06-13 14:27:46 UTC (rev 2449)
+++ AndroidME/src_MIDP/javax/microedition/lcdui/Font.java 2021-06-13 14:50:52 UTC (rev 2450)
@@ -17,14 +17,11 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
package javax.microedition.lcdui;
import java.util.Hashtable;
-
import net.yura.android.lcdui.FontManager;
-
public final class Font {
public static final int STYLE_PLAIN = 0;
public static final int STYLE_BOLD = 1;
@@ -42,8 +39,7 @@
public static final int FONT_STATIC_TEXT = 0;
public static final int FONT_INPUT_TEXT = 1;
- private static final Font DEFAULT_FONT = new Font(Font.FACE_SYSTEM,
- Font.STYLE_PLAIN, Font.SIZE_MEDIUM);
+ private static final Font DEFAULT_FONT = new Font(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM);
private static Font[] fontsBySpecifier = { DEFAULT_FONT, DEFAULT_FONT };
@@ -61,19 +57,20 @@
// NOTE: We support negative sizes, meaning literal font sizes.
private Font(int face, int style, int size) {
- if ((face != FACE_SYSTEM) && (face != FACE_MONOSPACE)
- && (face != FACE_PROPORTIONAL)) {
+ if ((face != FACE_SYSTEM) && (face != FACE_MONOSPACE) && (face != FACE_PROPORTIONAL)) {
throw new IllegalArgumentException();
}
- if (!(isPlain() || isBold() || isItalic() || isUnderlined())) {
- throw new IllegalArgumentException();
- }
if (size >= 0 && size != SIZE_SMALL && size != SIZE_MEDIUM && size != SIZE_LARGE) {
throw new IllegalArgumentException("size: "+size);
}
+ this.style = style;
+
+ if (!(isPlain() || isBold() || isItalic() || isUnderlined())) {
+ throw new IllegalArgumentException();
+ }
+
this.face = face;
- this.style = style;
this.size = size;
}
@@ -82,9 +79,9 @@
}
public static Font getFont(int specifier) {
- if (specifier != Font.FONT_INPUT_TEXT
- && specifier != Font.FONT_STATIC_TEXT)
+ if (specifier != Font.FONT_INPUT_TEXT && specifier != Font.FONT_STATIC_TEXT) {
throw new IllegalArgumentException("Bad specifier");
+ }
return fontsBySpecifier[specifier];
}
@@ -130,7 +127,6 @@
if (height == -1) {
height = FontManager.getFont(this).getHeight();
}
-
return height;
}
@@ -138,7 +134,6 @@
if (baselinePosition == -1) {
baselinePosition = FontManager.getFont(this).getBaselinePosition();
}
-
return baselinePosition;
}
@@ -167,5 +162,4 @@
public int hashCode() {
return style + size + face;
}
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|