The following functions render custom widgets.
Blockquotes
The following functions can be used to create blockquotes:
Blockquote(Colour colour)
- Renders a block quote rectangle. This can be called multiple times withImGui::SameLine
to make a blockquote nesting effecttemplate<typename ...Args> void Blockquote(const char* fmt, Colour colour, Args... args)
- An abstraction on top ofImGui::Text
andBlockquote
. Renders a blockquote withImGui::Text
. The format string and variadic arguments are passed directly toImGui::Text
BlockquoteWrapped(const char* text, const char* end, Colour colour)
- Renders blockquotes with text wrapping, the first 2 arguments are pointers to the beginning and end of the string to be renderedBlockquoteWrapped(const std::string& text, Colour colour)
- An abstraction on top of the above function that usesstd::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:
There are 2 functions that can be used to render subscript and superscript text:
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 textSubSuperscript(const std::string& subscript, const std::string& superscript)
- Abstraction on top of the function above that usesstd::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:
Note
We only support horizontal ruby annotation.
There are 2 functions that can be used to render ruby text:
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 annotationRuby(const std::string& text, const std::string& annotation, bool bWrapAnnotation, bool bWrapText)
- An abstraction on top of the above function that usesstd::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: