simvx.graphics.text_utils

Text utility helpers extracted from Engine — font finding and text rasterization.

Module Contents

Classes

TextTexture

GPU-backed text texture for use on 3D objects.

Functions

find_font_path

Find a usable system font path via the unified font finder.

rasterize_text

Rasterize text from an MSDF atlas into an RGBA uint8 image.

create_text_texture

Create a TextTexture backed by GPU resources from the given context.

Data

API

simvx.graphics.text_utils.__all__

[‘TextTexture’, ‘create_text_texture’, ‘find_font_path’, ‘rasterize_text’]

simvx.graphics.text_utils.find_font_path() str[source]

Find a usable system font path via the unified font finder.

simvx.graphics.text_utils.rasterize_text(text: str, atlas: Any, font_size: int, width: int, height: int, colour: tuple) numpy.ndarray[source]

Rasterize text from an MSDF atlas into an RGBA uint8 image.

Samples the MSDF atlas per-pixel, applies median thresholding, and composites coloured glyphs onto a transparent background.

class simvx.graphics.text_utils.TextTexture(ctx: simvx.graphics.gpu.context.GPUContext, register_texture: Any, texture_descriptor_set: Any, default_sampler: Any, font: str | None = None, size: int = 32, width: int = 256, height: int = 64)[source]

GPU-backed text texture for use on 3D objects.

Properties .text and .colour trigger re-rasterization and GPU upload when changed.

Initialization

property text: str
property colour: tuple
simvx.graphics.text_utils.create_text_texture(ctx: simvx.graphics.gpu.context.GPUContext, register_texture: Any, texture_descriptor_set: Any, default_sampler: Any, font: str | None = None, size: int = 32, width: int = 256, height: int = 64) simvx.graphics.text_utils.TextTexture[source]

Create a TextTexture backed by GPU resources from the given context.