Iosevka: Fix incorrect rendering when there is a combining char that does not group with its neighbors
Fixes #5153
This commit is contained in:
parent
56f8a06362
commit
e12a9f3caf
@ -53,6 +53,9 @@ Detailed list of changes
|
||||
- Themes kitten: Add a tab to show user defined custom color themes separately
|
||||
(:pull:`5150`)
|
||||
|
||||
- Iosevka: Fix incorrect rendering when there is a combining char that does not
|
||||
group with its neighbors (:iss:`5153`)
|
||||
|
||||
|
||||
0.25.1 [2022-05-26]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -928,8 +928,14 @@ group_iosevka(Font *font, hb_font_t *hbf) {
|
||||
const LigatureType current = ligature_types[G(glyph_idx)];
|
||||
const LigatureType after = is_last_glyph ? LIGATURE_UNKNOWN : ligature_types[G(glyph_idx + 1)];
|
||||
bool end_current_group = false;
|
||||
if (current_group->num_glyphs && is_iosevka_lig_ender(before, current, after)) {
|
||||
end_current_group = true;
|
||||
if (current_group->num_glyphs) {
|
||||
if (is_iosevka_lig_ender(before, current, after)) end_current_group = true;
|
||||
else {
|
||||
if (!current_group->num_cells && !current_group->has_special_glyph) {
|
||||
if (is_iosevka_lig_starter(before, current, after)) current_group->has_special_glyph = true;
|
||||
else end_current_group = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!current_group->num_glyphs++) {
|
||||
if (is_iosevka_lig_starter(before, current, after)) current_group->has_special_glyph = true;
|
||||
@ -954,7 +960,7 @@ group_iosevka(Font *font, hb_font_t *hbf) {
|
||||
}
|
||||
current_group->num_cells += num_cells_consumed;
|
||||
}
|
||||
if (end_current_group) G(group_idx)++;
|
||||
if (end_current_group && current_group->num_cells) G(group_idx)++;
|
||||
G(glyph_idx)++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,6 +110,7 @@ class Rendering(BaseTest):
|
||||
self.ae(g('===--<>=='), [(3, 3), (2, 2), (2, 2), (2, 2)])
|
||||
self.ae(g('==!=<>==<><><>'), [(4, 4), (2, 2), (2, 2), (2, 2), (2, 2), (2, 2)])
|
||||
self.ae(g('-' * 18), [(18, 18)])
|
||||
self.ae(g('a>\u2060<b'), [(1, 1), (1, 2), (1, 1), (1, 1)])
|
||||
colon_glyph = ss('9:30', font='FiraCode-Medium.otf')[1][2]
|
||||
self.assertNotEqual(colon_glyph, ss(':', font='FiraCode-Medium.otf')[0][2])
|
||||
self.ae(colon_glyph, 1031)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user