So I started to play with MyScript. I managed to run basic drawing and math conversion, very much based on reference implementation. My question is - is it possible to let user draw as he wishes, then let him select area of drawing, and convert only pencil strokes inside the selection? Is there a way to, say, copy selected strokes to a new ContentPart, and convert only that? Or move some strokes to different ContentPart and convert the current one? Or is there some other approach you would recommend?
Best Answer
K
Kozarek
said
almost 3 years ago
OK, got it working. It seems that it is necessary to set viewSize and fontMetricsProvider before setting part. And now I have found it mentioned even in developer guide. My bad.
At present, we do not have a built-in selector tool that would allow to select certain strokes and recognize them with a prefered part type such as Text or Math.
So i came upon a strange error. I got the basic idea from Android code - export strokes from editor in JIIX format, filter them, create another editor, import only filtered strokes to it, and then export text from this new editor. However, if I try to implement it in iOS, i am having problems in setting contentPart to editor.
Here is the problematic code. self.editor is my normal drawing IINKEditor. When i want to recognize selected strokes, I create on fly a new package, part, renderer, recoEditor. But when I set recoEditor.part, it remains nil, without eny error issued.
let engine = self.editor.engine
let mathpackage = try engine.createPackage("MathPackage")
let mathpart = try mathpackage.createPart("Math")
let rndr = try engine.createRenderer(withDpiX: MSHelper.scaledDpi(), dpiY: MSHelper.scaledDpi(), target: nil, error: ())
let recoEditor = engine.createEditor(rndr)
recoEditor!.part = mathpart
//now recoEditor!.part is nil, while mathpart is not. Can recoEditor refuse the part? Setting editor.path certainly works for my basic drawing editor, but not here.
K
Kozarek
said
almost 3 years ago
Answer
OK, got it working. It seems that it is necessary to set viewSize and fontMetricsProvider before setting part. And now I have found it mentioned even in developer guide. My bad.
O
Olivier @MyScript
said
almost 3 years ago
Dear Kozarek,
Thank you for the update.
Indeed, viewSize and fontMetricProvider are mandatory before setting part. We are glad the developer guide was of help.
If you face any difficulty, feel free to contact us.
Kozarek
So I started to play with MyScript. I managed to run basic drawing and math conversion, very much based on reference implementation. My question is - is it possible to let user draw as he wishes, then let him select area of drawing, and convert only pencil strokes inside the selection? Is there a way to, say, copy selected strokes to a new ContentPart, and convert only that? Or move some strokes to different ContentPart and convert the current one? Or is there some other approach you would recommend?
OK, got it working. It seems that it is necessary to set viewSize and fontMetricsProvider before setting part. And now I have found it mentioned even in developer guide. My bad.
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstOlivier @MyScript
Dear Kozarek,
thank you for contacting us and your question.
At present, we do not have a built-in selector tool that would allow to select certain strokes and recognize them with a prefered part type such as Text or Math.
Nevertheless, we have a "lasso" sample, that shows how to implement such behavior with the current release of iink. You can find it on our github: https://github.com/MyScript/interactive-ink-additional-examples-android/tree/master/java/samples/lasso
Let us know if this helps.
Best regards,
Olivier
Kozarek
Thanks, I will look at it.
Kozarek
So i came upon a strange error. I got the basic idea from Android code - export strokes from editor in JIIX format, filter them, create another editor, import only filtered strokes to it, and then export text from this new editor. However, if I try to implement it in iOS, i am having problems in setting contentPart to editor.
Here is the problematic code. self.editor is my normal drawing IINKEditor. When i want to recognize selected strokes, I create on fly a new package, part, renderer, recoEditor. But when I set recoEditor.part, it remains nil, without eny error issued.
Kozarek
OK, got it working. It seems that it is necessary to set viewSize and fontMetricsProvider before setting part. And now I have found it mentioned even in developer guide. My bad.
Olivier @MyScript
Dear Kozarek,
Thank you for the update.
Indeed, viewSize and fontMetricProvider are mandatory before setting part. We are glad the developer guide was of help.
If you face any difficulty, feel free to contact us.
Best regards,
Olivier