diff options
| author | Kenichi Handa | 2008-09-01 02:46:23 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2008-09-01 02:46:23 +0000 |
| commit | 7c4bd58d241ab919f53f68def81eb2d43702e387 (patch) | |
| tree | 242152d31da9095ece83b537e64c13ba697ec638 /src | |
| parent | c3bb7671dee2ecc0de64b740c7e70535ff65c971 (diff) | |
| download | emacs-7c4bd58d241ab919f53f68def81eb2d43702e387.tar.gz emacs-7c4bd58d241ab919f53f68def81eb2d43702e387.zip | |
(ftfont_spec_pattern): Don't create a charset of the
representative chars of the script is a vector.
(ftfont_list): Handle the case the representative chars of the
script is a vector.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ftfont.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/src/ftfont.c b/src/ftfont.c index 0b4b733dbf9..a6637fe1287 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -673,7 +673,7 @@ ftfont_spec_pattern (spec, otlayout, otspec) | |||
| 673 | { | 673 | { |
| 674 | Lisp_Object chars = assq_no_quit (script, Vscript_representative_chars); | 674 | Lisp_Object chars = assq_no_quit (script, Vscript_representative_chars); |
| 675 | 675 | ||
| 676 | if (CONSP (chars)) | 676 | if (CONSP (chars) && CONSP (CDR (chars))) |
| 677 | { | 677 | { |
| 678 | charset = FcCharSetCreate (); | 678 | charset = FcCharSetCreate (); |
| 679 | if (! charset) | 679 | if (! charset) |
| @@ -744,6 +744,9 @@ ftfont_list (frame, spec) | |||
| 744 | FcPattern *pattern; | 744 | FcPattern *pattern; |
| 745 | FcFontSet *fontset = NULL; | 745 | FcFontSet *fontset = NULL; |
| 746 | FcObjectSet *objset = NULL; | 746 | FcObjectSet *objset = NULL; |
| 747 | FcCharSet *charset; | ||
| 748 | Lisp_Object chars = Qnil; | ||
| 749 | FcResult result; | ||
| 747 | char otlayout[15]; /* For "otlayout:XXXX" */ | 750 | char otlayout[15]; /* For "otlayout:XXXX" */ |
| 748 | struct OpenTypeSpec *otspec = NULL; | 751 | struct OpenTypeSpec *otspec = NULL; |
| 749 | int spacing = -1; | 752 | int spacing = -1; |
| @@ -757,6 +760,17 @@ ftfont_list (frame, spec) | |||
| 757 | pattern = ftfont_spec_pattern (spec, otlayout, &otspec); | 760 | pattern = ftfont_spec_pattern (spec, otlayout, &otspec); |
| 758 | if (! pattern) | 761 | if (! pattern) |
| 759 | return Qnil; | 762 | return Qnil; |
| 763 | if (FcPatternGetCharSet (pattern, FC_CHARSET, 0, &charset) != FcResultMatch) | ||
| 764 | { | ||
| 765 | val = assq_no_quit (QCscript, AREF (spec, FONT_EXTRA_INDEX)); | ||
| 766 | if (! NILP (val)) | ||
| 767 | { | ||
| 768 | val = assq_no_quit (XCDR (val), Vscript_representative_chars); | ||
| 769 | if (CONSP (val) && VECTORP (XCDR (val))) | ||
| 770 | chars = XCDR (val); | ||
| 771 | } | ||
| 772 | val = Qnil; | ||
| 773 | } | ||
| 760 | if (INTEGERP (AREF (spec, FONT_SPACING_INDEX))) | 774 | if (INTEGERP (AREF (spec, FONT_SPACING_INDEX))) |
| 761 | spacing = XINT (AREF (spec, FONT_SPACING_INDEX)); | 775 | spacing = XINT (AREF (spec, FONT_SPACING_INDEX)); |
| 762 | family = AREF (spec, FONT_FAMILY_INDEX); | 776 | family = AREF (spec, FONT_FAMILY_INDEX); |
| @@ -786,10 +800,12 @@ ftfont_list (frame, spec) | |||
| 786 | NULL); | 800 | NULL); |
| 787 | if (! objset) | 801 | if (! objset) |
| 788 | goto err; | 802 | goto err; |
| 803 | if (! NILP (chars)) | ||
| 804 | FcObjectSetAdd (objset, FC_CHARSET); | ||
| 789 | 805 | ||
| 790 | fontset = FcFontList (NULL, pattern, objset); | 806 | fontset = FcFontList (NULL, pattern, objset); |
| 791 | if (! fontset) | 807 | if (! fontset || fontset->nfont == 0) |
| 792 | goto err; | 808 | goto finish; |
| 793 | #if 0 | 809 | #if 0 |
| 794 | /* Need fix because this finds any fonts. */ | 810 | /* Need fix because this finds any fonts. */ |
| 795 | if (fontset->nfont == 0 && ! NILP (family)) | 811 | if (fontset->nfont == 0 && ! NILP (family)) |
| @@ -836,8 +852,8 @@ ftfont_list (frame, spec) | |||
| 836 | { | 852 | { |
| 837 | FcChar8 *this; | 853 | FcChar8 *this; |
| 838 | 854 | ||
| 839 | if (FcPatternGetString (fontset->fonts[i], FC_CAPABILITY, 0, | 855 | if (FcPatternGetString (fontset->fonts[i], FC_CAPABILITY, 0, &this) |
| 840 | &this) != FcResultMatch | 856 | != FcResultMatch |
| 841 | || ! strstr ((char *) this, otlayout)) | 857 | || ! strstr ((char *) this, otlayout)) |
| 842 | continue; | 858 | continue; |
| 843 | } | 859 | } |
| @@ -865,12 +881,26 @@ ftfont_list (frame, spec) | |||
| 865 | continue; | 881 | continue; |
| 866 | } | 882 | } |
| 867 | #endif /* HAVE_LIBOTF */ | 883 | #endif /* HAVE_LIBOTF */ |
| 884 | if (VECTORP (chars)) | ||
| 885 | { | ||
| 886 | int j; | ||
| 887 | |||
| 888 | if (FcPatternGetCharSet (fontset->fonts[i], FC_CHARSET, 0, &charset) | ||
| 889 | != FcResultMatch) | ||
| 890 | continue; | ||
| 891 | for (j = 0; j < ASIZE (chars); j++) | ||
| 892 | if (NATNUMP (AREF (chars, j)) | ||
| 893 | && FcCharSetHasChar (charset, XFASTINT (AREF (chars, j)))) | ||
| 894 | break; | ||
| 895 | if (j == ASIZE (chars)) | ||
| 896 | continue; | ||
| 897 | } | ||
| 868 | entity = ftfont_pattern_entity (fontset->fonts[i], | 898 | entity = ftfont_pattern_entity (fontset->fonts[i], |
| 869 | AREF (spec, FONT_EXTRA_INDEX)); | 899 | AREF (spec, FONT_EXTRA_INDEX)); |
| 870 | if (! NILP (entity)) | 900 | if (! NILP (entity)) |
| 871 | val = Fcons (entity, val); | 901 | val = Fcons (entity, val); |
| 872 | } | 902 | } |
| 873 | font_add_log ("ftfont-list", spec, val); | 903 | val = Fnreverse (val); |
| 874 | goto finish; | 904 | goto finish; |
| 875 | 905 | ||
| 876 | err: | 906 | err: |
| @@ -879,6 +909,7 @@ ftfont_list (frame, spec) | |||
| 879 | val = Qnil; | 909 | val = Qnil; |
| 880 | 910 | ||
| 881 | finish: | 911 | finish: |
| 912 | font_add_log ("ftfont-list", spec, val); | ||
| 882 | if (objset) FcObjectSetDestroy (objset); | 913 | if (objset) FcObjectSetDestroy (objset); |
| 883 | if (fontset) FcFontSetDestroy (fontset); | 914 | if (fontset) FcFontSetDestroy (fontset); |
| 884 | if (pattern) FcPatternDestroy (pattern); | 915 | if (pattern) FcPatternDestroy (pattern); |