Add a config option to control the line thickness for box drawing characters
Fixes #183
This commit is contained in:
parent
4b0ff03868
commit
65b212fa1b
@ -220,6 +220,13 @@ def adjust_line_height(x):
|
|||||||
return int(x)
|
return int(x)
|
||||||
|
|
||||||
|
|
||||||
|
def box_drawing_scale(x):
|
||||||
|
ans = tuple(float(x.strip()) for x in x.split(','))
|
||||||
|
if len(ans) != 4:
|
||||||
|
raise ValueError('Invalid box_drawing scale, must have four entries')
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
type_map = {
|
type_map = {
|
||||||
'adjust_line_height': adjust_line_height,
|
'adjust_line_height': adjust_line_height,
|
||||||
'scrollback_lines': positive_int,
|
'scrollback_lines': positive_int,
|
||||||
@ -249,6 +256,7 @@ type_map = {
|
|||||||
'use_system_wcwidth': to_bool,
|
'use_system_wcwidth': to_bool,
|
||||||
'macos_hide_titlebar': to_bool,
|
'macos_hide_titlebar': to_bool,
|
||||||
'macos_option_as_alt': to_bool,
|
'macos_option_as_alt': to_bool,
|
||||||
|
'box_drawing_scale': box_drawing_scale,
|
||||||
}
|
}
|
||||||
|
|
||||||
for name in (
|
for name in (
|
||||||
|
|||||||
@ -9,9 +9,17 @@ from itertools import repeat
|
|||||||
from kitty.utils import get_logical_dpi
|
from kitty.utils import get_logical_dpi
|
||||||
|
|
||||||
|
|
||||||
|
scale = (0.001, 1, 1.5, 2)
|
||||||
|
|
||||||
|
|
||||||
|
def set_scale(new_scale):
|
||||||
|
global scale
|
||||||
|
scale = tuple(new_scale)
|
||||||
|
|
||||||
|
|
||||||
def thickness(level=1, horizontal=True):
|
def thickness(level=1, horizontal=True):
|
||||||
dpi = get_logical_dpi()[0 if horizontal else 1]
|
dpi = get_logical_dpi()[0 if horizontal else 1]
|
||||||
pts = (0.001, 1, 1.5, 2)[level]
|
pts = scale[level]
|
||||||
return int(math.ceil(pts * dpi / 72.0))
|
return int(math.ceil(pts * dpi / 72.0))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,12 @@ font_size_delta 2
|
|||||||
# 100% to reduce line height (but this might cause rendering artifacts).
|
# 100% to reduce line height (but this might cause rendering artifacts).
|
||||||
adjust_line_height 0
|
adjust_line_height 0
|
||||||
|
|
||||||
|
# Change the sizes of the lines used for the box drawing unicode characters
|
||||||
|
# These values are in pts. They will be scaled by the monitor DPI to arrive at
|
||||||
|
# a pixel value. There must be four values corresponding to thin, normal, thick,
|
||||||
|
# and very thick lines;
|
||||||
|
box_drawing_scale 0.001, 1, 1.5, 2
|
||||||
|
|
||||||
# The foreground color
|
# The foreground color
|
||||||
foreground #dddddd
|
foreground #dddddd
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ from .fast_data_types import (
|
|||||||
glfw_init, glfw_init_hint_string, glfw_swap_interval, glfw_terminate,
|
glfw_init, glfw_init_hint_string, glfw_swap_interval, glfw_terminate,
|
||||||
glfw_window_hint, install_sigchld_handler, set_logical_dpi, set_options
|
glfw_window_hint, install_sigchld_handler, set_logical_dpi, set_options
|
||||||
)
|
)
|
||||||
|
from .fonts.box_drawing import set_scale
|
||||||
from .layout import all_layouts
|
from .layout import all_layouts
|
||||||
from .utils import (
|
from .utils import (
|
||||||
color_as_int, detach, end_startup_notification, get_logical_dpi,
|
color_as_int, detach, end_startup_notification, get_logical_dpi,
|
||||||
@ -170,6 +171,7 @@ def initialize_window(window, opts, debug_gl=False):
|
|||||||
def run_app(opts, args):
|
def run_app(opts, args):
|
||||||
set_options(opts)
|
set_options(opts)
|
||||||
setup_opengl(opts)
|
setup_opengl(opts)
|
||||||
|
set_scale(opts.box_drawing_scale)
|
||||||
load_cached_values()
|
load_cached_values()
|
||||||
if 'window-size' in cached_values and opts.remember_window_size:
|
if 'window-size' in cached_values and opts.remember_window_size:
|
||||||
ws = cached_values['window-size']
|
ws = cached_values['window-size']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user