My favorites
▼
|
Sign in
microemu
MicroEmu is a pure Java implementation of Java ME.
Project Home
Downloads
Wiki
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
65
attachment: scalable.patch
(2.7 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Index: src/org/microemu/android/device/AndroidFontManager.java
===================================================================
--- src/org/microemu/android/device/AndroidFontManager.java (revision 2413)
+++ src/org/microemu/android/device/AndroidFontManager.java (working copy)
@@ -31,9 +31,14 @@
import javax.microedition.lcdui.Font;
import org.microemu.device.FontManager;
+import org.microemu.device.EmulatorContext;
import android.graphics.Typeface;
+import android.util.TypedValue;
+
+import android.util.DisplayMetrics;
+
public class AndroidFontManager implements FontManager
{
private static int SIZE_SMALL = 12;
@@ -42,6 +47,11 @@
private static HashMap<Font, AndroidFont> fonts = new HashMap<Font, AndroidFont>();
+ private static DisplayMetrics metrics;
+ public AndroidFontManager(DisplayMetrics metrics) {
+ this.metrics = metrics;
+ }
+
static AndroidFont getFont(Font meFont)
{
AndroidFont result = fonts.get(meFont);
@@ -77,7 +87,10 @@
} else if (meFont.getSize() == Font.SIZE_LARGE) {
size = SIZE_LARGE;
}
- result = new AndroidFont(Typeface.create(family, style), size, underlined);
+ result = new AndroidFont(Typeface.create(family, style), TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_SP,
+ size,
+ metrics), underlined);
fonts.put(meFont, result);
}
Index: src/org/microemu/android/device/AndroidFont.java
===================================================================
--- src/org/microemu/android/device/AndroidFont.java (revision 2413)
+++ src/org/microemu/android/device/AndroidFont.java (working copy)
@@ -38,7 +38,7 @@
public FontMetricsInt metrics;
- public AndroidFont(Typeface typeface, int size, boolean underlined) {
+ public AndroidFont(Typeface typeface, float size, boolean underlined) {
paint.setTypeface(typeface);
paint.setTextSize(size);
paint.setUnderlineText(underlined);
Index: src/org/microemu/android/MicroEmulatorActivity.java
===================================================================
--- src/org/microemu/android/MicroEmulatorActivity.java (revision 2413)
+++ src/org/microemu/android/MicroEmulatorActivity.java (working copy)
@@ -99,7 +99,7 @@
private DeviceDisplay deviceDisplay = new AndroidDeviceDisplay(this, width, height);
- private FontManager fontManager = new AndroidFontManager();
+ private FontManager fontManager = new AndroidFontManager(getResources().getDisplayMetrics());
public DisplayComponent getDisplayComponent() {
// TODO consider removal of EmulatorContext.getDisplayComponent()
Powered by
Google Project Hosting