diff options
| author | Kenichi Handa | 2006-06-19 01:34:55 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2006-06-19 01:34:55 +0000 |
| commit | f63d54dc75e8e6a6fe57048e1968a139436507ea (patch) | |
| tree | fa603e04405496b7c2dfd87fb5c90b66c258a0e3 /src | |
| parent | 560fd3fae1b7017888c7f1673da90cd9a3b7ad38 (diff) | |
| download | emacs-f63d54dc75e8e6a6fe57048e1968a139436507ea.tar.gz emacs-f63d54dc75e8e6a6fe57048e1968a139436507ea.zip | |
(ftfont_pattern_entity): Use the numeric value 100 for
FC_WEIGHT_REGULAR. Exclude FC_SIZE and FC_PIXEL_SIZE from listing
pattern. Don't force scalable.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ftfont.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/src/ftfont.c b/src/ftfont.c index 0889ee147a8..b7f3ea0b236 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -122,7 +122,11 @@ ftfont_pattern_entity (p, frame, registry) | |||
| 122 | if (FcPatternGetString (p, FC_FAMILY, 0, (FcChar8 **) &str) == FcResultMatch) | 122 | if (FcPatternGetString (p, FC_FAMILY, 0, (FcChar8 **) &str) == FcResultMatch) |
| 123 | ASET (entity, FONT_FAMILY_INDEX, intern_downcase (str, strlen (str))); | 123 | ASET (entity, FONT_FAMILY_INDEX, intern_downcase (str, strlen (str))); |
| 124 | if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch) | 124 | if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch) |
| 125 | ASET (entity, FONT_WEIGHT_INDEX, make_number (numeric)); | 125 | { |
| 126 | if (numeric == FC_WEIGHT_REGULAR) | ||
| 127 | numeric = 100; | ||
| 128 | ASET (entity, FONT_WEIGHT_INDEX, make_number (numeric)); | ||
| 129 | } | ||
| 126 | if (FcPatternGetInteger (p, FC_SLANT, 0, &numeric) == FcResultMatch) | 130 | if (FcPatternGetInteger (p, FC_SLANT, 0, &numeric) == FcResultMatch) |
| 127 | ASET (entity, FONT_SLANT_INDEX, make_number (numeric + 100)); | 131 | ASET (entity, FONT_SLANT_INDEX, make_number (numeric + 100)); |
| 128 | if (FcPatternGetInteger (p, FC_WIDTH, 0, &numeric) == FcResultMatch) | 132 | if (FcPatternGetInteger (p, FC_WIDTH, 0, &numeric) == FcResultMatch) |
| @@ -384,7 +388,13 @@ ftfont_list (frame, spec) | |||
| 384 | } | 388 | } |
| 385 | 389 | ||
| 386 | if (STRINGP (font_name)) | 390 | if (STRINGP (font_name)) |
| 387 | pattern = FcNameParse (SDATA (font_name)); | 391 | { |
| 392 | pattern = FcNameParse (SDATA (font_name)); | ||
| 393 | /* Ignore these values in listing. */ | ||
| 394 | FcPatternDel (pattern, FC_PIXEL_SIZE); | ||
| 395 | FcPatternDel (pattern, FC_SIZE); | ||
| 396 | FcPatternDel (pattern, FC_FAMILY); | ||
| 397 | } | ||
| 388 | else | 398 | else |
| 389 | pattern = FcPatternCreate (); | 399 | pattern = FcPatternCreate (); |
| 390 | if (! pattern) | 400 | if (! pattern) |
| @@ -411,8 +421,10 @@ ftfont_list (frame, spec) | |||
| 411 | if (INTEGERP (tmp) | 421 | if (INTEGERP (tmp) |
| 412 | && ! FcPatternAddInteger (pattern, FC_WIDTH, XINT (tmp))) | 422 | && ! FcPatternAddInteger (pattern, FC_WIDTH, XINT (tmp))) |
| 413 | goto err; | 423 | goto err; |
| 424 | #if 0 | ||
| 414 | if (! FcPatternAddBool (pattern, FC_SCALABLE, FcTrue)) | 425 | if (! FcPatternAddBool (pattern, FC_SCALABLE, FcTrue)) |
| 415 | goto err; | 426 | goto err; |
| 427 | #endif | ||
| 416 | 428 | ||
| 417 | if (charset | 429 | if (charset |
| 418 | && ! FcPatternAddCharSet (pattern, FC_CHARSET, charset)) | 430 | && ! FcPatternAddCharSet (pattern, FC_CHARSET, charset)) |
| @@ -426,16 +438,34 @@ ftfont_list (frame, spec) | |||
| 426 | FC_CHARSET, FC_FILE, NULL); | 438 | FC_CHARSET, FC_FILE, NULL); |
| 427 | if (! objset) | 439 | if (! objset) |
| 428 | goto err; | 440 | goto err; |
| 441 | |||
| 429 | fontset = FcFontList (NULL, pattern, objset); | 442 | fontset = FcFontList (NULL, pattern, objset); |
| 430 | if (! fontset) | 443 | if (! fontset) |
| 431 | goto err; | 444 | goto err; |
| 432 | 445 | ||
| 433 | if (fontset->nfont > 0) | 446 | if (fontset->nfont > 0) |
| 434 | { | 447 | { |
| 448 | double pixel_size; | ||
| 449 | |||
| 450 | if (NILP (AREF (spec, FONT_SIZE_INDEX))) | ||
| 451 | pixel_size = 0; | ||
| 452 | else | ||
| 453 | pixel_size = XINT (AREF (spec, FONT_SIZE_INDEX)); | ||
| 454 | |||
| 435 | for (i = 0, val = Qnil; i < fontset->nfont; i++) | 455 | for (i = 0, val = Qnil; i < fontset->nfont; i++) |
| 436 | { | 456 | { |
| 437 | Lisp_Object entity = ftfont_pattern_entity (fontset->fonts[i], | 457 | Lisp_Object entity; |
| 438 | frame, registry); | 458 | |
| 459 | if (pixel_size > 0) | ||
| 460 | { | ||
| 461 | double this; | ||
| 462 | |||
| 463 | if (FcPatternGetDouble (fontset->fonts[i], FC_PIXEL_SIZE, 0, | ||
| 464 | &this) == FcResultMatch | ||
| 465 | && this != pixel_size) | ||
| 466 | continue; | ||
| 467 | } | ||
| 468 | entity = ftfont_pattern_entity (fontset->fonts[i], frame, registry); | ||
| 439 | if (! NILP (entity)) | 469 | if (! NILP (entity)) |
| 440 | val = Fcons (entity, val); | 470 | val = Fcons (entity, val); |
| 441 | } | 471 | } |