22 class Text :
public Node {
24 explicit Text(std::string
text) : text_(std::move(
text)) {}
26 void ComputeRequirement()
override {
28 requirement_.min_y = 1;
31 void Render(Screen& screen)
override {
33 const int y = box_.y_min;
44 screen.PixelAt(x, y).character = cell;
53 class VText :
public Node {
55 explicit VText(std::string
text)
58 void ComputeRequirement()
override {
59 requirement_.min_x = width_;
63 void Render(Screen& screen)
override {
64 const int x = box_.x_min;
66 if (x + width_ - 1 > box_.x_max) {
73 screen.PixelAt(x, y).character = it;
101 return std::make_shared<Text>(std::move(
text));
150 return std::make_shared<VText>(std::move(
text));
A rectangular grid of Pixel.
std::shared_ptr< Node > Element
std::vector< std::string > Utf8ToGlyphs(const std::string &input)
int string_width(const std::string &)
std::string to_string(const std::wstring &s)
Convert a UTF8 std::string into a std::wstring.
Element text(std::wstring text)
Display a piece of unicode text.
Element vtext(std::wstring text)
Display a piece unicode text vertically.
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.