Skip to content

Commit

Permalink
Remove box drawing python code
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Dec 25, 2024
1 parent 1718d9a commit 6a9a7c2
Show file tree
Hide file tree
Showing 7 changed files with 766 additions and 1,603 deletions.
2 changes: 0 additions & 2 deletions kitty/boss.py
Original file line number Diff line number Diff line change
Expand Up @@ -2643,14 +2643,12 @@ def disable_ligatures_in(self, where: Union[str, Iterable[Window]], strategy: in
window.refresh()

def apply_new_options(self, opts: Options) -> None:
from .fonts.box_drawing import set_scale
# Update options storage
set_options(opts, is_wayland(), self.args.debug_rendering, self.args.debug_font_fallback)
apply_options_update()
set_layout_options(opts)
set_default_env(opts.env.copy())
# Update font data
set_scale(opts.box_drawing_scale)
from .fonts.render import set_font_family
set_font_family(opts)
for os_window_id, tm in self.os_window_map.items():
Expand Down
2 changes: 0 additions & 2 deletions kitty/fast_data_types.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import termios
from ctypes import Array, c_ubyte
from typing import Any, Callable, Dict, Iterator, List, Literal, NewType, Optional, Tuple, TypedDict, Union, overload

from kitty.boss import Boss
Expand Down Expand Up @@ -1131,7 +1130,6 @@ def set_send_sprite_to_gpu(


def set_font_data(
box_drawing_func: Callable[[int, int, int, float], Tuple[int, Union[bytearray, bytes, Array[c_ubyte]]]],
descriptor_for_idx: Callable[[int], Tuple[Union[FontObject|str], bool, bool]],
bold: int, italic: int, bold_italic: int, num_symbol_fonts: int,
symbol_maps: Tuple[Tuple[int, int, int], ...], font_sz_in_pts: float,
Expand Down
11 changes: 5 additions & 6 deletions kitty/fonts.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ START_ALLOW_CASE_RANGE
END_ALLOW_CASE_RANGE
}

static PyObject* box_drawing_function = NULL, *descriptor_for_idx = NULL;
static PyObject *descriptor_for_idx = NULL;

void
render_alpha_mask(const uint8_t *alpha_mask, pixel* dest, const Region *src_rect, const Region *dest_rect, size_t src_stride, size_t dest_stride, pixel color_rgb) {
Expand Down Expand Up @@ -1912,12 +1912,12 @@ set_symbol_maps(SymbolMap **maps, size_t *num, const PyObject *sm) {
static PyObject*
set_font_data(PyObject UNUSED *m, PyObject *args) {
PyObject *sm, *ns;
Py_CLEAR(box_drawing_function); Py_CLEAR(descriptor_for_idx);
if (!PyArg_ParseTuple(args, "OOIIIIO!dO!",
&box_drawing_function, &descriptor_for_idx,
Py_CLEAR(descriptor_for_idx);
if (!PyArg_ParseTuple(args, "OIIIIO!dO!",
&descriptor_for_idx,
&descriptor_indices.bold, &descriptor_indices.italic, &descriptor_indices.bi, &descriptor_indices.num_symbol_fonts,
&PyTuple_Type, &sm, &OPT(font_size), &PyTuple_Type, &ns)) return NULL;
Py_INCREF(box_drawing_function); Py_INCREF(descriptor_for_idx);
Py_INCREF(descriptor_for_idx);
free_font_groups();
clear_symbol_maps();
set_symbol_maps(&symbol_maps, &num_symbol_maps, sm);
Expand Down Expand Up @@ -2030,7 +2030,6 @@ static void
finalize(void) {
Py_CLEAR(python_send_to_gpu_impl);
clear_symbol_maps();
Py_CLEAR(box_drawing_function);
Py_CLEAR(descriptor_for_idx);
free_font_groups();
free(ligature_types);
Expand Down
Loading

0 comments on commit 6a9a7c2

Please sign in to comment.