aboutsummaryrefslogtreecommitdiffstats
path: root/java/org
diff options
context:
space:
mode:
authorPo Lu2023-07-09 10:05:08 +0800
committerPo Lu2023-07-09 10:05:08 +0800
commit105c876a609d4610ce684c7513b8548feae3638a (patch)
tree412b13f9a22c8587ee08050ffaa3e4465cbd9960 /java/org
parentf812d92f67a28f49823ff8414bb9bcfb3eb82676 (diff)
downloademacs-105c876a609d4610ce684c7513b8548feae3638a.tar.gz
emacs-105c876a609d4610ce684c7513b8548feae3638a.zip
Update Android port
* java/org/gnu/emacs/EmacsDrawPoint.java (perform): Don't fill an extra pixel. * java/org/gnu/emacs/EmacsService.java (onCreate): Make sure scaledDensity is always at least 160 dpi.
Diffstat (limited to 'java/org')
-rw-r--r--java/org/gnu/emacs/EmacsDrawPoint.java5
-rw-r--r--java/org/gnu/emacs/EmacsService.java15
2 files changed, 18 insertions, 2 deletions
diff --git a/java/org/gnu/emacs/EmacsDrawPoint.java b/java/org/gnu/emacs/EmacsDrawPoint.java
index de8ddf09cc4..6a1cb744d60 100644
--- a/java/org/gnu/emacs/EmacsDrawPoint.java
+++ b/java/org/gnu/emacs/EmacsDrawPoint.java
@@ -25,7 +25,10 @@ public final class EmacsDrawPoint
25 perform (EmacsDrawable drawable, 25 perform (EmacsDrawable drawable,
26 EmacsGC immutableGC, int x, int y) 26 EmacsGC immutableGC, int x, int y)
27 { 27 {
28 EmacsDrawRectangle.perform (drawable, immutableGC, 28 /* Use EmacsFillRectangle instead of EmacsDrawRectangle, as the
29 latter actually draws a rectangle one pixel wider than
30 specified. */
31 EmacsFillRectangle.perform (drawable, immutableGC,
29 x, y, 1, 1); 32 x, y, 1, 1);
30 } 33 }
31} 34}
diff --git a/java/org/gnu/emacs/EmacsService.java b/java/org/gnu/emacs/EmacsService.java
index 62fd2740286..f484e2c9ca3 100644
--- a/java/org/gnu/emacs/EmacsService.java
+++ b/java/org/gnu/emacs/EmacsService.java
@@ -225,6 +225,17 @@ public final class EmacsService extends Service
225 * pixelDensityX); 225 * pixelDensityX);
226 resolver = getContentResolver (); 226 resolver = getContentResolver ();
227 227
228 /* If the density used to compute the text size is lesser than
229 160, there's likely a bug with display density computation.
230 Reset it to 160 in that case.
231
232 Note that Android uses 160 ``dpi'' as the density where 1 point
233 corresponds to 1 pixel, not 72 or 96 as used elsewhere. This
234 difference is codified in PT_PER_INCH defined in font.h. */
235
236 if (scaledDensity < 160)
237 scaledDensity = 160;
238
228 try 239 try
229 { 240 {
230 /* Configure Emacs with the asset manager and other necessary 241 /* Configure Emacs with the asset manager and other necessary
@@ -240,7 +251,9 @@ public final class EmacsService extends Service
240 251
241 Log.d (TAG, "Initializing Emacs, where filesDir = " + filesDir 252 Log.d (TAG, "Initializing Emacs, where filesDir = " + filesDir
242 + ", libDir = " + libDir + ", and classPath = " + classPath 253 + ", libDir = " + libDir + ", and classPath = " + classPath
243 + "; fileToOpen = " + EmacsOpenActivity.fileToOpen); 254 + "; fileToOpen = " + EmacsOpenActivity.fileToOpen
255 + "; display density: " + pixelDensityX + " by "
256 + pixelDensityY + " scaled to " + scaledDensity);
244 257
245 /* Start the thread that runs Emacs. */ 258 /* Start the thread that runs Emacs. */
246 thread = new EmacsThread (this, new Runnable () { 259 thread = new EmacsThread (this, new Runnable () {