From e11e56a057aae22872014e97684e0a9b3fbde156 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 13 Apr 2023 19:54:54 +0800 Subject: [PATCH] Update Android port * doc/emacs/android.texi (Android Fonts): Update documentation. * doc/lispref/frames.texi (Accessing Selections, X Selections): Fix typos. * src/sfntfont-android.c (system_font_directories) (init_sfntfont_android): Add `/product/fonts'. --- doc/emacs/android.texi | 32 ++++++++++++++++---------------- doc/lispref/frames.texi | 33 ++++++++++++++++++--------------- src/sfntfont-android.c | 3 ++- 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi index 67faea7f76d..e79d3226263 100644 --- a/doc/emacs/android.texi +++ b/doc/emacs/android.texi @@ -533,23 +533,23 @@ menu in the system settings, but this procedure may vary by device. Emacs supports two font backends under Android: they are respectively named @code{sfnt-android} and @code{android}. -Upon startup, Emacs enumerates all the TrueType format fonts in the -directory @file{/system/fonts}, and the @file{fonts} directory -(@dfn{user fonts directory}) inside the Emacs home directory. Emacs -assumes there will always be a font named ``Droid Sans Mono'', and -then defaults to using this font. These fonts are then displayed by -the @code{sfnt-android} font driver. - -When running on Android, Emacs currently lacks support for OpenType + Upon startup, Emacs enumerates all the TrueType format fonts in the +directories @file{/system/fonts} and @file{/product/fonts}, and the +@file{fonts} directory (@dfn{user fonts directory}) inside the Emacs +home directory. Emacs assumes there will always be a font named +``Droid Sans Mono'', and then defaults to using this font. These +fonts are then displayed by the @code{sfnt-android} font driver. + + When running on Android, Emacs currently lacks support for OpenType fonts. This means that only a subset of the fonts installed on the system are currently available to Emacs. If you are interested in lifting this limitation, please contact @email{emacs-devel@@gnu.org}. -If the @code{sfnt-android} font driver fails to find any fonts at all, -Emacs falls back to the @code{android} font driver. This is a very -lousy font driver, because of limitations and inaccuracies in the font -metrics provided by the Android platform. In that case, Emacs uses -the ``Monospace'' typeface configured on your system; this should + If the @code{sfnt-android} font driver fails to find any fonts at +all, Emacs falls back to the @code{android} font driver. This is a +very lousy font driver, because of limitations and inaccuracies in the +font metrics provided by the Android platform. In that case, Emacs +uses the ``Monospace'' typeface configured on your system; this should always be Droid Sans Mono. @cindex TrueType GX fonts, android @@ -560,13 +560,13 @@ These fonts (also termed ``TrueType GX fonts'', ``variable fonts'', and ``multiple master fonts'') provide multiple different styles (``Bold'', ``Italic'', etc) using a single font file. -When a user-installed distortable font is found, each font that a + When a user-installed distortable font is found, each font that a previously discovered font provided will no longer be used. In addition, any previously specified distortable fonts with the same family name are also removed. When a conventional font is found, any previous 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. +removed; distortable fonts with the same family will no longer be used +to provide that style. @node Android Troubleshooting @section What to do when something goes wrong on Android diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 7a752c1f6a9..a8a02114ecb 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -4064,21 +4064,23 @@ Emacs 25.1. @section Accessing Selections @code{gui-get-selection} is able to retrieve multiple different -kinds of selection data. However, the exact data types which Emacs -understands is not precisely specified and differs depending on the -window system on which Emacs is running. +kinds of selection data from any number of selections. However, the +data types and selections that Emacs understands is not precisely +specified and differs depending on the window system on which Emacs is +running. At the same time, @code{gui-set-selection} hides a great deal of complexity behind its back, at least on some systems: its @var{data} argument need not be a string, but is actually given verbatim to system specific code. - Emacs implements selections most completely on the X Window System. -This is both an artifact of history (X was the first window system -supported by Emacs) and one of technical reasons: instead of using -selections only to transfer text and multimedia content between -clients, X uses selections as a general inter-client communication -system, leading to a great proliferation of selection data types. + Emacs's implementation of selections is most complete on the X +Window System. This is both an artifact of history (X was the first +window system supported by Emacs) and one of technical reasons: +instead of using selections only to transfer text and multimedia +content between clients, X uses selections as a general inter-client +communication system, leading to a great proliferation of selection +data types. Even more confusingly, X also supports another inter-client communication mechanism: the Inter-Client Exchange. However, ICE is @@ -4097,17 +4099,18 @@ separate topic. fixed number of selections. Selections are instead identified by X ``atoms'', which are unique 29-bit identifiers issued by the X server for a corresponding name. In Emacs, you can simply write a symbol -with name of the atom, and Emacs will transparently request these +with the name of the atom, and Emacs will transparently request these identifiers where necessary. - When a program ``sets'' a selection under X, it actually takes -ownership of the selection---the X server will then deliver selection -requests to the program, which is obliged to respond to the requesting -client with the selection data. + When a program ``sets'' a selection under X, it actually makes +itself the ``owner'' of the selection---the X server will then deliver +selection requests to the program, which is obliged to respond to the +requesting client with the selection data. Similarly, a program does not ``get'' selection data from the X server. Instead, its selection requests are sent to the client with -the window which last took ownership over the selection. +the window which last took ownership over the selection, which then +replies with the requested data. Each selection request contains three parameters: diff --git a/src/sfntfont-android.c b/src/sfntfont-android.c index 5e4c8fc6c9f..de2a9253b57 100644 --- a/src/sfntfont-android.c +++ b/src/sfntfont-android.c @@ -52,6 +52,7 @@ struct sfntfont_android_scanline_buffer static char *system_font_directories[] = { (char *) "/system/fonts", + (char *) "/product/fonts", /* This should be filled in by init_sfntfont_android. */ (char[PATH_MAX]) { }, }; @@ -772,7 +773,7 @@ init_sfntfont_android (void) /* Set up the user fonts directory. This directory is ``fonts'' in the Emacs files directory. */ - snprintf (system_font_directories[1], PATH_MAX, "%s/fonts", + snprintf (system_font_directories[2], PATH_MAX, "%s/fonts", android_get_home_directory ()); } -- 2.39.2