The following functions render custom widgets.

Blockquotes

The following functions can be used to create blockquotes:

  1. Blockquote(ImColor colour) - Renders a block quote rectangle. This can be called multiple times with ImGui::SameLine to make a blockquote nesting effect
  2. template<typename ...Args> void Blockquote(const char* fmt, ImColor colour, Args... args) - An abstraction on top of ImGui::Text and Blockquote. Renders a blockquote with ImGui::Text. The format string and variadic arguments are passed directly to ImGui::Text
  3. BlockquoteWrapped(const char* text, const char* end, ImColor colour) - Renders blockquotes with text wrapping, the first 2 arguments are pointers to the beginning and end of the string to be rendered
  4. BlockquoteWrapped(const std::string& text, ImColor colour) - An abstraction on top of the above function that uses std::string instead of pointers to the beginning and end of the string

The colour argument defines the colour of the blockquote rectangle. By default, it is set to UIMGUI_BLOCKQUOTE_TEXT_COLOUR, which returns the following RGB colour: rgb(69, 71, 90, 255)

Subscript and superscript

Subscript and superscript rendering are bundled into the same function. This is so that we can easily render them both with a single X starting coordinate, so that we can render text like this:

image

There are 2 functions that can be used to render subscript and superscript text:

  1. SubSuperscript(const char* subscriptBegin, const char* subscriptEnd, const char* superscriptBegin, const char* superscriptEnd) - Given pointers to the beginning and end of the subscript and superscript strings, renders subscript and superscript text
  2. SubSuperscript(const std::string& subscript, const std::string& superscript) - Abstraction on top of the function above that uses std::string instead of pointers to the beginning and end of the string to be rendered

It is not possible to apply word wrapping for these 2 functions

Ruby annotations

Ruby annotations are important for languages like Chinese and Japanese, that use logo-graphic characters, whose pronunciation may not be part of the character. For this reason, ruby text provides additional pronunciation information on top of the word annotated by it. Normally, it looks like this:

image

Note: We only support horizontal ruby annotation.

There are 2 functions that can be used to render ruby text:

  1. Ruby(const char* textBegin, const char* textEnd, const char* annotationBegin, const char* annotationEnd, bool bWrapAnnotation, bool bWrapText - Given a pointer to the beginning and end of the text and annotation strings, renders text with ruby annotation
  2. Ruby(const std::string& text, const std::string& annotation, bool bWrapAnnotation, bool bWrapText) - An abstraction on top of the above function that uses std::string instead of pointers to the beginning and end of the strings

There are 2 additional arguments, bWrapAnnotation and bWrapText, these 2 booleans default to true and false respectively, but can be overridden if needed. They control word wrapping for the annotation and main text.

Showcase

The following picture showcases nested blockquotes with wrapping, subscripts, superscripts and ruby text:

image