Mercurial > emacs
comparison src/ftfont.c @ 95358:9c54d4f00cf6
(ftfont_spec_pattern): Don't set FC_SPACING to pattern.
(ftfont_list): Check spacing here. Don't include FC_CHARSET in
objset.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 28 May 2008 11:45:29 +0000 |
parents | 38cbd89dd626 |
children | 3ffecc48d809 |
comparison
equal
deleted
inserted
replaced
95357:d3025589e58e | 95358:9c54d4f00cf6 |
---|---|
466 FcPattern *pattern = NULL; | 466 FcPattern *pattern = NULL; |
467 FcCharSet *charset = NULL; | 467 FcCharSet *charset = NULL; |
468 FcLangSet *langset = NULL; | 468 FcLangSet *langset = NULL; |
469 int n; | 469 int n; |
470 int dpi = -1; | 470 int dpi = -1; |
471 int spacing = -1; | |
472 int scalable = -1; | 471 int scalable = -1; |
473 Lisp_Object name = Qnil; | 472 Lisp_Object name = Qnil; |
474 Lisp_Object script = Qnil; | 473 Lisp_Object script = Qnil; |
475 Lisp_Object registry; | 474 Lisp_Object registry; |
476 | 475 |
483 /* Fontconfig doesn't support reverse-italic/obligue. */ | 482 /* Fontconfig doesn't support reverse-italic/obligue. */ |
484 return NULL; | 483 return NULL; |
485 | 484 |
486 if (INTEGERP (AREF (spec, FONT_DPI_INDEX))) | 485 if (INTEGERP (AREF (spec, FONT_DPI_INDEX))) |
487 dpi = XINT (AREF (spec, FONT_DPI_INDEX)); | 486 dpi = XINT (AREF (spec, FONT_DPI_INDEX)); |
488 if (INTEGERP (AREF (spec, FONT_SPACING_INDEX))) | |
489 spacing = XINT (AREF (spec, FONT_SPACING_INDEX)); | |
490 if (INTEGERP (AREF (spec, FONT_AVGWIDTH_INDEX)) | 487 if (INTEGERP (AREF (spec, FONT_AVGWIDTH_INDEX)) |
491 && XINT (AREF (spec, FONT_AVGWIDTH_INDEX)) == 0) | 488 && XINT (AREF (spec, FONT_AVGWIDTH_INDEX)) == 0) |
492 scalable = 1; | 489 scalable = 1; |
493 | 490 |
494 registry = AREF (spec, FONT_REGISTRY_INDEX); | 491 registry = AREF (spec, FONT_REGISTRY_INDEX); |
587 && ! FcPatternAddLangSet (pattern, FC_LANG, langset)) | 584 && ! FcPatternAddLangSet (pattern, FC_LANG, langset)) |
588 goto err; | 585 goto err; |
589 if (dpi >= 0 | 586 if (dpi >= 0 |
590 && ! FcPatternAddDouble (pattern, FC_DPI, dpi)) | 587 && ! FcPatternAddDouble (pattern, FC_DPI, dpi)) |
591 goto err; | 588 goto err; |
592 if (spacing >= 0 | |
593 && ! FcPatternAddInteger (pattern, FC_SPACING, spacing)) | |
594 goto err; | |
595 if (scalable >= 0 | 589 if (scalable >= 0 |
596 && ! FcPatternAddBool (pattern, FC_SCALABLE, scalable ? FcTrue : FcFalse)) | 590 && ! FcPatternAddBool (pattern, FC_SCALABLE, scalable ? FcTrue : FcFalse)) |
597 goto err; | 591 goto err; |
598 goto finish; | 592 goto finish; |
599 | 593 |
631 FcFontSet *fontset = NULL; | 625 FcFontSet *fontset = NULL; |
632 FcObjectSet *objset = NULL; | 626 FcObjectSet *objset = NULL; |
633 int fc_charset_idx; | 627 int fc_charset_idx; |
634 char otlayout[15]; /* For "otlayout:XXXX" */ | 628 char otlayout[15]; /* For "otlayout:XXXX" */ |
635 struct OpenTypeSpec *otspec = NULL; | 629 struct OpenTypeSpec *otspec = NULL; |
630 int spacing = -1; | |
636 | 631 |
637 if (! fc_initialized) | 632 if (! fc_initialized) |
638 { | 633 { |
639 FcInit (); | 634 FcInit (); |
640 fc_initialized = 1; | 635 fc_initialized = 1; |
641 } | 636 } |
642 | 637 |
643 pattern = ftfont_spec_pattern (spec, &fc_charset_idx, otlayout, &otspec); | 638 pattern = ftfont_spec_pattern (spec, &fc_charset_idx, otlayout, &otspec); |
644 if (! pattern) | 639 if (! pattern) |
645 return Qnil; | 640 return Qnil; |
641 if (INTEGERP (AREF (spec, FONT_SPACING_INDEX))) | |
642 spacing = XINT (AREF (spec, FONT_SPACING_INDEX)); | |
646 registry = AREF (spec, FONT_REGISTRY_INDEX); | 643 registry = AREF (spec, FONT_REGISTRY_INDEX); |
647 family = AREF (spec, FONT_FAMILY_INDEX); | 644 family = AREF (spec, FONT_FAMILY_INDEX); |
648 if (! NILP (family)) | 645 if (! NILP (family)) |
649 { | 646 { |
650 Lisp_Object resolved; | 647 Lisp_Object resolved; |
659 } | 656 } |
660 } | 657 } |
661 | 658 |
662 objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, | 659 objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, |
663 FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, FC_SCALABLE, | 660 FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, FC_SCALABLE, |
664 FC_CHARSET, FC_FILE, | 661 FC_FILE, |
665 #ifdef FC_CAPABILITY | 662 #ifdef FC_CAPABILITY |
666 FC_CAPABILITY, | 663 FC_CAPABILITY, |
667 #endif /* FC_CAPABILITY */ | 664 #endif /* FC_CAPABILITY */ |
668 NULL); | 665 NULL); |
669 if (! objset) | 666 if (! objset) |
673 if (! fontset) | 670 if (! fontset) |
674 goto err; | 671 goto err; |
675 for (i = 0; i < fontset->nfont; i++) | 672 for (i = 0; i < fontset->nfont; i++) |
676 { | 673 { |
677 Lisp_Object entity; | 674 Lisp_Object entity; |
675 | |
676 if (spacing >= 0) | |
677 { | |
678 int this; | |
679 | |
680 if ((FcPatternGetInteger (fontset->fonts[i], FC_SPACING, 0, &this) | |
681 == FcResultMatch) | |
682 && spacing != this) | |
683 continue; | |
684 } | |
678 | 685 |
679 #ifdef FC_CAPABILITY | 686 #ifdef FC_CAPABILITY |
680 if (otlayout[0]) | 687 if (otlayout[0]) |
681 { | 688 { |
682 FcChar8 *this; | 689 FcChar8 *this; |