To what extent is unicode supported in text objects

12 views
Skip to first unread message

Kevin Goldstein

unread,
Sep 27, 2022, 2:10:42 AM9/27/22
to Glowscript Users
I would like to attach the label ê₁ to a vector using unicode.
In the following code: 


the "hat" appears but the subscript does not appear on the text object.

To what extent is unicode supported in text objects? 

Ultimately I would like to approximate something like

on_basis.png

Bruce Sherwood

unread,
Sep 27, 2022, 12:49:14 PM9/27/22
to Glowscript Users
If you look carefully you'll see that the print statement does NOT subscript the "1".

Currently there are two ways to produce what you want. One is to use a label object:

a1 = arrow(pos=vec(-1,0,0), length=2)
label(pos=a1.pos+a1.axis-vec(0,.2,0), text="ê<sub>1</sub>",
        height=60, box=False, opacity=0, font='serif')

The other way would be to use two 3D text objects, one for the letter and another for the number, positioned appropriately to look like a subscript. If you use this approach, it would make sense to have a function fpos, (letter, number) that creates the two text objects.
       
Bruce

Bruce Sherwood

unread,
Sep 27, 2022, 12:51:53 PM9/27/22
to Glowscript Users
Typo: I meant  a function f(pos, (letter, number).

Bruce Sherwood

unread,
Sep 27, 2022, 12:53:24 PM9/27/22
to Glowscript Users
Still managed to get it wrong! Should be f(pos, letter, number).

Kevin Goldstein

unread,
Sep 27, 2022, 1:43:30 PM9/27/22
to Glowscript Users
Thank you - I had not realised html-like formatting had been implemented for these objects

Bruce Sherwood

unread,
Sep 27, 2022, 1:47:43 PM9/27/22
to Glowscript Users
The html capability is only in the label object, not in the 3D text object nor in print.

Bruce

Reply all
Reply to author
Forward
0 new messages