comparison src/objects-msw.c @ 4990:8f0cf4fd3d2c

Automatic merge
author Ben Wing <ben@xemacs.org>
date Sat, 06 Feb 2010 04:01:46 -0600
parents 3c3c1d139863
children 2eec7322eb7f d95c102a96d3
comparison
equal deleted inserted replaced
4989:d2ec55325515 4990:8f0cf4fd3d2c
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
1107 * 'on-the-fly' are not enumerated. It would be overly restrictive to 1107 * 'on-the-fly' are not enumerated. It would be overly restrictive to
1108 * disallow Bold And Italic weights for these fonts, so we just leave 1108 * disallow Bold And Italic weights for these fonts, so we just leave
1109 * weights unspecified. This means that we have to weed out duplicates of 1109 * weights unspecified. This means that we have to weed out duplicates of
1110 * those fonts that do get enumerated with different weights. 1110 * those fonts that do get enumerated with different weights.
1111 */ 1111 */
1112 TSTR_TO_C_STRING (lpelfe->elfLogFont.lfFaceName, facename); 1112 facename = TSTR_TO_ITEXT (lpelfe->elfLogFont.lfFaceName);
1113 if (itext_ichar (facename) == '@') 1113 if (itext_ichar (facename) == '@')
1114 /* This is a font for writing vertically. We ignore it. */ 1114 /* This is a font for writing vertically. We ignore it. */
1115 return 1; 1115 return 1;
1116 1116
1117 if (FontType == 0 /*vector*/ || FontType & TRUETYPE_FONTTYPE) 1117 if (FontType == 0 /*vector*/ || FontType & TRUETYPE_FONTTYPE)
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. */
1374 static void 1374 static void
1375 mswindows_finalize_color_instance (Lisp_Color_Instance *c) 1375 mswindows_finalize_color_instance (Lisp_Color_Instance *c)
1376 { 1376 {
1377 if (c->data) 1377 if (c->data)
1378 { 1378 {
1379 xfree (c->data, void *); 1379 xfree (c->data);
1380 c->data = 0; 1380 c->data = 0;
1381 } 1381 }
1382 } 1382 }
1383 1383
1384 static int 1384 static int
1487 1487
1488 if (fields > 0 && qxestrlen (fontname)) 1488 if (fields > 0 && qxestrlen (fontname))
1489 { 1489 {
1490 Extbyte *extfontname; 1490 Extbyte *extfontname;
1491 1491
1492 C_STRING_TO_TSTR (fontname, extfontname); 1492 extfontname = ITEXT_TO_TSTR (fontname);
1493 if (logfont) 1493 if (logfont)
1494 { 1494 {
1495 qxetcsncpy ((Extbyte *) logfont->lfFaceName, extfontname, 1495 qxetcsncpy ((Extbyte *) logfont->lfFaceName, extfontname,
1496 LF_FACESIZE - 1); 1496 LF_FACESIZE - 1);
1497 logfont->lfFaceName[LF_FACESIZE - 1] = 0; 1497 logfont->lfFaceName[LF_FACESIZE - 1] = 0;
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
1900 if (FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i) != NULL 1902 if (FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i) != NULL
1901 && FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i) != MSWINDOWS_BAD_HFONT) 1903 && FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i) != MSWINDOWS_BAD_HFONT)
1902 DeleteObject (FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i)); 1904 DeleteObject (FONT_INSTANCE_MSWINDOWS_HFONT_I (f, i));
1903 } 1905 }
1904 1906
1905 xfree (f->data, void *); 1907 xfree (f->data);
1906 f->data = 0; 1908 f->data = 0;
1907 } 1909 }
1908 } 1910 }
1909 1911
1910 #if 0 1912 #if 0
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