comparison src/objects-msw.c @ 4959:bd169a24a554

merge
author Ben Wing <ben@xemacs.org>
date Thu, 28 Jan 2010 04:27:30 -0600
parents 304aebb79cd3
children 16112448d484 4aebb0131297
comparison
equal deleted inserted replaced
4893:99f2102552d7 4959:bd169a24a554
1014 COLORREF pcolor = PALETTERGB (GetRValue (color), GetGValue (color), 1014 COLORREF pcolor = PALETTERGB (GetRValue (color), GetGValue (color),
1015 GetBValue (color)); 1015 GetBValue (color));
1016 1016
1017 for (i = 0; i < countof (mswindows_X_color_map); i++) 1017 for (i = 0; i < countof (mswindows_X_color_map); i++)
1018 if (pcolor == (mswindows_X_color_map[i].colorref)) 1018 if (pcolor == (mswindows_X_color_map[i].colorref))
1019 return build_string (mswindows_X_color_map[i].name); 1019 return build_ascstring (mswindows_X_color_map[i].name);
1020 1020
1021 sprintf (buf, "#%02X%02X%02X", 1021 sprintf (buf, "#%02X%02X%02X",
1022 GetRValue (color), GetGValue (color), GetBValue (color)); 1022 GetRValue (color), GetGValue (color), GetBValue (color));
1023 return build_string (buf); 1023 return build_ascstring (buf);
1024 } 1024 }
1025 1025
1026 /* 1026 /*
1027 * Returns non-zero if the two supplied font patterns match. 1027 * Returns non-zero if the two supplied font patterns match.
1028 * If they match and fontname is not NULL, copies the logical OR of the 1028 * If they match and fontname is not NULL, copies the logical OR of the
1139 } 1139 }
1140 if (i == countof (charset_map)) 1140 if (i == countof (charset_map))
1141 return 1; 1141 return 1;
1142 1142
1143 /* Add the font name to the list if not already there */ 1143 /* Add the font name to the list if not already there */
1144 fontname_lispstr = build_intstring (fontname); 1144 fontname_lispstr = build_istring (fontname);
1145 if (NILP (Fassoc (fontname_lispstr, font_enum->list))) 1145 if (NILP (Fassoc (fontname_lispstr, font_enum->list)))
1146 font_enum->list = 1146 font_enum->list =
1147 Fcons (Fcons (fontname_lispstr, 1147 Fcons (Fcons (fontname_lispstr,
1148 /* TMPF_FIXED_PITCH is backwards from what you expect! 1148 /* TMPF_FIXED_PITCH is backwards from what you expect!
1149 If set, it means NOT fixed pitch. */ 1149 If set, it means NOT fixed pitch. */
1795 1795
1796 if (!parse_font_spec (truername, hdc, name_for_errors, 1796 if (!parse_font_spec (truername, hdc, name_for_errors,
1797 ERROR_ME_DEBUG_WARN, &logfont, fontname, weight, 1797 ERROR_ME_DEBUG_WARN, &logfont, fontname, weight,
1798 points, effects, charset)) 1798 points, effects, charset))
1799 signal_error (Qinternal_error, "Bad value in device font list?", 1799 signal_error (Qinternal_error, "Bad value in device font list?",
1800 build_intstring (truername)); 1800 build_istring (truername));
1801 } 1801 }
1802 else if (!parse_font_spec (namestr, hdc, name_for_errors, 1802 else if (!parse_font_spec (namestr, hdc, name_for_errors,
1803 errb, &logfont, fontname, weight, points, 1803 errb, &logfont, fontname, weight, points,
1804 effects, charset)) 1804 effects, charset))
1805 return 0; 1805 return 0;
1815 list of fonts. Doesn't really matter now, since we always have one. 1815 list of fonts. Doesn't really matter now, since we always have one.
1816 See above. */ 1816 See above. */
1817 qxesprintf (truename, "%s:%s:%s:%s:%s", fontname, weight, 1817 qxesprintf (truename, "%s:%s:%s:%s:%s", fontname, weight,
1818 points, effects, charset); 1818 points, effects, charset);
1819 1819
1820 *truename_ret = build_intstring (truename); 1820 *truename_ret = build_istring (truename);
1821 return hfont; 1821 return hfont;
1822 } 1822 }
1823 1823
1824 /* 1824 /*
1825 * This is a work horse for both mswindows_initialize_font_instance and 1825 * This is a work horse for both mswindows_initialize_font_instance and
1835 Ibyte *namestr = XSTRING_DATA (name); 1835 Ibyte *namestr = XSTRING_DATA (name);
1836 Lisp_Object truename; 1836 Lisp_Object truename;
1837 1837
1838 hfont = create_hfont_from_font_spec (namestr, hdc, name, device_font_list, 1838 hfont = create_hfont_from_font_spec (namestr, hdc, name, device_font_list,
1839 errb, &truename); 1839 errb, &truename);
1840 if (!hfont)
1841 return 0;
1840 f->truename = truename; 1842 f->truename = truename;
1841 f->data = xnew_and_zero (struct mswindows_font_instance_data); 1843 f->data = xnew_and_zero (struct mswindows_font_instance_data);
1842 FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, 0, 0) = hfont; 1844 FONT_INSTANCE_MSWINDOWS_HFONT_VARIANT (f, 0, 0) = hfont;
1843 1845
1844 /* Some underlined fonts have the descent of one pixel more than their 1846 /* Some underlined fonts have the descent of one pixel more than their
1944 Ibyte fontname[MSW_FONTSIZE]; 1946 Ibyte fontname[MSW_FONTSIZE];
1945 1947
1946 if (match_font (XSTRING_DATA (XCAR (XCAR (fonttail))), 1948 if (match_font (XSTRING_DATA (XCAR (XCAR (fonttail))),
1947 XSTRING_DATA (pattern), 1949 XSTRING_DATA (pattern),
1948 fontname)) 1950 fontname))
1949 result = Fcons (build_intstring (fontname), result); 1951 result = Fcons (build_istring (fontname), result);
1950 } 1952 }
1951 1953
1952 return Fnreverse (result); 1954 return Fnreverse (result);
1953 } 1955 }
1954 1956
2050 is contained inside of FONTSIGNATURE data, obtained by calling 2052 is contained inside of FONTSIGNATURE data, obtained by calling
2051 GetTextCharsetInfo on a font object, which we need to create from the 2053 GetTextCharsetInfo on a font object, which we need to create from the
2052 spec. See if the FONTSIGNATURE data is already cached. If not, get 2054 spec. See if the FONTSIGNATURE data is already cached. If not, get
2053 it and cache it. */ 2055 it and cache it. */
2054 if (!STRINGP (reloc) || the_nonreloc != XSTRING_DATA (reloc)) 2056 if (!STRINGP (reloc) || the_nonreloc != XSTRING_DATA (reloc))
2055 reloc = build_intstring (the_nonreloc); 2057 reloc = build_istring (the_nonreloc);
2056 GCPRO1 (reloc); 2058 GCPRO1 (reloc);
2057 fontsig = Fgethash (reloc, Vfont_signature_data, Qunbound); 2059 fontsig = Fgethash (reloc, Vfont_signature_data, Qunbound);
2058 2060
2059 if (!UNBOUNDP (fontsig)) 2061 if (!UNBOUNDP (fontsig))
2060 { 2062 {
2238 { 2240 {
2239 Lisp_Object result = Qnil; 2241 Lisp_Object result = Qnil;
2240 int i; 2242 int i;
2241 2243
2242 for (i = 0; i < countof (mswindows_X_color_map); i++) 2244 for (i = 0; i < countof (mswindows_X_color_map); i++)
2243 result = Fcons (build_string (mswindows_X_color_map[i].name), result); 2245 result = Fcons (build_ascstring (mswindows_X_color_map[i].name), result);
2244 2246
2245 return Fnreverse (result); 2247 return Fnreverse (result);
2246 } 2248 }
2247 2249
2248 2250