Mercurial > emacs
diff src/w32font.c @ 109152:e27859da5624
src/w32*.c: Convert function definitions to standard C.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Tue, 06 Jul 2010 16:22:29 +0200 |
parents | 2bc9a0c04c87 |
children | f8660b83cdbf |
line wrap: on
line diff
--- a/src/w32font.c Tue Jul 06 15:33:34 2010 +0200 +++ b/src/w32font.c Tue Jul 06 16:22:29 2010 +0200 @@ -153,8 +153,7 @@ static int -memq_no_quit (elt, list) - Lisp_Object elt, list; +memq_no_quit (Lisp_Object elt, Lisp_Object list) { while (CONSP (list) && ! EQ (XCAR (list), elt)) list = XCDR (list); @@ -162,8 +161,7 @@ } Lisp_Object -intern_font_name (string) - char * string; +intern_font_name (char * string) { Lisp_Object obarray, tem, str; int len; @@ -185,8 +183,7 @@ Return a cache of font-entities on FRAME. The cache must be a cons whose cdr part is the actual cache area. */ Lisp_Object -w32font_get_cache (f) - FRAME_PTR f; +w32font_get_cache (FRAME_PTR f) { struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -198,8 +195,7 @@ is a vector of font-entities. This is the sole API that allocates font-entities. */ static Lisp_Object -w32font_list (frame, font_spec) - Lisp_Object frame, font_spec; +w32font_list (Lisp_Object frame, Lisp_Object font_spec) { Lisp_Object fonts = w32font_list_internal (frame, font_spec, 0); FONT_ADD_LOG ("w32font-list", font_spec, fonts); @@ -211,8 +207,7 @@ FRAME. The closeness is detemined by the font backend, thus `face-font-selection-order' is ignored here. */ static Lisp_Object -w32font_match (frame, font_spec) - Lisp_Object frame, font_spec; +w32font_match (Lisp_Object frame, Lisp_Object font_spec) { Lisp_Object entity = w32font_match_internal (frame, font_spec, 0); FONT_ADD_LOG ("w32font-match", font_spec, entity); @@ -223,8 +218,7 @@ List available families. The value is a list of family names (symbols). */ static Lisp_Object -w32font_list_family (frame) - Lisp_Object frame; +w32font_list_family (Lisp_Object frame) { Lisp_Object list = Qnil; LOGFONT font_match_pattern; @@ -248,10 +242,7 @@ Open a font specified by FONT_ENTITY on frame F. If the font is scalable, open it with PIXEL_SIZE. */ static Lisp_Object -w32font_open (f, font_entity, pixel_size) - FRAME_PTR f; - Lisp_Object font_entity; - int pixel_size; +w32font_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) { Lisp_Object font_object = font_make_object (VECSIZE (struct w32font_info), @@ -275,9 +266,7 @@ /* w32 implementation of close for font_backend. Close FONT on frame F. */ void -w32font_close (f, font) - FRAME_PTR f; - struct font *font; +w32font_close (FRAME_PTR f, struct font *font) { int i; struct w32font_info *w32_font = (struct w32font_info *) font; @@ -303,9 +292,7 @@ return 1. If not, return 0. If a font must be opened to check it, return -1. */ int -w32font_has_char (entity, c) - Lisp_Object entity; - int c; +w32font_has_char (Lisp_Object entity, int c) { /* We can't be certain about which characters a font will support until we open it. Checking the scripts that the font supports turns out @@ -354,9 +341,7 @@ which characters are not supported by the font. */ static unsigned -w32font_encode_char (font, c) - struct font *font; - int c; +w32font_encode_char (struct font *font, int c) { struct w32font_info * w32_font = (struct w32font_info *)font; @@ -373,11 +358,8 @@ CODE (length NGLYPHS). Apparently metrics can be NULL, in this case just return the overall width. */ int -w32font_text_extents (font, code, nglyphs, metrics) - struct font *font; - unsigned *code; - int nglyphs; - struct font_metrics *metrics; +w32font_text_extents (struct font *font, unsigned *code, + int nglyphs, struct font_metrics *metrics) { int i; HFONT old_font = NULL; @@ -552,9 +534,8 @@ */ int -w32font_draw (s, from, to, x, y, with_background) - struct glyph_string *s; - int from, to, x, y, with_background; +w32font_draw (struct glyph_string *s, int from, int to, + int x, int y, int with_background) { UINT options; HRGN orig_clip = NULL; @@ -715,9 +696,7 @@ Additional parameter opentype_only restricts the returned fonts to opentype fonts, which can be used with the Uniscribe backend. */ Lisp_Object -w32font_list_internal (frame, font_spec, opentype_only) - Lisp_Object frame, font_spec; - int opentype_only; +w32font_list_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only) { struct font_callback_data match_data; HDC dc; @@ -770,9 +749,7 @@ Additional parameter opentype_only restricts the returned fonts to opentype fonts, which can be used with the Uniscribe backend. */ Lisp_Object -w32font_match_internal (frame, font_spec, opentype_only) - Lisp_Object frame, font_spec; - int opentype_only; +w32font_match_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only) { struct font_callback_data match_data; HDC dc; @@ -800,11 +777,8 @@ } int -w32font_open_internal (f, font_entity, pixel_size, font_object) - FRAME_PTR f; - Lisp_Object font_entity; - int pixel_size; - Lisp_Object font_object; +w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, + int pixel_size, Lisp_Object font_object) { int len, size, i; LOGFONT logfont; @@ -951,11 +925,9 @@ /* Callback function for EnumFontFamiliesEx. * Adds the name of a font to a Lisp list (passed in as the lParam arg). */ static int CALLBACK -add_font_name_to_list (logical_font, physical_font, font_type, list_object) - ENUMLOGFONTEX *logical_font; - NEWTEXTMETRICEX *physical_font; - DWORD font_type; - LPARAM list_object; +add_font_name_to_list (ENUMLOGFONTEX *logical_font, + NEWTEXTMETRICEX *physical_font, + DWORD font_type, LPARAM list_object) { Lisp_Object* list = (Lisp_Object *) list_object; Lisp_Object family; @@ -976,14 +948,12 @@ /* Convert an enumerated Windows font to an Emacs font entity. */ static Lisp_Object -w32_enumfont_pattern_entity (frame, logical_font, physical_font, - font_type, requested_font, backend) - Lisp_Object frame; - ENUMLOGFONTEX *logical_font; - NEWTEXTMETRICEX *physical_font; - DWORD font_type; - LOGFONT *requested_font; - Lisp_Object backend; +w32_enumfont_pattern_entity (Lisp_Object frame, + ENUMLOGFONTEX *logical_font, + NEWTEXTMETRICEX *physical_font, + DWORD font_type, + LOGFONT *requested_font, + Lisp_Object backend) { Lisp_Object entity, tem; LOGFONT *lf = (LOGFONT*) logical_font; @@ -1107,8 +1077,7 @@ } static int -logfonts_match (font, pattern) - LOGFONT *font, *pattern; +logfonts_match (LOGFONT *font, LOGFONT *pattern) { /* Only check height for raster fonts. */ if (pattern->lfHeight && font->lfOutPrecision == OUT_STRING_PRECIS @@ -1132,12 +1101,9 @@ #define CSB_CHINESE ((1 << 18) | (1 << 20)) static int -font_matches_spec (type, font, spec, backend, logfont) - DWORD type; - NEWTEXTMETRICEX *font; - Lisp_Object spec; - Lisp_Object backend; - LOGFONT *logfont; +font_matches_spec (DWORD type, NEWTEXTMETRICEX *font, + Lisp_Object spec, Lisp_Object backend, + LOGFONT *logfont) { Lisp_Object extra, val; @@ -1322,9 +1288,7 @@ } static int -w32font_coverage_ok (coverage, charset) - FONTSIGNATURE * coverage; - BYTE charset; +w32font_coverage_ok (FONTSIGNATURE * coverage, BYTE charset) { DWORD subrange1 = coverage->fsUsb[1]; @@ -1350,9 +1314,7 @@ static int -check_face_name (font, full_name) - LOGFONT *font; - char *full_name; +check_face_name (LOGFONT *font, char *full_name) { char full_iname[LF_FULLFACESIZE+1]; @@ -1397,11 +1359,9 @@ * and the list to which the fonts are added are passed in via the * lparam argument, in the form of a font_callback_data struct. */ static int CALLBACK -add_font_entity_to_list (logical_font, physical_font, font_type, lParam) - ENUMLOGFONTEX *logical_font; - NEWTEXTMETRICEX *physical_font; - DWORD font_type; - LPARAM lParam; +add_font_entity_to_list (ENUMLOGFONTEX *logical_font, + NEWTEXTMETRICEX *physical_font, + DWORD font_type, LPARAM lParam) { struct font_callback_data *match_data = (struct font_callback_data *) lParam; @@ -1510,11 +1470,9 @@ /* Callback function for EnumFontFamiliesEx. * Terminates the search once we have a match. */ static int CALLBACK -add_one_font_entity_to_list (logical_font, physical_font, font_type, lParam) - ENUMLOGFONTEX *logical_font; - NEWTEXTMETRICEX *physical_font; - DWORD font_type; - LPARAM lParam; +add_one_font_entity_to_list (ENUMLOGFONTEX *logical_font, + NEWTEXTMETRICEX *physical_font, + DWORD font_type, LPARAM lParam) { struct font_callback_data *match_data = (struct font_callback_data *) lParam; @@ -1526,8 +1484,7 @@ /* Old function to convert from x to w32 charset, from w32fns.c. */ static LONG -x_to_w32_charset (lpcs) - char * lpcs; +x_to_w32_charset (char * lpcs) { Lisp_Object this_entry, w32_charset; char *charset; @@ -1609,8 +1566,7 @@ /* Convert a Lisp font registry (symbol) to a windows charset. */ static LONG -registry_to_w32_charset (charset) - Lisp_Object charset; +registry_to_w32_charset (Lisp_Object charset) { if (EQ (charset, Qiso10646_1) || EQ (charset, Qunicode_bmp) || EQ (charset, Qunicode_sip)) @@ -1625,9 +1581,7 @@ /* Old function to convert from w32 to x charset, from w32fns.c. */ static char * -w32_to_x_charset (fncharset, matching) - int fncharset; - char *matching; +w32_to_x_charset (int fncharset, char *matching) { static char buf[32]; Lisp_Object charset_type; @@ -1821,9 +1775,7 @@ } static Lisp_Object -w32_registry (w32_charset, font_type) - LONG w32_charset; - DWORD font_type; +w32_registry (LONG w32_charset, DWORD font_type) { char *charset; @@ -1837,8 +1789,7 @@ } static int -w32_decode_weight (fnweight) - int fnweight; +w32_decode_weight (int fnweight) { if (fnweight >= FW_HEAVY) return 210; if (fnweight >= FW_EXTRABOLD) return 205; @@ -1852,8 +1803,7 @@ } static int -w32_encode_weight (n) - int n; +w32_encode_weight (int n) { if (n >= 210) return FW_HEAVY; if (n >= 205) return FW_EXTRABOLD; @@ -1869,8 +1819,7 @@ /* Convert a Windows font weight into one of the weights supported by fontconfig (see font.c:font_parse_fcname). */ static Lisp_Object -w32_to_fc_weight (n) - int n; +w32_to_fc_weight (int n) { if (n >= FW_EXTRABOLD) return intern ("black"); if (n >= FW_BOLD) return intern ("bold"); @@ -1881,10 +1830,7 @@ /* Fill in all the available details of LOGFONT from FONT_SPEC. */ static void -fill_in_logfont (f, logfont, font_spec) - FRAME_PTR f; - LOGFONT *logfont; - Lisp_Object font_spec; +fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec) { Lisp_Object tmp, extra; int dpi = FRAME_W32_DISPLAY_INFO (f)->resy; @@ -2029,8 +1975,7 @@ } static void -list_all_matching_fonts (match_data) - struct font_callback_data *match_data; +list_all_matching_fonts (struct font_callback_data *match_data) { HDC dc; Lisp_Object families = w32font_list_family (match_data->frame); @@ -2066,8 +2011,7 @@ } static Lisp_Object -lispy_antialias_type (type) - BYTE type; +lispy_antialias_type (BYTE type) { Lisp_Object lispy; @@ -2094,8 +2038,7 @@ /* Convert antialiasing symbols to lfQuality */ static BYTE -w32_antialias_type (type) - Lisp_Object type; +w32_antialias_type (Lisp_Object type) { if (EQ (type, Qnone)) return NONANTIALIASED_QUALITY; @@ -2241,12 +2184,8 @@ The full name is in fcname format, with weight, slant and antialiasing specified if they are not "normal". */ static int -w32font_full_name (font, font_obj, pixel_size, name, nbytes) - LOGFONT * font; - Lisp_Object font_obj; - int pixel_size; - char *name; - int nbytes; +w32font_full_name (LOGFONT * font, Lisp_Object font_obj, + int pixel_size, char *name, int nbytes) { int len, height, outline; char *p; @@ -2317,11 +2256,8 @@ is written. If the buffer is not large enough to contain the name, the function returns -1, otherwise it returns the number of bytes written to FCNAME. */ -static int logfont_to_fcname(font, pointsize, fcname, size) - LOGFONT* font; - int pointsize; - char *fcname; - int size; +static int +logfont_to_fcname (LOGFONT* font, int pointsize, char *fcname, int size) { int len, height; char *p = fcname; @@ -2360,11 +2296,8 @@ } static void -compute_metrics (dc, w32_font, code, metrics) - HDC dc; - struct w32font_info *w32_font; - unsigned int code; - struct w32_metric_cache *metrics; +compute_metrics (HDC dc, struct w32font_info *w32_font, unsigned int code, + struct w32_metric_cache *metrics) { GLYPHMETRICS gm; MAT2 transform; @@ -2482,7 +2415,7 @@ /* Initialize state that does not change between invocations. This is only called when Emacs is dumped. */ void -syms_of_w32font () +syms_of_w32font (void) { DEFSYM (Qgdi, "gdi"); DEFSYM (Quniscribe, "uniscribe");