comparison src/w32fns.c @ 49812:15e797b18d7f

(w32_list_bdf_fonts, w32_list_fonts): Negative max_fonts parameter means list all.
author Jason Rumney <jasonr@gnu.org>
date Sun, 16 Feb 2003 22:23:06 +0000
parents 23a1cea22d13
children 479f0fd3607c
comparison
equal deleted inserted replaced
49811:3ba90bec9e2c 49812:15e797b18d7f
7338 7338
7339 if (w32_font_match (fontname, ptnstr)) 7339 if (w32_font_match (fontname, ptnstr))
7340 { 7340 {
7341 newlist = Fcons (XCAR (tem), newlist); 7341 newlist = Fcons (XCAR (tem), newlist);
7342 n_fonts++; 7342 n_fonts++;
7343 if (n_fonts >= max_names) 7343 if (max_names >= 0 && n_fonts >= max_names)
7344 break; 7344 break;
7345 } 7345 }
7346 } 7346 }
7347 7347
7348 return newlist; 7348 return newlist;
7352 /* Return a list of names of available fonts matching PATTERN on frame 7352 /* Return a list of names of available fonts matching PATTERN on frame
7353 F. If SIZE is not 0, it is the size (maximum bound width) of fonts 7353 F. If SIZE is not 0, it is the size (maximum bound width) of fonts
7354 to be listed. Frame F NULL means we have not yet created any 7354 to be listed. Frame F NULL means we have not yet created any
7355 frame, which means we can't get proper size info, as we don't have 7355 frame, which means we can't get proper size info, as we don't have
7356 a device context to use for GetTextMetrics. 7356 a device context to use for GetTextMetrics.
7357 MAXNAMES sets a limit on how many fonts to match. */ 7357 MAXNAMES sets a limit on how many fonts to match. If MAXNAMES is
7358 negative, then all matching fonts are returned. */
7358 7359
7359 Lisp_Object 7360 Lisp_Object
7360 w32_list_fonts (f, pattern, size, maxnames) 7361 w32_list_fonts (f, pattern, size, maxnames)
7361 struct frame *f; 7362 struct frame *f;
7362 Lisp_Object pattern; 7363 Lisp_Object pattern;
7465 continue; 7466 continue;
7466 if (!size) 7467 if (!size)
7467 { 7468 {
7468 newlist = Fcons (XCAR (tem), newlist); 7469 newlist = Fcons (XCAR (tem), newlist);
7469 n_fonts++; 7470 n_fonts++;
7470 if (n_fonts >= maxnames) 7471 if (maxnames >= 0 && n_fonts >= maxnames)
7471 break; 7472 break;
7472 else 7473 else
7473 continue; 7474 continue;
7474 } 7475 }
7475 if (!INTEGERP (XCDR (tem))) 7476 if (!INTEGERP (XCDR (tem)))
7504 found_size = XINT (XCDR (tem)); 7505 found_size = XINT (XCDR (tem));
7505 if (found_size == size) 7506 if (found_size == size)
7506 { 7507 {
7507 newlist = Fcons (XCAR (tem), newlist); 7508 newlist = Fcons (XCAR (tem), newlist);
7508 n_fonts++; 7509 n_fonts++;
7509 if (n_fonts >= maxnames) 7510 if (maxnames >= 0 && n_fonts >= maxnames)
7510 break; 7511 break;
7511 } 7512 }
7512 /* keep track of the closest matching size in case 7513 /* keep track of the closest matching size in case
7513 no exact match is found. */ 7514 no exact match is found. */
7514 else if (found_size > 0) 7515 else if (found_size > 0)
7540 break; 7541 break;
7541 } 7542 }
7542 } 7543 }
7543 7544
7544 /* Include any bdf fonts. */ 7545 /* Include any bdf fonts. */
7545 if (n_fonts < maxnames) 7546 if (n_fonts < maxnames || maxnames < 0)
7546 { 7547 {
7547 Lisp_Object combined[2]; 7548 Lisp_Object combined[2];
7548 combined[0] = w32_list_bdf_fonts (pattern, maxnames - n_fonts); 7549 combined[0] = w32_list_bdf_fonts (pattern, maxnames - n_fonts);
7549 combined[1] = newlist; 7550 combined[1] = newlist;
7550 newlist = Fnconc(2, combined); 7551 newlist = Fnconc(2, combined);