parent
8ee1c851a1
commit
941c553172
5 changed files with 25 additions and 2 deletions
|
|
@ -198,7 +198,14 @@ def positive_float(x):
|
|||
return max(0, float(x))
|
||||
|
||||
|
||||
def adjust_line_height(x):
|
||||
if x.endswith('%'):
|
||||
return float(x[:-1]) / 100.0
|
||||
return int(x)
|
||||
|
||||
|
||||
type_map = {
|
||||
'adjust_line_height': adjust_line_height,
|
||||
'scrollback_lines': positive_int,
|
||||
'scrollback_pager': shlex.split,
|
||||
'scrollback_in_new_tab': to_bool,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
import sys
|
||||
|
||||
from kitty.fast_data_types import CTFace as Face, coretext_all_fonts
|
||||
from kitty.utils import ceil_int, get_logical_dpi, safe_print, wcwidth
|
||||
from kitty.utils import ceil_int, get_logical_dpi, safe_print, wcwidth, adjust_line_height
|
||||
|
||||
main_font = {}
|
||||
symbol_map = {}
|
||||
|
|
@ -93,6 +93,7 @@ def set_font_family(opts, override_font_size=None, ignore_dpi_failure=False):
|
|||
install_symbol_map(all_fonts, opts.symbol_map, font_size, dpi)
|
||||
mf = main_font[(False, False)]
|
||||
cell_width, cell_height = mf.cell_size()
|
||||
cell_height = adjust_line_height(cell_height, opts.adjust_line_height)
|
||||
CellTexture = ctypes.c_ubyte * (cell_width * cell_height)
|
||||
WideCellTexture = ctypes.c_ubyte * (2 * cell_width * cell_height)
|
||||
baseline = int(round(mf.ascent))
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
from kitty.fast_data_types import FT_PIXEL_MODE_GRAY, Face
|
||||
from kitty.fonts.box_drawing import render_missing_glyph
|
||||
from kitty.utils import ceil_int, get_logical_dpi, safe_print, wcwidth
|
||||
from kitty.utils import ceil_int, get_logical_dpi, safe_print, wcwidth, adjust_line_height
|
||||
|
||||
from .fontconfig import (
|
||||
FontNotFound, find_font_for_character, font_for_family, get_font_files
|
||||
|
|
@ -93,6 +93,7 @@ def set_font_family(opts, override_font_size=None):
|
|||
cell_height = font_units_to_pixels(
|
||||
face.height, face.units_per_EM, size_in_pts, dpi[1]
|
||||
)
|
||||
cell_height = adjust_line_height(cell_height, opts.adjust_line_height)
|
||||
baseline = font_units_to_pixels(
|
||||
face.ascender, face.units_per_EM, size_in_pts, dpi[1]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,14 @@ font_size 11.0
|
|||
# the font size in a running terminal.
|
||||
font_size_delta 2
|
||||
|
||||
|
||||
# Adjust the line height.
|
||||
# You can use either numbers, which are interpreted as pixels or percentages
|
||||
# (number followed by %), which are interpreted as percentages of the
|
||||
# unmodified line height. You can use negative pixels or percentages less than
|
||||
# 100% to reduce line height (but this might cause rendering artifacts).
|
||||
adjust_line_height 0
|
||||
|
||||
# The foreground color
|
||||
foreground #dddddd
|
||||
|
||||
|
|
|
|||
|
|
@ -226,3 +226,9 @@ def detach(fork=True, setsid=True, redirect=True):
|
|||
os.setsid()
|
||||
if redirect:
|
||||
redirect_std_streams(os.devnull)
|
||||
|
||||
|
||||
def adjust_line_height(cell_height, val):
|
||||
if isinstance(val, int):
|
||||
return cell_height + val
|
||||
return int(cell_height * val)
|
||||
|
|
|
|||
Loading…
Reference in a new issue