Mercurial > emacs
changeset 106434:de4084d806f6
* xfaces.c (Fx_family_fonts): Handle 2009-07-14 change to return
value of font_list_entities (Bug#5085).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 05 Dec 2009 20:16:42 +0000 |
parents | 7c2192f52cb6 |
children | 9e1a89d804c8 |
files | src/ChangeLog src/xfaces.c |
diffstat | 2 files changed, 38 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sat Dec 05 20:09:49 2009 +0000 +++ b/src/ChangeLog Sat Dec 05 20:16:42 2009 +0000 @@ -1,3 +1,8 @@ +2009-12-05 Chong Yidong <cyd@stupidchicken.com> + + * xfaces.c (Fx_family_fonts): Handle 2009-07-14 change to return + value of font_list_entities (Bug#5085). + 2009-12-04 Juanma Barranquero <lekktu@gmail.com> Fix `string-to-number' to deal consistently with integers and floats.
--- a/src/xfaces.c Sat Dec 05 20:09:49 2009 +0000 +++ b/src/xfaces.c Sat Dec 05 20:16:42 2009 +0000 @@ -1745,8 +1745,8 @@ (family, frame) Lisp_Object family, frame; { - Lisp_Object font_spec, vec; - int i, nfonts; + Lisp_Object font_spec, list, *drivers, vec; + int i, nfonts, ndrivers; Lisp_Object result; if (NILP (frame)) @@ -1759,32 +1759,38 @@ CHECK_STRING (family); font_parse_family_registry (family, Qnil, font_spec); } - vec = font_list_entities (frame, font_spec); - nfonts = ASIZE (vec); - if (nfonts == 0) + + list = font_list_entities (frame, font_spec); + if (NILP (list)) return Qnil; - if (nfonts > 1) - { - for (i = 0; i < 4; i++) - switch (font_sort_order[i]) - { - case XLFD_SWIDTH: - font_props_for_sorting[i] = FONT_WIDTH_INDEX; break; - case XLFD_POINT_SIZE: - font_props_for_sorting[i] = FONT_SIZE_INDEX; break; - case XLFD_WEIGHT: - font_props_for_sorting[i] = FONT_WEIGHT_INDEX; break; - default: - font_props_for_sorting[i] = FONT_SLANT_INDEX; break; - } - font_props_for_sorting[i++] = FONT_FAMILY_INDEX; - font_props_for_sorting[i++] = FONT_FOUNDRY_INDEX; - font_props_for_sorting[i++] = FONT_ADSTYLE_INDEX; - font_props_for_sorting[i++] = FONT_REGISTRY_INDEX; - - qsort (XVECTOR (vec)->contents, nfonts, sizeof (Lisp_Object), - compare_fonts_by_sort_order); - } + + /* Sort the font entities. */ + for (i = 0; i < 4; i++) + switch (font_sort_order[i]) + { + case XLFD_SWIDTH: + font_props_for_sorting[i] = FONT_WIDTH_INDEX; break; + case XLFD_POINT_SIZE: + font_props_for_sorting[i] = FONT_SIZE_INDEX; break; + case XLFD_WEIGHT: + font_props_for_sorting[i] = FONT_WEIGHT_INDEX; break; + default: + font_props_for_sorting[i] = FONT_SLANT_INDEX; break; + } + font_props_for_sorting[i++] = FONT_FAMILY_INDEX; + font_props_for_sorting[i++] = FONT_FOUNDRY_INDEX; + font_props_for_sorting[i++] = FONT_ADSTYLE_INDEX; + font_props_for_sorting[i++] = FONT_REGISTRY_INDEX; + + ndrivers = XINT (Flength (list)); + drivers = alloca (sizeof (Lisp_Object) * ndrivers); + for (i = 0; i < ndrivers; i++, list = XCDR (list)) + drivers[i] = XCAR (list); + vec = Fvconcat (ndrivers, drivers); + nfonts = ASIZE (vec); + + qsort (XVECTOR (vec)->contents, nfonts, sizeof (Lisp_Object), + compare_fonts_by_sort_order); result = Qnil; for (i = nfonts - 1; i >= 0; --i)