emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 28b31480768: Revise font family translation lists under Android


From: Po Lu
Subject: master 28b31480768: Revise font family translation lists under Android
Date: Fri, 6 Oct 2023 21:30:15 -0400 (EDT)

branch: master
commit 28b31480768143f9696746d30da151531706f94c
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Revise font family translation lists under Android
    
    * doc/emacs/android.texi (Android Environment): Revise paragraph
    illustrating the startup notification.
    (Android Fonts): Mention font family replacement.
    
    * src/sfntfont-android.c (init_sfntfont_android): Translate
    DejaVu Serif to either Droid Serif or Noto Serif.
---
 doc/emacs/android.texi | 54 +++++++++++++++++++++++++++++++++++---------------
 src/sfntfont-android.c | 15 +++++++++-----
 2 files changed, 48 insertions(+), 21 deletions(-)

diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi
index 5e018c3e4c5..bfa58b6cacc 100644
--- a/doc/emacs/android.texi
+++ b/doc/emacs/android.texi
@@ -333,7 +333,7 @@ time.
 
   From the perspective of users, Android is mostly a single user
 operating system; however, from the perspective of applications and
-Emacs, the system has an overwhelming number of users.
+Emacs, the system is host to an overwhelming number of users.
 
   Each application runs in its own user, with its home directory set
 to its app data directory (@pxref{Android File
@@ -360,12 +360,12 @@ consult the values of the variables 
@code{ctags-program-name},
 @xref{Subprocess Creation,,, elisp, the Emacs Lisp Reference Manual}.
 
   The @file{/assets} directory containing Emacs start-up files is
-supposed to be inaccessible to processes not directly created by
+meant to be inaccessible to processes not directly created by
 @code{zygote}, the system service responsible for starting
 applications.  Since required Lisp is found in the @file{/assets}
 directory, it would thus follow that it is not possible for Emacs to
 start itself as a subprocess.  A special binary named
-@command{libandroid-emacs.so} is provided with Emacs, and does its
+@command{libandroid-emacs.so} is provided with Emacs, which tries its
 best to start Emacs for the purpose of running Lisp in batch mode.
 However, the approach it takes was devised by reading Android source
 code, and is not sanctioned by the Android compatibility definition
@@ -419,25 +419,31 @@ system.  When all Emacs frames move to the background, 
Emacs might be
 terminated by the system at any time, for the purpose of saving system
 resources.
 
-  On Android 7.1 and earlier, Emacs tells the system to treat it as a
-``background service''.  The system will try to avoid killing Emacs
-unless the system is stressed for memory.
+  On Android 7.1 and earlier, Emacs designates itself a ``background
+service'', which impels the system to avoid killing Emacs unless it is
+stressed for memory.
 
   Android 8.0 removed the ability for background services to receive
 such special treatment.  However, Emacs applies a workaround: the
 system considers applications that create a permanent notification to
 be performing active work, and will avoid killing such applications.
 Thus, on those systems, Emacs displays a permanent notification for as
-long as it is running.  Once the notification is displayed, it can be
-safely hidden through the system settings without resulting in Emacs
-being killed.
-
-  However, it is not guaranteed that the system will not kill Emacs
-even if a notification is being displayed.  While the Open Handset
-Alliance's sample implementation of Android behaves correctly, many
-manufacturers place additional restrictions on program execution in
-the background in their proprietary versions of Android.  There is a
-list of such troublesome manufacturers and sometimes workarounds at
+long as it is running.
+
+  Before Android 13, Emacs does not require rights to display
+notifications.  Under Android 13 or later, the notification is hidden
+until the user accords Emacs such rights.  In spite of that, merely
+attempting to display the notification suffices to avert sudden death;
+whether the notification is displayed has no bearing on Emacs's
+capacity to execute in the background, and it may be disabled without
+any adverse consequences.
+
+  However, it is not guaranteed that the system will not kill Emacs.
+Although the Open Handset Alliance's sample implementation of Android
+behaves correctly, many manufacturers institute additional
+restrictions on program execution in the background in their
+proprietary versions of Android.  There is a list of such troublesome
+manufacturers and sometimes workarounds at
 @url{https://dontkillmyapp.com/}.
 
 @cindex permissions under android
@@ -747,6 +753,22 @@ conventional font with the same style and family will be 
removed;
 distortable fonts with the same family will no longer be used to
 provide that style.
 
+@cindex default font families, Android
+@vindex sfnt-default-family-alist
+
+  Emacs generally assumes the presence of font families named
+@samp{Monospace}, @samp{Monospace Serif}, @samp{Sans Serif}, and
+@samp{DejaVu Serif}.  Since Android does not provide any fonts by
+these names, Emacs modifies requests for them to request one of a
+corresponding set of font families distributed with Android.
+
+  To change either the set of font families subject to replacement, or
+that by which they are replaced, modify the variable
+@code{sfnt-default-family-alist}; then, restart Emacs.  Bear in mind
+that this is usually unwarranted, with customizations to the default
+or @code{variable-pitch} faces better made through modifying their
+definitions (@xref{Face Customization}).
+
 @node Android Troubleshooting
 @section Troubleshooting Startup Problems on Android
 @cindex troubleshooting, android
diff --git a/src/sfntfont-android.c b/src/sfntfont-android.c
index 53589078cda..be75c2d9e22 100644
--- a/src/sfntfont-android.c
+++ b/src/sfntfont-android.c
@@ -749,26 +749,31 @@ init_sfntfont_android (void)
   if (!android_init_gui)
     return;
 
-  /* Make sure to pick the right Sans Serif font depending on what
+  /* Make sure to pick the proper Sans Serif and Serif fonts for the
      version of Android the device is running.  */
+
   if (android_get_current_api_level () >= 15)
     Vsfnt_default_family_alist
-      = list3 (Fcons (build_string ("Monospace"),
+      = list4 (Fcons (build_string ("Monospace"),
                      build_string ("Droid Sans Mono")),
               /* Android doesn't come with a Monospace Serif font, so
                  this will have to do.  */
               Fcons (build_string ("Monospace Serif"),
                      build_string ("Droid Sans Mono")),
               Fcons (build_string ("Sans Serif"),
-                     build_string ("Roboto")));
+                     build_string ("Roboto")),
+              Fcons (build_string ("DejaVu Serif"),
+                     build_string ("Noto Serif")));
   else
     Vsfnt_default_family_alist
-      = list3 (Fcons (build_string ("Monospace"),
+      = list4 (Fcons (build_string ("Monospace"),
                      build_string ("Droid Sans Mono")),
               Fcons (build_string ("Monospace Serif"),
                      build_string ("Droid Sans Mono")),
               Fcons (build_string ("Sans Serif"),
-                     build_string ("Droid Sans")));
+                     build_string ("Droid Sans")),
+              Fcons (build_string ("DejaVu Serif"),
+                     build_string ("Droid Serif")));
 
   /* Set up the user fonts directory.  This directory is ``fonts'' in
      the Emacs files directory.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]