aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fns.c6
-rw-r--r--src/sfntfont.c32
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. */)
2334 2334
2335 2335
2336/* Stably sort LIST ordered by PREDICATE using the TIMSORT 2336/* Stably sort LIST ordered by PREDICATE using the TIMSORT
2337 algorithm. This converts the list to a vector, sorts the vector, 2337 algorithm. This converts the list to a vector, sorts the vector,
2338 and returns the result converted back to a list. The input list is 2338 and returns the result converted back to a list. The input list
2339 destructively reused to hold the sorted result. */ 2339 is destructively reused to hold the sorted result. */
2340 2340
2341static Lisp_Object 2341static Lisp_Object
2342sort_list (Lisp_Object list, Lisp_Object predicate) 2342sort_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,
3646Lisp_Object 3646Lisp_Object
3647sfntfont_list_family (struct frame *f) 3647sfntfont_list_family (struct frame *f)
3648{ 3648{
3649 Lisp_Object families; 3649 Lisp_Object families, tem, next;
3650 struct sfnt_font_desc *desc; 3650 struct sfnt_font_desc *desc;
3651 unsigned short count;
3651 3652
3652 families = Qnil; 3653 families = Qnil;
3653 3654
@@ -3655,8 +3656,30 @@ sfntfont_list_family (struct frame *f)
3655 /* Add desc->family to the list. */ 3656 /* Add desc->family to the list. */
3656 families = Fcons (desc->family, families); 3657 families = Fcons (desc->family, families);
3657 3658
3658 /* Not sure if deleting duplicates is worth it. Is this ever 3659 /* Sort families in preparation for removing duplicates. */
3659 called? */ 3660 families = Fsort (families, Qstring_lessp);
3661
3662 /* Remove each duplicate within families. */
3663
3664 tem = families;
3665 while (!NILP (tem) && !NILP ((next = XCDR (tem))))
3666 {
3667 /* If the two strings are equal. */
3668 if (!NILP (Fstring_equal (XCAR (tem), XCAR (next))))
3669 /* Set tem's cdr to the cons after the next item. */
3670 XSETCDR (tem, XCDR (next));
3671 else
3672 /* Otherwise, start considering the next item. */
3673 tem = next;
3674 }
3675
3676 /* Intern each font family. */
3677
3678 tem = families;
3679
3680 FOR_EACH_TAIL (tem)
3681 XSETCAR (tem, Fintern (XCAR (tem), Qnil));
3682
3660 return families; 3683 return families;
3661} 3684}
3662 3685
@@ -3962,6 +3985,9 @@ syms_of_sfntfont (void)
3962 /* Default foundry name. */ 3985 /* Default foundry name. */
3963 DEFSYM (Qmisc, "misc"); 3986 DEFSYM (Qmisc, "misc");
3964 3987
3988 /* Predicated employed for sorting font family lists. */
3989 DEFSYM (Qstring_lessp, "string-lessp");
3990
3965 /* Set up staticpros. */ 3991 /* Set up staticpros. */
3966 sfnt_vendor_name = Qnil; 3992 sfnt_vendor_name = Qnil;
3967 staticpro (&sfnt_vendor_name); 3993 staticpro (&sfnt_vendor_name);