comparison src/w32font.c @ 111036:db77dacc48e1

merge emacs-23
author Kenichi Handa <handa@m17n.org>
date Fri, 15 Oct 2010 09:43:23 +0900
parents 734b2470f93c
children b8fde5ef9e14 376148b31b5e
comparison
equal deleted inserted replaced
111035:31d92d74a71a 111036:db77dacc48e1
566 { 566 {
567 HRGN new_clip = CreateRectRgnIndirect (s->clip); 567 HRGN new_clip = CreateRectRgnIndirect (s->clip);
568 568
569 /* Save clip region for later restoration. */ 569 /* Save clip region for later restoration. */
570 orig_clip = CreateRectRgn (0, 0, 0, 0); 570 orig_clip = CreateRectRgn (0, 0, 0, 0);
571 if (!GetClipRgn(s->hdc, orig_clip)) 571 if (!GetClipRgn (s->hdc, orig_clip))
572 { 572 {
573 DeleteObject (orig_clip); 573 DeleteObject (orig_clip);
574 orig_clip = NULL; 574 orig_clip = NULL;
575 } 575 }
576 576
1831 font type. */ 1831 font type. */
1832 if (w32_charset == DEFAULT_CHARSET) 1832 if (w32_charset == DEFAULT_CHARSET)
1833 return font_type == TRUETYPE_FONTTYPE ? Qiso10646_1 : Qunknown; 1833 return font_type == TRUETYPE_FONTTYPE ? Qiso10646_1 : Qunknown;
1834 1834
1835 charset = w32_to_x_charset (w32_charset, NULL); 1835 charset = w32_to_x_charset (w32_charset, NULL);
1836 return font_intern_prop (charset, strlen(charset), 1); 1836 return font_intern_prop (charset, strlen (charset), 1);
1837 } 1837 }
1838 1838
1839 static int 1839 static int
1840 w32_decode_weight (fnweight) 1840 w32_decode_weight (fnweight)
1841 int fnweight; 1841 int fnweight;
1845 if (fnweight >= FW_BOLD) return 200; 1845 if (fnweight >= FW_BOLD) return 200;
1846 if (fnweight >= FW_SEMIBOLD) return 180; 1846 if (fnweight >= FW_SEMIBOLD) return 180;
1847 if (fnweight >= FW_NORMAL) return 100; 1847 if (fnweight >= FW_NORMAL) return 100;
1848 if (fnweight >= FW_LIGHT) return 50; 1848 if (fnweight >= FW_LIGHT) return 50;
1849 if (fnweight >= FW_EXTRALIGHT) return 40; 1849 if (fnweight >= FW_EXTRALIGHT) return 40;
1850 if (fnweight > FW_THIN) return 20; 1850 if (fnweight > FW_THIN) return 20;
1851 return 0; 1851 return 0;
1852 } 1852 }
1853 1853
1854 static int 1854 static int
1855 w32_encode_weight (n) 1855 w32_encode_weight (n)
1860 if (n >= 200) return FW_BOLD; 1860 if (n >= 200) return FW_BOLD;
1861 if (n >= 180) return FW_SEMIBOLD; 1861 if (n >= 180) return FW_SEMIBOLD;
1862 if (n >= 100) return FW_NORMAL; 1862 if (n >= 100) return FW_NORMAL;
1863 if (n >= 50) return FW_LIGHT; 1863 if (n >= 50) return FW_LIGHT;
1864 if (n >= 40) return FW_EXTRALIGHT; 1864 if (n >= 40) return FW_EXTRALIGHT;
1865 if (n >= 20) return FW_THIN; 1865 if (n >= 20) return FW_THIN;
1866 return 0; 1866 return 0;
1867 } 1867 }
1868 1868
1869 /* Convert a Windows font weight into one of the weights supported 1869 /* Convert a Windows font weight into one of the weights supported
1870 by fontconfig (see font.c:font_parse_fcname). */ 1870 by fontconfig (see font.c:font_parse_fcname). */
1871 static Lisp_Object 1871 static Lisp_Object
1872 w32_to_fc_weight (n) 1872 w32_to_fc_weight (n)
1873 int n; 1873 int n;
1874 { 1874 {
1875 if (n >= FW_EXTRABOLD) return intern ("black"); 1875 if (n >= FW_EXTRABOLD) return intern ("black");
1876 if (n >= FW_BOLD) return intern ("bold"); 1876 if (n >= FW_BOLD) return intern ("bold");
1877 if (n >= FW_SEMIBOLD) return intern ("demibold"); 1877 if (n >= FW_SEMIBOLD) return intern ("demibold");
1878 if (n >= FW_NORMAL) return intern ("medium"); 1878 if (n >= FW_NORMAL) return intern ("medium");
1879 return intern ("light"); 1879 return intern ("light");
1880 } 1880 }
1881 1881
1882 /* Fill in all the available details of LOGFONT from FONT_SPEC. */ 1882 /* Fill in all the available details of LOGFONT from FONT_SPEC. */
1883 static void 1883 static void
1963 /* Override generic family. */ 1963 /* Override generic family. */
1964 BYTE family = w32_generic_family (tmp); 1964 BYTE family = w32_generic_family (tmp);
1965 if (family != FF_DONTCARE) 1965 if (family != FF_DONTCARE)
1966 logfont->lfPitchAndFamily = family | DEFAULT_PITCH; 1966 logfont->lfPitchAndFamily = family | DEFAULT_PITCH;
1967 } 1967 }
1968
1969 1968
1970 /* Set pitch based on the spacing property. */ 1969 /* Set pitch based on the spacing property. */
1971 tmp = AREF (font_spec, FONT_SPACING_INDEX); 1970 tmp = AREF (font_spec, FONT_SPACING_INDEX);
1972 if (INTEGERP (tmp)) 1971 if (INTEGERP (tmp))
1973 { 1972 {
2315 POINTSIZE is in tenths of points. 2314 POINTSIZE is in tenths of points.
2316 If SIZE indicates the size of buffer FCNAME, into which the font name 2315 If SIZE indicates the size of buffer FCNAME, into which the font name
2317 is written. If the buffer is not large enough to contain the name, 2316 is written. If the buffer is not large enough to contain the name,
2318 the function returns -1, otherwise it returns the number of bytes 2317 the function returns -1, otherwise it returns the number of bytes
2319 written to FCNAME. */ 2318 written to FCNAME. */
2320 static int logfont_to_fcname(font, pointsize, fcname, size) 2319 static int
2320 logfont_to_fcname (font, pointsize, fcname, size)
2321 LOGFONT* font; 2321 LOGFONT* font;
2322 int pointsize; 2322 int pointsize;
2323 char *fcname; 2323 char *fcname;
2324 int size; 2324 int size;
2325 { 2325 {