I am trying to use canvas.create_text(...) to add text to a drawing. I have been somewhat successful using unicode in the following way:
mytext = u'U\u2076' #U^6
canvas.create_text(xPos,yPos,text = mytext, font = ("Times","30")
canvas.pack()
It works, but when increasing the font size, superscripts 4,5,6,7,8,9,0 do not increase in size. Only 1,2,3 work. I'm assuming it's the same for subscripts. Also, when I save the canvas as a postscript, the problem superscripts are gone...but when I print out that saved image, the superscripts return.
Am I just completely wrong with my approach? I'm just looking to make this work so any help would be greatly appreciated. Thank you.
Your problem comes from the handling of Unicode on your platform and in your fonts. As explained on wikipedia : superscript 1,2 and 3 where previously handled in Latin-1 and thus get different support in fonts.
I did not notice fixed size issue, but on most fonts (on Linux and MacOS), 1,2,3 are not properly aligned with 4-9.
My advice would be to select a font that match your need (you may look at DejaVu family, which provide libre high quality fonts).
Here is a litte application to illustrate the handling of superscripts with different fonts or size.