My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 103 attachment: microemu-android_scale_font_size_based_on_device_density.patch (1.1 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
--- microemu-android/src/org/microemu/android/device/AndroidFontManager.java@101
+++ microemu-android/src/org/microemu/android/device/AndroidFontManager.java@102
@@ -33,9 +33,12 @@
import org.microemu.android.MicroEmulatorActivity;
import org.microemu.device.FontManager;

+import android.content.Context;
import android.graphics.Typeface;
import android.util.DisplayMetrics;
+import android.util.Log;
import android.util.TypedValue;
+import android.view.Display;

public class AndroidFontManager implements FontManager
{
@@ -82,6 +85,13 @@
} else if (meFont.getSize() == Font.SIZE_LARGE) {
size = MicroEmulatorActivity.config.FONT_SIZE_LARGE;
}
+
+ // Once default font size is defined,
+ // compute size relative to scaleDensity
+ // to enable consistent font size ratio
+ // accross any device resolution/density
+ size *= metrics.scaledDensity;
+
result = new AndroidFont(Typeface.create(family, style), TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_SP,
size,
Powered by Google Project Hosting