simvx.graphics.text_utils¶
Text utility helpers extracted from Engine: font finding and text rasterization.
Module Contents¶
Classes¶
GPU-backed text texture for use on 3D objects. |
Functions¶
Find a usable system font path via the unified font finder. |
|
Create a TextTexture backed by GPU resources from the given engine. |
Data¶
API¶
- simvx.graphics.text_utils.__all__¶
[‘TextTexture’, ‘create_text_texture’, ‘find_font_path’, ‘rasterize_text’]
- simvx.graphics.text_utils.find_font_path() str¶
Find a usable system font path via the unified font finder.
- class simvx.graphics.text_utils.TextTexture(engine: simvx.graphics.engine.Engine, font: str | None = None, size: int = 32, width: int = 256, height: int = 64)¶
GPU-backed text texture for use on 3D objects.
Setting
.textor.colourre-rasterises the string and writes the new pixels into the image the texture already owns. Width, height and format are fixed at construction, sotexture_indexnever moves: a material can bind it once and every later change is seen through the same slot.- Meth:
destroyreleases the slot and the image. Without it the image lives until the device is torn down.
Initialization
- property text: str¶
- property colour: tuple¶
- pixels() Any¶
The text rasterised into an RGBA array, ready for upload.
The whole CPU half of drawing text onto a 3D surface: resolve the atlas, pack every glyph the string needs, and rasterise. Separate from the GPU upload so the layout it produces can be checked without a device.
- destroy() None¶
Release the GPU image behind this texture and its bindless slot.
- simvx.graphics.text_utils.create_text_texture(engine: simvx.graphics.engine.Engine, font: str | None = None, size: int = 32, width: int = 256, height: int = 64) simvx.graphics.text_utils.TextTexture¶
Create a TextTexture backed by GPU resources from the given engine.