In iink SDK terminology, “conversion” refers to the replacement of some handwritten content by a clean, typeset equivalent.
Conversion is an explicit action you can trigger to replace ink content with a typeset equivalent. It is different from the recognition process it relies on, which runs in background and interprets any input, making it interactive.
convert(), you are expected to provide the target state you want to reach:
- DigitalPublish - Typeset content, adapted for publication (small font size, and fitted graphics in the case of a Text Document),
- DigitalEdit - Typeset content, suitable for edition (font size that is large enough for editing, expanded graphics).
To convert your text content, iink SDK needs to have information about the font you use, which itself depends on your styling options.
To do so, it requires you to attach to your editor an object implementing the
IFontMetricsProvider interface using
As implementing a font metrics provider is a rather touchy task, MyScript provides you via the iink SDK example repository with a reference implementation.
You can add a button to the example calculator to trigger the conversion. As previously explained, associating the editor view with the editor automatically attaches a font metrics provider.
As a math part is composed of a single block (hosting the math content), you can select it using the
getRootBlock() method of the editor.
If pressing the “solve” button of the UI calls a
solve() method of the
Calculator object, an implementation can be:
Here is an example of what it could look like:
The next step of the guide will take you through the ability to import or export content.