Update Android port

* src/androidmenu.c (android_menu_show): Properly encode pane
names before deriving Java strings from them.

* src/sfntfont.c (sfnt_parse_style, sfntfont_list_1): Intern
adstyles.
This commit is contained in:
Po Lu 2023-09-30 15:36:49 +08:00
parent 9a3523e7d8
commit cdc653d68f
2 changed files with 19 additions and 7 deletions

View file

@ -248,7 +248,6 @@ android_menu_show (struct frame *f, int x, int y, int menuflags,
jobject title_string, help_string, temp;
size_t i;
Lisp_Object pane_name, prefix;
const char *pane_string;
specpdl_ref count, count1;
Lisp_Object item_name, enable, def, tem, entry, type, selected;
Lisp_Object help;
@ -357,13 +356,21 @@ android_menu_show (struct frame *f, int x, int y, int menuflags,
/* Now figure out the title of this pane. */
pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
pane_string = (NILP (pane_name)
? "" : SSDATA (pane_name));
if ((menuflags & MENU_KEYMAPS) && !NILP (prefix))
pane_string++;
/* PANE_NAME may be nil, in which case it must be set to an
empty string. */
if (NILP (pane_name))
pane_name = empty_unibyte_string;
/* Remove the leading prefix character if need be. */
if ((menuflags & MENU_KEYMAPS) && !NILP (prefix)
&& SCHARS (prefix))
pane_name = Fsubstring (pane_name, make_fixnum (1), Qnil);
/* Add the pane. */
temp = (*env)->NewStringUTF (env, pane_string);
temp = android_build_string (pane_name);
android_exception_check ();
(*env)->CallNonvirtualVoidMethod (env, current_context_menu,

View file

@ -545,6 +545,11 @@ sfnt_parse_style (Lisp_Object style_name, struct sfnt_font_desc *desc)
continue;
}
/* The adstyle must be a symbol, so intern it if it is set. */
if (!NILP (desc->adstyle))
desc->adstyle = Fintern (desc->adstyle, Qnil);
SAFE_FREE ();
}
@ -1655,7 +1660,7 @@ sfntfont_list_1 (struct sfnt_font_desc *desc, Lisp_Object spec,
if (NILP (desc->instances))
{
tem = AREF (spec, FONT_ADSTYLE_INDEX);
if (!NILP (tem) && NILP (Fequal (tem, desc->adstyle)))
if (!NILP (tem) && !EQ (tem, desc->adstyle))
return 0;
if (FONT_WIDTH_NUMERIC (spec) != -1