Support text subscripts and superscripts
- Status
- Closed
- Fixed in
- -
- Source discussion
- https://forum.objo.dev/d/19-text-subscripts-and-superscripts
- Last updated
- 2026-06-10
Upvotes
0 upvotes
Uses your Objo forum account.
Public summary
Problem For scientific apps, the ability to display subscripts(and possibly superscripts) is a must. The strings using these characters could be used in, for example, Labels or within text drawn in a Canvas.
Proposed Solution
Add a String subclass that allows modification of ranges of characters to have additional attributes like subscript, superscript and colour. See Xojo's macOS and iOS AttributedString class for an example of how this could work.
Controls using this type of String would need minor modification. For example, Labels would need another property for this type of string, and Graphics.DrawText() would need an overwritten method that accepted this type of String.
Example Workflow
Var myText As AttributedString = “x1” # First set text content
myText.SetAttribute(1,1, TextAttributes.Subscript) # Set range of subscripted characters, in this case starting and ending at index 1 assuming a 0-based array of characters
Who Would This Help? Anybody developing scientific apps.