The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Termbox::Cell - A Single Conceptual Entity on the Terminal Screen

SYNOPSIS

Description

The terminal screen is represented as 2d array of cells. The structure is optimized for dealing with single-width (wcwidth()==1) Unicode code points, however some support for grapheme clusters (e.g., combining diacritical marks) and wide code points (e.g., Hiragana) is provided through ech, nech, cech via Termbox::tb_set_cell_ex( ... ). ech is only valid when nech>0, otherwise ch is used.

For non-single-width code points, given N=wcwidth(ch)/wcswidth(ech):

when N==0

termbox2 forces a single-width cell. Callers should avoid this if aiming to render text accurately.

when N>1:

termbox zeroes out the following N-1 cells and skips sending them to the tty. So, e.g., if the caller sets x=0,y=0 to an N==2 code point, the caller's next set should be at x=2,y=0. Anything set at x=1,y=0 will be ignored. If there are not enough columns remaining on the line to render N width, spaces are sent instead.

See tb_present( ) for implementation.

Methods

Each cell contains the following values:

ch( )

A single Unicode character, if available.

fg( )

Bitwise foreground attributes.

bg( )

Bitwise background attributes.

ech( )

A grapheme cluster of Unicode code points.

This is only defined if extended grapheme clusters are enabled.

nech( )

Length in bytes of ech, 0 means use ch instead of ech.

This is only defined if extended grapheme clusters are enabled.

cech( )

Capacity in bytes of extended grapheme cluster.

This is only defined if extended grapheme clusters are enabled.

LICENSE

Copyright (C) Sanko Robinson.

This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.

AUTHOR

Sanko Robinson <sanko@cpan.org>