#pragma once #include #include "utils/globals.hpp" namespace Nimbin { namespace Text { class Handler; struct Line; struct HiSpan; namespace Token { struct Ai; struct Data; struct Description; enum class Type : uint8_t; } enum class ColorSource : uint8_t { Lexed, Lint, Static }; enum class FaceMode : uint8_t { None, Yaw, Pitch, Both }; enum class LayoutMode : uint8_t { Display, Editing, FaceCamera }; DynArray wrap_String(const std::string& text, size_t max_chars); std::string ascii_Sanitize(const std::string& in); } // namespace Text namespace Text { struct HiSpan { size_t byte_begin; size_t byte_end; Text::Token::Type type; }; namespace CppHighlight { DynArray classify (const std::string& source); Text::Token::Type classify_Word(const std::string& word); } } // namespace Text namespace Text { struct Line { DynArray tokens; double bounce_off { 0.0 }; double bounce_vel { 0.0 }; double y { 0.0 }; double line_height { 0.0 }; double word_spacing { 0.0 }; TokenPtr num_left; TokenPtr num_right; int number { -1 }; bool show_number { false }; bool is_Empty() const { return tokens.empty(); } size_t count () const { return tokens.size(); } double width (double gap) const; Token::Data* token_At_Byte(size_t off) const; void clear(); }; } // namespace Text } // namespace Nimbin