diff options
| author | Po Lu <luangruo@yahoo.com> | 2023-09-16 10:38:46 +0800 |
|---|---|---|
| committer | Po Lu <luangruo@yahoo.com> | 2023-09-16 10:38:46 +0800 |
| commit | ee4b6a4a2d6b2779cdcf662938b5c81dc2fd2bef (patch) | |
| tree | 2a76448b0abe5f75afb9dc72fd8ef91916bf9689 /src | |
| parent | bc25d76650ab6b534b4016c607c36f8b67267dc0 (diff) | |
Update Android port
* java/org/gnu/emacs/EmacsContextMenu.java (display): Return
false if the list of menu buttons is empty, lest Android cease
displaying menus on the assumption that Emacs is defective.
* java/org/gnu/emacs/EmacsView.java (popupMenu): Likewise.
* src/fns.c (sort_list): Render sentence motion commands
functional within commentary
* src/sfntfont.c (sfntfont_list_family): Sort and deduplicate
the returned family list and make it a list of symbols.
(syms_of_sfntfont) <Qstring_lessp>: New defsym.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 6 | ||||
| -rw-r--r-- | src/sfntfont.c | 32 |
2 files changed, 32 insertions, 6 deletions
diff --git a/src/fns.c b/src/fns.c index bd1d63a58c4..4731e416125 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2334,9 +2334,9 @@ See also the function `nreverse', which is used more often. */) /* Stably sort LIST ordered by PREDICATE using the TIMSORT - algorithm. This converts the list to a vector, sorts the vector, - and returns the result converted back to a list. The input list is - destructively reused to hold the sorted result. */ + algorithm. This converts the list to a vector, sorts the vector, + and returns the result converted back to a list. The input list + is destructively reused to hold the sorted result. */ static Lisp_Object sort_list (Lisp_Object list, Lisp_Object predicate) diff --git a/src/sfntfont.c b/src/sfntfont.c index d6dfa8b6f0d..0696b66d244 100644 --- a/src/sfntfont.c +++ b/src/sfntfont.c @@ -3646,8 +3646,9 @@ sfntfont_draw (struct glyph_string *s, int from, int to, Lisp_Object sfntfont_list_family (struct frame *f) { - Lisp_Object families; + Lisp_Object families, tem, next; struct sfnt_font_desc *desc; + unsigned short count; families = Qnil; @@ -3655,8 +3656,30 @@ sfntfont_list_family (struct frame *f) /* Add desc->family to the list. */ families = Fcons (desc->family, families); - /* Not sure if deleting duplicates is worth it. Is this ever - called? */ + /* Sort families in preparation for removing duplicates. */ + families = Fsort (families, Qstring_lessp); + + /* Remove each duplicate within families. */ + + tem = families; + while (!NILP (tem) && !NILP ((next = XCDR (tem)))) + { + /* If the two strings are equal. */ + if (!NILP (Fstring_equal (XCAR (tem), XCAR (next)))) + /* Set tem's cdr to the cons after the next item. */ + XSETCDR (tem, XCDR (next)); + else + /* Otherwise, start considering the next item. */ + tem = next; + } + + /* Intern each font family. */ + + tem = families; + + FOR_EACH_TAIL (tem) + XSETCAR (tem, Fintern (XCAR (tem), Qnil)); + return families; } @@ -3962,6 +3985,9 @@ syms_of_sfntfont (void) /* Default foundry name. */ DEFSYM (Qmisc, "misc"); + /* Predicated employed for sorting font family lists. */ + DEFSYM (Qstring_lessp, "string-lessp"); + /* Set up staticpros. */ sfnt_vendor_name = Qnil; staticpro (&sfnt_vendor_name); |
