FORMATTING (non-inheritable)
When enabled, allows the use of text formatting attributes. Only works when MULTILINE=YES. Default: NO.
On GTK and GTK 4 it is always enabled when MULTILINE=YES, regardless of this attribute.
Not supported in Motif.
Value
Can be: YES or NO. Default: NO.
Affects
Auxiliary Attributes
ADDFORMATTAG [write-only] (non-inheritable)
Name of a format tag element to be added to the IupText. The name is associated in C using IupSetHandle. The name association must be done before setting the attribute. It will set the ADDFORMATTAG_HANDLE with the associated handle.
ADDFORMATTAG_HANDLE [write-only] (non-inheritable)
Handle of a format tag element to be added to the IupText. The tag element will be automatically destroyed when the IupText is mapped. If the IupText is already mapped, the format tag is immediately destroyed when the attribute is set. The format tag cannot be reused.
REMOVEFORMATTING [write-only] (non-inheritable)
Removes the formatting of the current selection if YES or NULL, and from all text if ALL is used.
Format Tag
The format tag element is a simple IupUser element with some known attributes that will be interpreted when the tag is updated in the native system.
The formatting depends on the existing text, so if VALUE attribute is set, all formatting is lost. You must set it again for the new text.
If the FONT attribute of the IupText is set, then it will affect the format of all characters in the text.
The default values cannot be dynamically changed.
General Format Tag Attributes
BULK: flag that means this tag is composed by several tags as its children. The bulk tag itself does not have formatting. Used to optimize format tag modifications. Default: NO.
CLEANOUT: when BULK=YES is used to clear all the formatting at start. Default: NO.
SELECTION/SELECTIONPOS: same as the IupText SELECTION/SELECTIONPOS attributes. If not defined the IupText attribute will be used. If the IupText attribute is also not defined then the current position will receive the format, so new text inserted or typed will be formatted with the tag. Different tags that use the same selection interval are combined. Setting these attributes here will not change the current setting in IupText.
UNITS [Win32 and WinUI Only]: unit of the distance attributes. Can be TWIP (1/1440 of an inch) or PIXELS. Default: PIXELS.
Paragraph Format Tag Attributes
ALIGNMENT: Can be JUSTIFY, RIGHT, CENTER and LEFT. Default: LEFT. Not supported in FLTK and Haiku.
INDENT: paragraph indentation, the distance between the margin and the paragraph. Not supported in Haiku.
INDENTRIGHT, INDENTOFFSET: the right indentation, and the indentation of the second and subsequent lines relative to the first line. Used only when INDENT is set. Not supported in iOS, FLTK, Haiku, Android and WebAssembly. INDENTOFFSET is also not supported in EFL.
LINESPACING: the distance between lines of the same paragraph. The values SINGLE, ONEHALF and DOUBLE are also accepted in Win32, WinUI, Qt, macOS and WebAssembly. Not supported in FLTK and Haiku.
NUMBERING: Can be BULLET (bullet symbol), ARABIC (arabic numbers - 1,2,3...), LCLETTER (lower case letters - a,b,c...), UCLETTER (upper case letters - A,B,C...), LCROMAN (lower case Roman numerals - i,ii,iii...), UCROMAN (upper case Roman numerals - I,II,III...) and NONE. Default: NONE. Not supported in Haiku.
NUMBERINGSTYLE: Can be RIGHTPARENTHESIS "a)", PARENTHESES "(a)", PERIOD "a.", NONUMBER (it will skip the numbering or bullet for the item) and NONE "". Default: NONE. Not supported in Haiku.
NUMBERINGTAB: Minimum distance from a paragraph numbering or bullet to the paragraph text. Not supported in FLTK, Android, WebAssembly, iOS and Haiku.
SPACEAFTER: distance left empty above the paragraph. Not supported in FLTK, EFL, Android and Haiku.
SPACEBEFORE: distance left empty below the paragraph. Not supported in FLTK, EFL, Android and Haiku.
TABSARRAY: a sequence of tab positions and alignment up to 32 tabs. It uses the format:"pos align pos align pos align...". Position is the distance relative to the left margin and alignment can be LEFT, CENTER, RIGHT and DECIMAL. When DECIMAL alignment is used, the text is aligned according to a decimal point or period in the text, it is normally used to align numbers. Not supported in FLTK, EFL, Android, WebAssembly and Haiku.
Character Format Tag Attributes
BGCOLOR: string containing a color in the format "rrr ggg bbb" for the background of the text.
DISABLED [Windows and macOS Only]: Can be YES or NO. Default NO. Set the visual appearance to disabled.
FGCOLOR: string containing a color in the format "rrr ggg bbb" for the text.
FONTSCALE: a size scale relative to the selected or current size. Values greater than 1 will increase the font. Values smaller than 1 will shrink the font. Default: 1.0. The following values are also accepted: "XX-SMALL" (0.58), "X-SMALL" (0.64), "SMALL" (0.83), "MEDIUM" (1.0), "LARGE" (1.2), "X-LARGE" (1.44), "XX-LARGE" (1.73).
FONTFACE: the face name of the font.
FONTSIZE: the size of the font in pixels or points. Pixel size uses negative values.
IMAGE: name of an image to be displayed in place of the selected text. See IupImage. Use WIDTH and HEIGHT to set the display size in pixels, both default to the natural size of the image. The image occupies a single character position in the VALUE string and takes the paragraph formatting of that position. Not supported in Motif and FLTK.
ITALIC: Can be YES or NO. Default NO.
LANGUAGE [GTK, GTK 4 and EFL Only]: A text with a description of the text language. The same value can be used in the "SYSTEMLANGUAGE" global attribute.
LINK: URL passed to the LINK_CB callback of IupText when the selected text is clicked. Unless FGCOLOR or UNDERLINE are also set, the text is shown in blue and underlined.
RISE: the distance, positive or negative from the base line. Can also use the values SUPERSCRIPT and SUBSCRIPT, but this values will also reduce the size of the font. Not supported in FLTK, EFL and Haiku.
SMALLCAPS: Can be YES or NO. Default NO. (Does not work always, depends on the font) Not supported in Win32, FLTK, EFL, Android and Haiku.
PROTECTED: Can be YES or NO. Default NO. When set to YES the selected text cannot be edited. Supported in GTK, GTK 4, Qt, Win32 and WinUI.
STRETCH [GTK, GTK 4 and EFL Only]: Can be EXTRA_CONDENSED, CONDENSED, SEMI_CONDENSED, NORMAL, SEMI_EXPANDED, EXPANDED and EXTRA_EXPANDED. Default NORMAL. (Does not work always, depends on the font)
STRIKEOUT: Can be YES or NO. Default NO.
UNDERLINE: Can be SINGLE, DOUBLE, DOTTED or NONE. Default NONE.
WEIGHT: Can be EXTRALIGHT, LIGHT, NORMAL, SEMIBOLD, BOLD, EXTRABOLD and HEAVY. Default: NORMAL.
Examples
Ihandle* formattag;
IupSetAttribute(text, "FORMATTING", "YES");
formattag = IupUser();
IupSetAttribute(formattag, "ALIGNMENT", "CENTER");
IupSetAttribute(formattag, "SPACEAFTER", "10");
IupSetAttribute(formattag, "FONTSIZE", "24");
IupSetAttribute(formattag, "SELECTION", "3,1:3,50");
IupSetAttribute(text, "ADDFORMATTAG_HANDLE", (char*)formattag);
formattag = IupUser();
IupSetAttribute(formattag, "BGCOLOR", "255 128 64");
IupSetAttribute(formattag, "UNDERLINE", "SINGLE");
IupSetAttribute(formattag, "WEIGHT", "BOLD");
IupSetAttribute(formattag, "SELECTION", "3,7:3,11");
IupSetAttribute(text, "ADDFORMATTAG_HANDLE", (char*)formattag);
formattag = IupUser();
IupSetAttribute(formattag, "ITALIC", "YES");
IupSetAttribute(formattag, "STRIKEOUT", "YES");
IupSetAttribute(formattag, "SELECTION", "2,1:2,12");
IupSetAttribute(text, "ADDFORMATTAG_HANDLE", (char*)formattag);