Only consider emoji characters with emoji presentation to have width two

Fixes #308
This commit is contained in:
Kovid Goyal
2018-02-04 22:27:34 +05:30
parent b667e3a577
commit b9857f9499
6 changed files with 302 additions and 204 deletions

View File

@@ -193,7 +193,7 @@ create_fallback_face(PyObject UNUSED *base_face, Cell* cell, bool bold, bool ita
PyObject *ans = NULL;
FcPattern *pat = FcPatternCreate();
if (pat == NULL) return PyErr_NoMemory();
bool emoji = is_emoji(cell->ch);
bool emoji = (cell->attrs & WIDTH_MASK) == 2 && is_emoji(cell->ch);
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"); }