import sys import os import datetime from PIL import Image, ImageDraw, ImageFont # Add workspace to path to import notetaker functions sys.path.append("/Users/adolforeyna/Projects/MicroPython/test1/Screen") import notetaker def test_rendering(): output_dir = "/Users/adolforeyna/.gemini/antigravity/brain/95f1ff45-7d9b-4493-ad2c-fdf647d73805" text = "Adolfo Reyna Hey\nThis is a bigger font for my son!\nIt supports handwriting and typewriter styles." cursor_pos = len(text) scroll_top = 0 # Font folder font_folder = "/Users/adolforeyna/Projects/MicroPython/test1/Screen/fonts" # Test cases: (font_path, font_size, font_name, output_filename) test_cases = [ (os.path.join(font_folder, "PatrickHand.ttf"), 22, "Handwritten", "render_kids_handwritten.png"), (os.path.join(font_folder, "CourierPrime.ttf"), 20, "Typewriter", "render_kids_typewriter.png") ] for font_path, font_size, font_name, filename in test_cases: font, char_h = notetaker.load_font(font_path, font_size) line_spacing = char_h + 8 max_lines = (notetaker.BOTTOM_LIMIT - notetaker.TOP_LIMIT) // line_spacing img, scroll_top = notetaker.render_screen( text, cursor_pos, scroll_top, font, char_h, line_spacing, max_lines, dark_mode=False, show_cursor=True, status_msg=f"Font: {font_name}" ) dest_path = os.path.join(output_dir, filename) img.save(dest_path) print(f"Saved {font_name} layout test to {dest_path}") print(f" char_h: {char_h}px, line_spacing: {line_spacing}px, max_lines: {max_lines}") if __name__ == "__main__": test_rendering()