Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

drawString and exponents

 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a simple way to use drawString and print out an equation with exponents?
 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. So I can achieve superscript and I can achieve making font larger but it seems that I cannot do both at the same time. Any suggestions on achieving both?
Make font larger

Add a superscript

This won't do both, will only increase the font.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50241
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are doing graphics, that might be better discussed in the GUIs forum. Nil desperandum! I can copy this discussion so it is in both fora

Are you aware of superscript characters? You can probably use \u2074 and get ⁴. More details here, and it tells you where to look (\u00b2, I think) for ².
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try setting the Font attributes instead. My Visual Font Designer can help generate the code painlessly. Or maybe using the form of AttributedString#addAttribute(...) that takes a Map would produce the desired result.

To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates your problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic