23class Text :
public Node {
25 explicit Text(std::string
text) : text_(std::move(
text)) {}
27 void ComputeRequirement()
override {
29 requirement_.min_y = 1;
32 void Render(Screen& screen)
override {
34 const int y = box_.y_min;
45 screen.PixelAt(x, y).character = cell;
54class VText :
public Node {
56 explicit VText(std::string
text)
59 void ComputeRequirement()
override {
60 requirement_.min_x = width_;
64 void Render(Screen& screen)
override {
65 const int x = box_.x_min;
67 if (x + width_ - 1 > box_.x_max) {
74 screen.PixelAt(x, y).character = it;
102 return std::make_shared<Text>(std::move(
text));
151 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.