iink SDK on Device

Answered

Maintaining relative size and position of text blocks on multiple devices

We would like to create an app with multiple layers. A background image layer, an iink layer and a shape layer (the shape layer is not using iink). We would like to be able to share documents and match the relative positions of the different elements on multiple devices having various screen resolutions and aspect ratios. The iink layer would be using a Text Document part.

We would like to know if and how we could specify the sizes of the text blocks and the text in them to respect the relative size of the document on the various devices.

Please see the attached image. We would like to be able to position the text block so that the arrow on a separate layer that is not an iink layer always points to the "c" on any device. To do so, we would need to be able to create a text block and specify not only its position but also its size and the size of its text based on the screen resolution of the device.


image



Best Answer

Dear Nicolas,


Thank you for your questions, and your explanations which are clear.


To answer these, when adding a block, it is not possible to specify the size of the latter. Indeed, with the "addBlock", you just give an "approximate" position where you want to add your block, and the editor will try to add it: https://developer.myscript.com/refguides/interactive-ink/android/1.4/com/myscript/iink/Editor.html#addBlock-float-float-java.lang.String-com.myscript.iink.MimeType-java.lang.String-


From this, you understand your use case is difficult to implement and I do not see any other way to proceed.


To answer your second question, the size of a block can be gotten with the getBox function: https://developer.myscript.com/refguides/interactive-ink/android/1.4/com/myscript/iink/ContentBlock.html#getBox--

And for the font size, you can get the explanation af the following link: https://developer.myscript.com/docs/interactive-ink/1.4/reference/styling/#text


Best regards,


Olivier


Answer

Dear Nicolas,


Thank you for your questions, and your explanations which are clear.


To answer these, when adding a block, it is not possible to specify the size of the latter. Indeed, with the "addBlock", you just give an "approximate" position where you want to add your block, and the editor will try to add it: https://developer.myscript.com/refguides/interactive-ink/android/1.4/com/myscript/iink/Editor.html#addBlock-float-float-java.lang.String-com.myscript.iink.MimeType-java.lang.String-


From this, you understand your use case is difficult to implement and I do not see any other way to proceed.


To answer your second question, the size of a block can be gotten with the getBox function: https://developer.myscript.com/refguides/interactive-ink/android/1.4/com/myscript/iink/ContentBlock.html#getBox--

And for the font size, you can get the explanation af the following link: https://developer.myscript.com/docs/interactive-ink/1.4/reference/styling/#text


Best regards,


Olivier

I forgot to mention that we would also need to be able to read the size of the text block and the size of its text that was created on a device to be able to then specify it at a different resolution on another device.