Add superscript symbol using the AddSymbol API

I'm trying to add a superscript degree sign (∘) in my math view controller.

I've noticed that if I specify a bounding box to be right after the last character and slightly above it, it will be added correctly.

The problem is that I don't know how to calculate the bounding box so that the degree sign ends up in superscript and after the last symbol in the recognized text.

Do you know how to specify the bounding box for my superscript degree sign or even better, is there a way to specify the symbol to be in superscript when I add it using the AddSymbol API?


We are aware that it is difficult to evaluate bounding box coordinates with the current widget version and we hope to change it in the future. In the meantime, we can provide you with explanations for this particular case to help you moving forward. Firstly, the bounding box size will have to be set proportionally to the font, then you will have to apply a calculus to define the superscript bounding box size compared to the bounding box size of the previous operand, as shown below:

Please let us know if you have any other questions.
Best regards

Thank you, great illustration of the calculus!
Would you also point me to the API for finding out the bounding box of the previous operand?


Dear David,

the bounding box of each symbol can be gotten as follows:
-First, you have to implement the OnRecognitionListener:
public class MainActivity extends Activity implements MathWidgetApi.OnRecognitionListener
-Then, after calling the configure, you should set it:
mWidget.configure(math, standard);

-last, in the onRecognitionEnd function, you have to get the result as SymbolList. For each symbol, you can get the bounding box:
public void onRecognitionEnd(MathWidgetApi mathWidgetApi) {

List<MathWidgetApi.Symbol> symbols = mWidget.getResultAsSymbolList();
int nbSymbols = symbols.size();

for(int i=0;i<nbSymbols;i++)
RectF boundingBox = symbols.get(i).boundingBox;
float top =;

Let us know if you need further help.

Best regards,


Login or Signup to post a comment