Files
ReJUI/include/JUI/Widgets/RichText.hpp
2025-04-03 13:34:51 -04:00

66 lines
1.7 KiB
C++

/// Josh's User Interface Library
/// A C++20 Library for creating, styling, and rendering of a UI/UX widgets.
/// Developed and Maintained by Josh O'Leary @ Redacted Software.
/// Special Thanks to William Tomasine II and Maxine Hayes.
/// (c) 2024 Redacted Software
/// This work is dedicated to the public domain.
/// @file RichText.hpp
/// @desc RTF implementation and RichText Widget class.
/// @edit 2024-08-02
#pragma once
#include <JUI/Base/TextBase.hpp>
#include <JUI/Base/Widget.hpp>
/** Rich-Text Markup specification (Totally not stolen from ROBLOX)
Color: I want the <color="#FF6600>orange</color> candy.
Size: <size="40">This is big</size> This is small.
Font: <font="JetBrains Mono">class RichText.hpp { }; </font>
Weight: <weight="heavy">Heavy</stroke> <weight="900">Extra Heavy</stroke>
Bold: Text in <b>bold</b>
Italic: <i>Italicized</i>
Underline: <u>Underline</u>
Strikethrough: <s>Strikethrough</s>
Escape Forms
< &lt;
> &gt;
" &quot;
' &apos;
& &amp;
*/
// TODO: Simpler "One-liner" Rich text, which is a horizontal sequence of textlabels automatically generated from a format.
namespace RichTextFormat {
class RichTextToken {
public:
std::string font_face_name;
std::string content;
int size;
Color4 color;
int weight;
bool bold;
bool italic;
bool underline;
bool strikethrough;
};
class RichTextSequence
{
public:
static RichTextSequence Parse(const std::string& input);
};
}
namespace JUI
{
class RichText : public Widget, TextBase
{
};
}