Special case rendering of some more box drawing characters using shades from the block of symbols for legacy computing

Fixes #7110
This commit is contained in:
Kovid Goyal
2024-02-10 10:13:46 +05:30
parent 4bcf69a47e
commit 576a269648
3 changed files with 24 additions and 7 deletions

View File

@@ -68,6 +68,8 @@ Detailed list of changes
- macOS: Fix an abort when changing OS window chrome for a full screen window via remote control or the themes kitten (:iss:`7106`)
- Special case rendering of some more box drawing characters using shades from the block of symbols for legacy computing (:iss:`7110`)
0.32.1 [2024-01-26]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -577,8 +577,7 @@ START_ALLOW_CASE_RANGE
case 0x2574 ... 0x259f:
case 0x2800 ... 0x28ff:
case 0xe0b0 ... 0xe0bf: // powerline box drawing
case 0x1fb00 ... 0x1fb97: // symbols for legacy computing
case 0x1fba0 ... 0x1fbae:
case 0x1fb00 ... 0x1fbae: // symbols for legacy computing
return BOX_FONT;
default:
*is_emoji_presentation = has_emoji_presentation(cpu_cell, gpu_cell);
@@ -615,12 +614,10 @@ START_ALLOW_CASE_RANGE
return ch - 0x2500; // IDs from 0x00 to 0x9f
case 0xe0b0 ... 0xe0d4:
return 0xa0 + ch - 0xe0b0; // IDs from 0xa0 to 0xc4
case 0x1fb00 ... 0x1fb97:
return 0xc5 + ch - 0x1fb00; // IDs from 0xc5 to 0x15c
case 0x1fba0 ... 0x1fbae:
return 0x15d + ch - 0x1fba0; // IDs from 0x15d to 0x16b
case 0x1fb00 ... 0x1fbae:
return 0xc5 + ch - 0x1fb00; // IDs from 0xc5 to 0x173
case 0x2800 ... 0x28ff:
return 0x16c + ch - 0x2800;
return 0x174 + ch - 0x2800;
default:
return 0xffff;
}

View File

@@ -663,6 +663,18 @@ def shade(
buf[off + c] = 255
def mask(
mask_func: Callable[[BufType, int, int], None], buf: BufType, width: int, height: int,
) -> None:
m = bytearray(width * height)
mask_func(m, width, height)
for y in range(height):
offset = y * width
for x in range(width):
p = offset + x
buf[p] = int(255.0 * (buf[p] / 255.0 * m[p] / 255.0))
def quad(buf: BufType, width: int, height: int, x: int = 0, y: int = 0) -> None:
num_cols = width // 2
left = x * num_cols
@@ -910,6 +922,10 @@ box_chars: Dict[str, List[Callable[[BufType, int, int], Any]]] = {
'🮕': [p(shade, xnum=4, ynum=4)],
'🮖': [p(shade, xnum=4, ynum=4, invert=True)],
'🮗': [p(shade, xnum=1, ynum=4, invert=True)],
'🮜': [shade, p(mask, p(corner_triangle, corner='top-left'))],
'🮝': [shade, p(mask, p(corner_triangle, corner='top-right'))],
'🮞': [shade, p(mask, p(corner_triangle, corner='bottom-right'))],
'🮟': [shade, p(mask, p(corner_triangle, corner='bottom-left'))],
'': [p(eight_bar, horizontal=True)],
'': [p(eight_bar, which=7)],
@@ -981,9 +997,11 @@ box_chars: Dict[str, List[Callable[[BufType, int, int], Any]]] = {
'🭪': [p(half_triangle, which='right', inverted=True)],
'🭫': [p(half_triangle, which='bottom', inverted=True)],
'🭬': [half_triangle],
'🮛': [half_triangle, p(half_triangle, which='right')],
'🭭': [p(half_triangle, which='top')],
'🭮': [p(half_triangle, which='right')],
'🭯': [p(half_triangle, which='bottom')],
'🮚': [p(half_triangle, which='bottom'), p(half_triangle, which='top')],
'🭼': [eight_bar, p(eight_bar, which=7, horizontal=True)],
'🭽': [eight_bar, p(eight_bar, horizontal=True)],