diff options
| author | Po Lu | 2024-06-11 16:59:15 +0800 |
|---|---|---|
| committer | Po Lu | 2024-06-11 17:00:00 +0800 |
| commit | cc30758eed9488aed4149adbf7a285622c3ec446 (patch) | |
| tree | 89eec6317de01aa81330e8f6226a1aa090c9bf54 /src | |
| parent | c0aa201adee05ba9ab7663435dd31bcba41aa443 (diff) | |
| download | emacs-cc30758eed9488aed4149adbf7a285622c3ec446.tar.gz emacs-cc30758eed9488aed4149adbf7a285622c3ec446.zip | |
Enable support for color fonts in recent releases of Xft
* etc/PROBLEMS (Some fonts are detected..): Document that Xft
2.3.6 should have resolved this issue.
* src/ftfont.c (ftfont_spec_pattern, ftfont_list): Disable
inhibition of color fonts on Xft 2.3.6 and subsequent versions.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ftfont.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/ftfont.c b/src/ftfont.c index 214d7532d6f..c89feea1d46 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -658,6 +658,11 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec) | |||
| 658 | } | 658 | } |
| 659 | 659 | ||
| 660 | #if defined HAVE_XFT && defined FC_COLOR | 660 | #if defined HAVE_XFT && defined FC_COLOR |
| 661 | #if (XFT_MAJOR < 2 \ | ||
| 662 | || (XFT_MAJOR == 2 && (XFT_MINOR < 3 \ | ||
| 663 | || (XFT_MINOR == 3 \ | ||
| 664 | && XFT_REVISION < 6)))) | ||
| 665 | |||
| 661 | static bool | 666 | static bool |
| 662 | xft_color_font_whitelisted_p (const char *family) | 667 | xft_color_font_whitelisted_p (const char *family) |
| 663 | { | 668 | { |
| @@ -675,7 +680,9 @@ xft_color_font_whitelisted_p (const char *family) | |||
| 675 | 680 | ||
| 676 | return false; | 681 | return false; |
| 677 | } | 682 | } |
| 678 | #endif | 683 | |
| 684 | #endif /* Xft < 2.3.6 */ | ||
| 685 | #endif /* HAVE_XFT && FC_COLOR */ | ||
| 679 | 686 | ||
| 680 | static FcPattern * | 687 | static FcPattern * |
| 681 | ftfont_spec_pattern (Lisp_Object spec, char *otlayout, | 688 | ftfont_spec_pattern (Lisp_Object spec, char *otlayout, |
| @@ -815,14 +822,19 @@ ftfont_spec_pattern (Lisp_Object spec, char *otlayout, | |||
| 815 | && ! FcPatternAddBool (pattern, FC_SCALABLE, scalable ? FcTrue : FcFalse)) | 822 | && ! FcPatternAddBool (pattern, FC_SCALABLE, scalable ? FcTrue : FcFalse)) |
| 816 | goto err; | 823 | goto err; |
| 817 | #if defined HAVE_XFT && defined FC_COLOR | 824 | #if defined HAVE_XFT && defined FC_COLOR |
| 818 | /* We really don't like color fonts, they cause Xft crashes. See | 825 | #if (XFT_MAJOR < 2 \ |
| 819 | Bug#30874. */ | 826 | || (XFT_MAJOR == 2 && (XFT_MINOR < 3 \ |
| 827 | || (XFT_MINOR == 3 \ | ||
| 828 | && XFT_REVISION < 6)))) | ||
| 829 | /* We really don't like color fonts, they cause Xft crashes with | ||
| 830 | releases older than 2.3.6. See Bug#30874. */ | ||
| 820 | if (xft_ignore_color_fonts | 831 | if (xft_ignore_color_fonts |
| 821 | && (NILP (AREF (spec, FONT_FAMILY_INDEX)) | 832 | && (NILP (AREF (spec, FONT_FAMILY_INDEX)) |
| 822 | || NILP (Vxft_color_font_whitelist)) | 833 | || NILP (Vxft_color_font_whitelist)) |
| 823 | && ! FcPatternAddBool (pattern, FC_COLOR, FcFalse)) | 834 | && ! FcPatternAddBool (pattern, FC_COLOR, FcFalse)) |
| 824 | goto err; | 835 | goto err; |
| 825 | #endif | 836 | #endif /* Xft < 2.3.6 */ |
| 837 | #endif /* HAVE_XFT && FC_COLOR */ | ||
| 826 | 838 | ||
| 827 | goto finish; | 839 | goto finish; |
| 828 | 840 | ||
| @@ -959,6 +971,10 @@ ftfont_list (struct frame *f, Lisp_Object spec) | |||
| 959 | { | 971 | { |
| 960 | Lisp_Object entity; | 972 | Lisp_Object entity; |
| 961 | #if defined HAVE_XFT && defined FC_COLOR | 973 | #if defined HAVE_XFT && defined FC_COLOR |
| 974 | #if (XFT_MAJOR < 2 \ | ||
| 975 | || (XFT_MAJOR == 2 && (XFT_MINOR < 3 \ | ||
| 976 | || (XFT_MINOR == 3 \ | ||
| 977 | && XFT_REVISION < 6)))) | ||
| 962 | { | 978 | { |
| 963 | /* Some fonts, notably NotoColorEmoji, have an FC_COLOR value | 979 | /* Some fonts, notably NotoColorEmoji, have an FC_COLOR value |
| 964 | that's neither FcTrue nor FcFalse, which means FcFontList | 980 | that's neither FcTrue nor FcFalse, which means FcFontList |
| @@ -975,7 +991,8 @@ ftfont_list (struct frame *f, Lisp_Object spec) | |||
| 975 | == FcResultMatch && b != FcFalse) | 991 | == FcResultMatch && b != FcFalse) |
| 976 | continue; | 992 | continue; |
| 977 | } | 993 | } |
| 978 | #endif | 994 | #endif /* Xft < 2.3.6 */ |
| 995 | #endif /* HAVE_XFT && FC_COLOR */ | ||
| 979 | if (spacing >= 0) | 996 | if (spacing >= 0) |
| 980 | { | 997 | { |
| 981 | int this; | 998 | int this; |