From e4b839742c196b840fe9f69a0762446032285921 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Dec 2017 10:57:00 +0530 Subject: [PATCH] Add option to control using color emoji or not --- kitty/config.py | 1 + kitty/fontconfig.c | 2 +- kitty/kitty.conf | 6 ++++++ kitty/state.c | 1 + kitty/state.h | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/kitty/config.py b/kitty/config.py index 32b5315bf..ad40fd1db 100644 --- a/kitty/config.py +++ b/kitty/config.py @@ -291,6 +291,7 @@ type_map = { 'active_tab_font_style': tab_font_style, 'inactive_tab_font_style': tab_font_style, 'url_style': url_style, + 'prefer_color_emoji': to_bool, } for name in ( diff --git a/kitty/fontconfig.c b/kitty/fontconfig.c index ff330e521..e12362028 100644 --- a/kitty/fontconfig.c +++ b/kitty/fontconfig.c @@ -195,7 +195,7 @@ create_fallback_face(PyObject UNUSED *base_face, Cell* cell, bool bold, bool ita AP(FcPatternAddString, FC_FAMILY, (const FcChar8*)(emoji ? "emoji" : "monospace"), "family"); if (!emoji && bold) { AP(FcPatternAddInteger, FC_WEIGHT, FC_WEIGHT_BOLD, "weight"); } if (!emoji && italic) { AP(FcPatternAddInteger, FC_SLANT, FC_SLANT_ITALIC, "slant"); } - if (emoji) { AP(FcPatternAddBool, FC_COLOR, true, "color"); } + if (emoji) { AP(FcPatternAddBool, FC_COLOR, OPT(prefer_color_emoji), "color"); } size_t num = cell_as_unicode(cell, true, char_buf, ' '); add_charset(pat, num); PyObject *d = _fc_match(pat); diff --git a/kitty/kitty.conf b/kitty/kitty.conf index 84ed58dea..51ce436d2 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -356,3 +356,9 @@ macos_option_as_alt yes # The number is a percentage of maximum volume. # See man XBell for details. x11_bell_volume 80 + +# Prefer color emoji fonts when available. Note that this only works +# on systems such as Linux that use fontconfig. On other OSes, the emoji +# font used is system dependent. It can be overriden using symbol_map in the kitty +# configuration. +prefer_color_emoji yes diff --git a/kitty/state.c b/kitty/state.c index cfb85020c..b024c3e98 100644 --- a/kitty/state.c +++ b/kitty/state.c @@ -305,6 +305,7 @@ PYWRAP1(set_options) { #define S(name, convert) { GA(name); global_state.opts.name = convert(ret); Py_DECREF(ret); if (PyErr_Occurred()) return NULL; } S(visual_bell_duration, PyFloat_AsDouble); S(enable_audio_bell, PyObject_IsTrue); + S(prefer_color_emoji, PyObject_IsTrue); S(focus_follows_mouse, PyObject_IsTrue); S(cursor_blink_interval, PyFloat_AsDouble); S(cursor_stop_blinking_after, PyFloat_AsDouble); diff --git a/kitty/state.h b/kitty/state.h index 7a757b939..175971f02 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -21,6 +21,7 @@ typedef struct { double repaint_delay, input_delay; bool focus_follows_mouse; bool macos_option_as_alt, macos_hide_titlebar; + bool prefer_color_emoji; int adjust_line_height_px; int x11_bell_volume; float adjust_line_height_frac;