Use box drawing for sextants
See the Symbols for Legacy Computing section in the Unicode standard https://www.unicode.org/charts/PDF/U1FB00.pdf
This commit is contained in:
parent
1d607bf13e
commit
a935c80adc
3 changed files with 44 additions and 1 deletions
|
|
@ -37,6 +37,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||
- Fix unfocused windows in which a bell occurs not changing their border color
|
||||
to red until a relayout
|
||||
|
||||
- Implement special rendering for various characters from the set of "Symbols
|
||||
for Legacy Computing" from the Unicode 13 standard
|
||||
|
||||
|
||||
0.18.3 [2020-08-11]
|
||||
-------------------
|
||||
|
|
|
|||
|
|
@ -600,6 +600,7 @@ START_ALLOW_CASE_RANGE
|
|||
case 0xe0ba: //
|
||||
case 0xe0bc: //
|
||||
case 0xe0be: //
|
||||
case 0x1fb00 ... 0x1fb3b: // sextants
|
||||
return BOX_FONT;
|
||||
default:
|
||||
ans = in_symbol_maps(fg, cpu_cell->ch);
|
||||
|
|
@ -637,8 +638,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 ... 0x1fb3b:
|
||||
return 0xc5 + ch - 0x1fb00;
|
||||
default:
|
||||
return 0xff;
|
||||
return 0xffff;
|
||||
}
|
||||
END_ALLOW_CASE_RANGE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -582,6 +582,35 @@ def quad(buf: BufType, width: int, height: int, x: int = 0, y: int = 0) -> None:
|
|||
buf[off + c] = 255
|
||||
|
||||
|
||||
def sextant(buf: BufType, width: int, height: int, level: int = 1, which: int = 0) -> None:
|
||||
|
||||
def draw_sextant(row: int = 0, col: int = 0) -> None:
|
||||
if row == 0:
|
||||
y_start, y_end = 0, height // 3
|
||||
elif row == 1:
|
||||
y_start, y_end = height // 3, 2 * height // 3
|
||||
else:
|
||||
y_start, y_end = 2 * height // 3, height
|
||||
if col == 0:
|
||||
x_start, x_end = 0, width // 2
|
||||
else:
|
||||
x_start, x_end = width // 2, width
|
||||
for r in range(y_start, y_end):
|
||||
off = r * width
|
||||
for c in range(x_start, x_end):
|
||||
buf[c + off] = 255
|
||||
|
||||
def add_row(q: int, r: int) -> None:
|
||||
if q & 1:
|
||||
draw_sextant(r)
|
||||
if q & 2:
|
||||
draw_sextant(r, col=1)
|
||||
|
||||
add_row(which % 4, 0)
|
||||
add_row(which // 4, 1)
|
||||
add_row(which // 16, 2)
|
||||
|
||||
|
||||
box_chars: Dict[str, List[Callable]] = {
|
||||
'─': [hline],
|
||||
'━': [p(hline, level=3)],
|
||||
|
|
@ -710,6 +739,14 @@ def quad(buf: BufType, width: int, height: int, x: int = 0, y: int = 0) -> None:
|
|||
box_chars[ch] = [p(cast(Callable, func_), which=ch)]
|
||||
|
||||
|
||||
c = 0x1fb00
|
||||
for i in range(1, 63):
|
||||
if i in (20, 40):
|
||||
continue
|
||||
box_chars[chr(c)] = [p(sextant, which=i)]
|
||||
c += 1
|
||||
|
||||
|
||||
def render_box_char(ch: str, buf: BufType, width: int, height: int, dpi: float = 96.0) -> BufType:
|
||||
global _dpi
|
||||
_dpi = dpi
|
||||
|
|
|
|||
Loading…
Reference in a new issue