test render function to develop the sample renderer

This commit is contained in:
Kovid Goyal
2024-05-27 13:46:48 +05:30
parent 72257f652d
commit 9782833308

View File

@@ -218,7 +218,7 @@ def query_kitty() -> Dict[str, str]:
return ans
def showcase(family: str) -> None:
def showcase(family: str = 'family="Fira Code"') -> None:
q = query_kitty()
opts = Options()
opts.foreground = to_color(q['foreground'])
@@ -232,3 +232,13 @@ def showcase(family: str) -> None:
height = 5 * ss.cell_height
bitmap = render_face_sample(desc, opts, float(q['dpi_x']), float(q['dpi_y']), width, height)[0]
display_bitmap(bitmap, width, height)
def test_render(spec: str = 'family="Fira Code"', width: int = 1560, height: int = 116, font_size: float = 12, dpi: float = 288) -> None:
opts = Options()
opts.font_family = parse_font_spec(spec)
opts.font_size = font_size
opts.foreground = to_color('white')
desc = get_font_files(opts)['medium']
bitmap = render_face_sample(desc, opts, float(dpi), float(dpi), width, height)[0]
display_bitmap(bitmap, width, height)