Dont use space ligatures for symbol_map fonts

space ligatures breaks in font ligatures when there is a trailing space.
So only use them for PUA and cells using a fallback font. Fixes #2019
This commit is contained in:
Kovid Goyal 2019-10-02 07:10:41 +05:30
parent 4369255a25
commit 53ab7617ca
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -544,8 +544,8 @@ in_symbol_maps(FontGroup *fg, char_type ch) {
static inline ssize_t
font_for_cell(FontGroup *fg, CPUCell *cpu_cell, GPUCell *gpu_cell, bool *is_secondary_font, bool *is_emoji_presentation) {
*is_secondary_font = false;
font_for_cell(FontGroup *fg, CPUCell *cpu_cell, GPUCell *gpu_cell, bool *is_fallback_font, bool *is_emoji_presentation) {
*is_fallback_font = false;
*is_emoji_presentation = false;
START_ALLOW_CASE_RANGE
ssize_t ans;
@ -563,7 +563,7 @@ START_ALLOW_CASE_RANGE
return BOX_FONT;
default:
ans = in_symbol_maps(fg, cpu_cell->ch);
if (ans > -1) { *is_secondary_font = true; return ans; }
if (ans > -1) return ans;
switch(BI_VAL(gpu_cell->attrs)) {
case 0:
ans = fg->medium_font_idx; break;
@ -577,7 +577,7 @@ START_ALLOW_CASE_RANGE
if (ans < 0) ans = fg->medium_font_idx;
*is_emoji_presentation = has_emoji_presentation(cpu_cell, gpu_cell);
if (!*is_emoji_presentation && has_cell_text(fg->fonts + ans, cpu_cell)) return ans;
*is_secondary_font = true;
*is_fallback_font = true;
return fallback_font(fg, cpu_cell, gpu_cell);
}
END_ALLOW_CASE_RANGE
@ -1100,12 +1100,12 @@ render_line(FONTS_DATA_HANDLE fg_, Line *line, index_type lnum, Cursor *cursor,
if (prev_width == 2) { prev_width = 0; continue; }
CPUCell *cpu_cell = line->cpu_cells + i;
GPUCell *gpu_cell = line->gpu_cells + i;
bool is_secondary_font, is_emoji_presentation;
ssize_t cell_font_idx = font_for_cell(fg, cpu_cell, gpu_cell, &is_secondary_font, &is_emoji_presentation);
bool is_fallback_font, is_emoji_presentation;
ssize_t cell_font_idx = font_for_cell(fg, cpu_cell, gpu_cell, &is_fallback_font, &is_emoji_presentation);
if (
cell_font_idx != MISSING_FONT &&
((is_secondary_font && !is_emoji_presentation && is_symbol(cpu_cell->ch)) || (cell_font_idx != BOX_FONT && is_private_use(cpu_cell->ch)))
((is_fallback_font && !is_emoji_presentation && is_symbol(cpu_cell->ch)) || (cell_font_idx != BOX_FONT && is_private_use(cpu_cell->ch)))
) {
unsigned int desired_cells = 1;
if (cell_font_idx > 0) {