Natiny 0.12.1
Text now wraps, aligns, mixes fonts, and supports editing and custom effects, while pivots make scene hierarchies lighter and safer.
Natiny 0.12.1 turns text drawing into a small layout toolkit and makes scene hierarchies easier to build. Fonts can now measure and wrap whole blocks, support editable text and custom glyph effects, while new pivots provide a transform without an object attached to it.
Text fits the space you give it
Wrapped labels, dialogue boxes, and menus no longer need their own line
breaker. natiny.render.text_box draws text
inside a rectangle with horizontal and vertical alignment, and
natiny.font.measure_wrapped
reports the exact width, height, and line count produced by the same layout.
Lines break at whitespace, explicit newlines, and between Han, kana, and Hangul characters. Tabs now advance to four-space stops instead of appearing as missing glyphs. Existing single-line text calls continue to work unchanged.
Fonts are ready for interfaces
Font handles now carry line spacing, letter spacing, filtering, and a fallback font for missing characters. Measuring and drawing use the same settings and the same fallback chain, so a panel sized around mixed-script text still fits what appears on screen. Glyphs can also be preloaded before a screen opens, avoiding an atlas upload when a new alphabet first appears.
The new ascent and descent metrics make baselines, carets, and underlines
straightforward. natiny.font.offset_at
maps a click back to a UTF-8 byte offset, providing the missing half of an
editable text field. On the web, typed Cyrillic, Greek, accented Latin, and
other non-ASCII characters now reach the input API instead of being dropped.
For effects beyond ordinary layout, glyph metrics and the font atlas are now
available directly. Together with
natiny.render.text_ex, which rotates a text
block around a chosen origin, this is enough to build per-letter colour,
typewriter, and wave effects without splitting the layout into guesses.
Pivots give hierarchies an empty transform
natiny.pivot.create creates a transform-only entity:
a useful parent for an axle, mount, muzzle, or any other point that should move
children without drawing a model of its own. A pivot works with the ordinary
natiny.entity API and carries no mesh, material, or draw-list entry.
Entities can now report their rotation, scale, and parent as well as their position. Code that follows a node or reacts to a reparent no longer needs to keep a second copy of its transform state.
Destroying a model, camera, pivot, body, source, or listener now destroys its
complete subtree. This prevents detached parts and leaked resources, but it is
a compatibility change: detach a child first with
natiny.entity.set_parent(child, nil) if it must outlive its parent.
Render scopes clean up after themselves
Lua code can pass a callback to natiny.render.viewport_begin and
natiny.render.scissor_begin. The matching scope is closed when the callback
returns, including when it raises an error, so one failed pane cannot leave the
rest of the frame trapped in its viewport or clipping rectangle.
Solid 2D primitives also draw with the requested colour again after a textured draw. Previously, the last bound picture could be stretched across a later rectangle, circle, or line; existing projects need no changes for the fix.
Natiny 0.12.1 bundles for every supported platform are on the download page.