Mercurial > emacs
comparison src/w32font.c @ 110997:b8fde5ef9e14
Merge changes from emacs-23 branch.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Thu, 14 Oct 2010 16:32:27 +0200 |
parents | e0ac9a58795e 734b2470f93c |
children | 1e95f3ea022d |
comparison
equal
deleted
inserted
replaced
110996:e65b79c36e50 | 110997:b8fde5ef9e14 |
---|---|
331 return -1; | 331 return -1; |
332 #endif | 332 #endif |
333 } | 333 } |
334 | 334 |
335 /* w32 implementation of encode_char for font backend. | 335 /* w32 implementation of encode_char for font backend. |
336 Return a glyph code of FONT for characer C (Unicode code point). | 336 Return a glyph code of FONT for character C (Unicode code point). |
337 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. | 337 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. |
338 | 338 |
339 For speed, the gdi backend uses unicode (Emacs calls encode_char | 339 For speed, the gdi backend uses unicode (Emacs calls encode_char |
340 far too often for it to be efficient). But we still need to detect | 340 far too often for it to be efficient). But we still need to detect |
341 which characters are not supported by the font. | 341 which characters are not supported by the font. |
1796 if (fnweight >= FW_BOLD) return 200; | 1796 if (fnweight >= FW_BOLD) return 200; |
1797 if (fnweight >= FW_SEMIBOLD) return 180; | 1797 if (fnweight >= FW_SEMIBOLD) return 180; |
1798 if (fnweight >= FW_NORMAL) return 100; | 1798 if (fnweight >= FW_NORMAL) return 100; |
1799 if (fnweight >= FW_LIGHT) return 50; | 1799 if (fnweight >= FW_LIGHT) return 50; |
1800 if (fnweight >= FW_EXTRALIGHT) return 40; | 1800 if (fnweight >= FW_EXTRALIGHT) return 40; |
1801 if (fnweight > FW_THIN) return 20; | 1801 if (fnweight > FW_THIN) return 20; |
1802 return 0; | 1802 return 0; |
1803 } | 1803 } |
1804 | 1804 |
1805 static int | 1805 static int |
1806 w32_encode_weight (int n) | 1806 w32_encode_weight (int n) |
1810 if (n >= 200) return FW_BOLD; | 1810 if (n >= 200) return FW_BOLD; |
1811 if (n >= 180) return FW_SEMIBOLD; | 1811 if (n >= 180) return FW_SEMIBOLD; |
1812 if (n >= 100) return FW_NORMAL; | 1812 if (n >= 100) return FW_NORMAL; |
1813 if (n >= 50) return FW_LIGHT; | 1813 if (n >= 50) return FW_LIGHT; |
1814 if (n >= 40) return FW_EXTRALIGHT; | 1814 if (n >= 40) return FW_EXTRALIGHT; |
1815 if (n >= 20) return FW_THIN; | 1815 if (n >= 20) return FW_THIN; |
1816 return 0; | 1816 return 0; |
1817 } | 1817 } |
1818 | 1818 |
1819 /* Convert a Windows font weight into one of the weights supported | 1819 /* Convert a Windows font weight into one of the weights supported |
1820 by fontconfig (see font.c:font_parse_fcname). */ | 1820 by fontconfig (see font.c:font_parse_fcname). */ |
1821 static Lisp_Object | 1821 static Lisp_Object |
1822 w32_to_fc_weight (int n) | 1822 w32_to_fc_weight (int n) |
1823 { | 1823 { |
1824 if (n >= FW_EXTRABOLD) return intern ("black"); | 1824 if (n >= FW_EXTRABOLD) return intern ("black"); |
1825 if (n >= FW_BOLD) return intern ("bold"); | 1825 if (n >= FW_BOLD) return intern ("bold"); |
1826 if (n >= FW_SEMIBOLD) return intern ("demibold"); | 1826 if (n >= FW_SEMIBOLD) return intern ("demibold"); |
1827 if (n >= FW_NORMAL) return intern ("medium"); | 1827 if (n >= FW_NORMAL) return intern ("medium"); |
1828 return intern ("light"); | 1828 return intern ("light"); |
1829 } | 1829 } |
1830 | 1830 |
1831 /* Fill in all the available details of LOGFONT from FONT_SPEC. */ | 1831 /* Fill in all the available details of LOGFONT from FONT_SPEC. */ |
1832 static void | 1832 static void |
1909 /* Override generic family. */ | 1909 /* Override generic family. */ |
1910 BYTE family = w32_generic_family (tmp); | 1910 BYTE family = w32_generic_family (tmp); |
1911 if (family != FF_DONTCARE) | 1911 if (family != FF_DONTCARE) |
1912 logfont->lfPitchAndFamily = family | DEFAULT_PITCH; | 1912 logfont->lfPitchAndFamily = family | DEFAULT_PITCH; |
1913 } | 1913 } |
1914 | |
1915 | 1914 |
1916 /* Set pitch based on the spacing property. */ | 1915 /* Set pitch based on the spacing property. */ |
1917 tmp = AREF (font_spec, FONT_SPACING_INDEX); | 1916 tmp = AREF (font_spec, FONT_SPACING_INDEX); |
1918 if (INTEGERP (tmp)) | 1917 if (INTEGERP (tmp)) |
1919 { | 1918 { |
2376 return Qnil; | 2375 return Qnil; |
2377 | 2376 |
2378 return DECODE_SYSTEM (build_string (buf)); | 2377 return DECODE_SYSTEM (build_string (buf)); |
2379 } | 2378 } |
2380 | 2379 |
2380 static const char *w32font_booleans [] = { | |
2381 NULL, | |
2382 }; | |
2383 | |
2384 static const char *w32font_non_booleans [] = { | |
2385 ":script", | |
2386 ":antialias", | |
2387 ":style", | |
2388 NULL, | |
2389 }; | |
2390 | |
2391 static void | |
2392 w32font_filter_properties (Lisp_Object font, Lisp_Object alist) | |
2393 { | |
2394 font_filter_properties (font, alist, w32font_booleans, w32font_non_booleans); | |
2395 } | |
2396 | |
2381 struct font_driver w32font_driver = | 2397 struct font_driver w32font_driver = |
2382 { | 2398 { |
2383 0, /* Qgdi */ | 2399 0, /* Qgdi */ |
2384 0, /* case insensitive */ | 2400 0, /* case insensitive */ |
2385 w32font_get_cache, | 2401 w32font_get_cache, |
2405 NULL, /* start_for_frame */ | 2421 NULL, /* start_for_frame */ |
2406 NULL, /* end_for_frame */ | 2422 NULL, /* end_for_frame */ |
2407 NULL, /* shape */ | 2423 NULL, /* shape */ |
2408 NULL, /* check */ | 2424 NULL, /* check */ |
2409 NULL, /* get_variation_glyphs */ | 2425 NULL, /* get_variation_glyphs */ |
2410 NULL, /* filter_properties */ | 2426 w32font_filter_properties, |
2411 }; | 2427 }; |
2412 | 2428 |
2413 | 2429 |
2414 /* Initialize state that does not change between invocations. This is only | 2430 /* Initialize state that does not change between invocations. This is only |
2415 called when Emacs is dumped. */ | 2431 called when Emacs is dumped. */ |