aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2009-12-05 20:16:42 +0000
committerChong Yidong2009-12-05 20:16:42 +0000
commit022eef6211c560013e6dda4c25b07921f8e9525c (patch)
tree05fde502c6a8e9893ce5db4f451c7fe2fb407d10 /src
parentce75f06e9110ceda73c75997a017f7c09dd9dd33 (diff)
downloademacs-022eef6211c560013e6dda4c25b07921f8e9525c.tar.gz
emacs-022eef6211c560013e6dda4c25b07921f8e9525c.zip
* xfaces.c (Fx_family_fonts): Handle 2009-07-14 change to return
value of font_list_entities (Bug#5085).
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/xfaces.c58
2 files changed, 37 insertions, 26 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 35100e126a3..1909af820fb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12009-12-05 Chong Yidong <cyd@stupidchicken.com>
2
3 * xfaces.c (Fx_family_fonts): Handle 2009-07-14 change to return
4 value of font_list_entities (Bug#5085).
5
12009-12-04 Juanma Barranquero <lekktu@gmail.com> 62009-12-04 Juanma Barranquero <lekktu@gmail.com>
2 7
3 Fix `string-to-number' to deal consistently with integers and floats. 8 Fix `string-to-number' to deal consistently with integers and floats.
diff --git a/src/xfaces.c b/src/xfaces.c
index 4c7f2d969d5..6630c10edcf 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1745,8 +1745,8 @@ the face font sort order. */)
1745 (family, frame) 1745 (family, frame)
1746 Lisp_Object family, frame; 1746 Lisp_Object family, frame;
1747{ 1747{
1748 Lisp_Object font_spec, vec; 1748 Lisp_Object font_spec, list, *drivers, vec;
1749 int i, nfonts; 1749 int i, nfonts, ndrivers;
1750 Lisp_Object result; 1750 Lisp_Object result;
1751 1751
1752 if (NILP (frame)) 1752 if (NILP (frame))
@@ -1759,32 +1759,38 @@ the face font sort order. */)
1759 CHECK_STRING (family); 1759 CHECK_STRING (family);
1760 font_parse_family_registry (family, Qnil, font_spec); 1760 font_parse_family_registry (family, Qnil, font_spec);
1761 } 1761 }
1762 vec = font_list_entities (frame, font_spec); 1762
1763 nfonts = ASIZE (vec); 1763 list = font_list_entities (frame, font_spec);
1764 if (nfonts == 0) 1764 if (NILP (list))
1765 return Qnil; 1765 return Qnil;
1766 if (nfonts > 1)
1767 {
1768 for (i = 0; i < 4; i++)
1769 switch (font_sort_order[i])
1770 {
1771 case XLFD_SWIDTH:
1772 font_props_for_sorting[i] = FONT_WIDTH_INDEX; break;
1773 case XLFD_POINT_SIZE:
1774 font_props_for_sorting[i] = FONT_SIZE_INDEX; break;
1775 case XLFD_WEIGHT:
1776 font_props_for_sorting[i] = FONT_WEIGHT_INDEX; break;
1777 default:
1778 font_props_for_sorting[i] = FONT_SLANT_INDEX; break;
1779 }
1780 font_props_for_sorting[i++] = FONT_FAMILY_INDEX;
1781 font_props_for_sorting[i++] = FONT_FOUNDRY_INDEX;
1782 font_props_for_sorting[i++] = FONT_ADSTYLE_INDEX;
1783 font_props_for_sorting[i++] = FONT_REGISTRY_INDEX;
1784 1766
1785 qsort (XVECTOR (vec)->contents, nfonts, sizeof (Lisp_Object), 1767 /* Sort the font entities. */
1786 compare_fonts_by_sort_order); 1768 for (i = 0; i < 4; i++)
1787 } 1769 switch (font_sort_order[i])
1770 {
1771 case XLFD_SWIDTH:
1772 font_props_for_sorting[i] = FONT_WIDTH_INDEX; break;
1773 case XLFD_POINT_SIZE:
1774 font_props_for_sorting[i] = FONT_SIZE_INDEX; break;
1775 case XLFD_WEIGHT:
1776 font_props_for_sorting[i] = FONT_WEIGHT_INDEX; break;
1777 default:
1778 font_props_for_sorting[i] = FONT_SLANT_INDEX; break;
1779 }
1780 font_props_for_sorting[i++] = FONT_FAMILY_INDEX;
1781 font_props_for_sorting[i++] = FONT_FOUNDRY_INDEX;
1782 font_props_for_sorting[i++] = FONT_ADSTYLE_INDEX;
1783 font_props_for_sorting[i++] = FONT_REGISTRY_INDEX;
1784
1785 ndrivers = XINT (Flength (list));
1786 drivers = alloca (sizeof (Lisp_Object) * ndrivers);
1787 for (i = 0; i < ndrivers; i++, list = XCDR (list))
1788 drivers[i] = XCAR (list);
1789 vec = Fvconcat (ndrivers, drivers);
1790 nfonts = ASIZE (vec);
1791
1792 qsort (XVECTOR (vec)->contents, nfonts, sizeof (Lisp_Object),
1793 compare_fonts_by_sort_order);
1788 1794
1789 result = Qnil; 1795 result = Qnil;
1790 for (i = nfonts - 1; i >= 0; --i) 1796 for (i = nfonts - 1; i >= 0; --i)