mini_arcade_pygame_backend.ports.text ===================================== .. py:module:: mini_arcade_pygame_backend.ports.text .. autoapi-nested-parse:: Text port implementation for the native backend. Provides functionality to draw and measure text. Classes ------- .. autoapisummary:: mini_arcade_pygame_backend.ports.text.TextPort Module Contents --------------- .. py:class:: TextPort(window: mini_arcade_pygame_backend.ports.window.WindowPort, vp: mini_arcade_core.backend.viewport.ViewportTransform, font_path: str | None = None) Text port for the Mini Arcade native backend. :param native_backend: The native backend instance. :type native_backend: native.Backend :param vp: The viewport transform. :type vp: ViewportTransform :param font_path: The path to the font file to use for text rendering. :type font_path: str | None .. py:method:: measure(text: str, font_size: int | None = None) -> tuple[int, int] Measure the width and height of the given text. :param text: The text to measure. :type text: str :param font_size: The font size to use for measurement. :type font_size: int | None :return: A tuple containing the width and height of the text. :rtype: tuple[int, int] .. py:method:: draw(x: int, y: int, text: str, color=(255, 255, 255), font_size: int | None = None) Draw the given text at the specified position. :param x: The x-coordinate to draw the text. :type x: int :param y: The y-coordinate to draw the text. :type y: int :param text: The text to draw. :type text: str :param color: The color of the text as an (R, G, B) or (R, G, B, A) tuple. :type color: tuple[int, int, int] | tuple[int, int, int, int] :param font_size: The font size to use for drawing. :type font_size: int | None