Unreleased APIs from PR #2. Not in 0.2.1. Stable 0.2.1 reference.
LOOM Unreleased (PR #2) / TEXT, MARKDOWN, AND EDITING
terminalCellWidth
Measures one Character as terminal cells using weft’s Unicode width rules. Emulator/font choices can vary; TextLayout accepts a custom measurement closure if your app needs a different width policy.
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
_ = loom.terminalCellWidth(Character("界"))Feature guides and release status
terminalCellWidth(_:)
func terminalCellWidth(_ character: Character) -> IntMeasures one Character as terminal cells using weft’s Unicode width rules. Emulator/font choices can vary; TextLayout accepts a custom measurement closure if your app needs a different width policy.
Parameters (1)
character- Argument type and any default are shown in the declaration; see the behavior notes above.
Returns Int.
terminalCellWidth(_:)
func terminalCellWidth(_ character: Character) -> IntEstimates the terminal cells occupied by one extended grapheme cluster.
This locale-independent policy treats combining marks, controls and default-ignorable scalars as zero cells, ambiguous-width characters as narrow, and East Asian wide/fullwidth characters as two cells. Emoji presentation sequences occupy two cells. VS15 requests text presentation but does not narrow an inherently East Asian wide character. Terminals may differ; renderers can substitute a width policy for a particular terminal.
Parameters (1)
character- Argument type and any default are shown in the declaration; see the behavior notes above.
Returns Int.