Published release 0.2.1. Unreleased PR #2 reference.
LOOM 0.2.1 / WIDGETS
CharacterArt
Preserves artwork spacing without wrapping. Measures terminal-cell dimensions once, including a trailing newline’s extra row. Empty artwork has width 0 and height 1. Blank cells in its natural rectangle are painted with its style; additional assigned area is untouched.
Standard inherited Swift protocol operations such as synthesized equality and OptionSet set operations are not repeated. The public declarations below are extracted from the exact source revision listed in the coverage manifest.
Example
let art = CharacterArt(" /\\_/\\\n( o.o )", style: Style(foreground: .rgb(237, 166, 98)))
_ = (art.width, art.height)Members on this page
Feature guides and release status
CharacterArt
struct CharacterArtConforms to: Swift.Sendable, Swift.SendableMetatype, Widget.
Draws character artwork at its original spacing without wrapping.
Width and height are measured in terminal cells. Tabs advance to four-column stops, and terminal controls are removed using the same rules as TextLayout. Every newline starts a row, including a trailing newline; an empty source has width zero and height one. Blank cells inside the artwork's natural rectangle are painted with its style. Extra space in the assigned area remains untouched.
Source · CharacterArt.swift:10width
let width: IntWidth in terminal cells.
Source · CharacterArt.swift:11height
let height: IntHeight in terminal cells.
Source · CharacterArt.swift:12style
var style: StyleVisual attributes used when painting this value.
Source · CharacterArt.swift:13init(_:style:)
init(_ source: String, style: Style = Style())Measures and caches artwork once, preserving explicit line breaks.
Parameters (2)
source- Argument type and any default are shown in the declaration; see the behavior notes above.
style- Text/cell appearance.
render(in:buffer:)
func render(in area: Rect, buffer: inout Buffer)Clips to the assigned area and buffer without drawing partial wide graphemes.
Parameters (2)
in- Argument type and any default are shown in the declaration; see the behavior notes above.
buffer- Mutable destination cell grid.