I am developing applications using Android's Interactive Ink.
There is a phenomenon that the character spacing varies although similar Japanese text is entered.
Reference image 1
When I imported "さしすせそ".
editor.import_(MimeType.TEXT, "さしすせそ", null);
Reference image 2
When I imported "さきすせそ"
editor.import_(MimeType.TEXT, "さきすせそ", null);
"Reference image 2" has a smaller character spacing than "Reference image 1" even though we have changed the text only one character.
I feel that the character spacing of "Reference image 1" is also incorrect.
Although the character spacing of "さし" is wide, the spacing between letters of "すせ" is narrow.
Is it possible to keep the character spacing of Japanese text constant?
Also, I want to know why the character spacing varies depending on the text like this.
I corrected it because there was a mistake in the sentences.
In "reference image 1", compared with "reference image 2", the character interval of "すせ" is narrower than that of "reference image 2" even though only one character has been changed.
I feel that the character spacing itself of "reference image 1" is strange.
>"Reference image 2" has a smaller character spacing than "Reference image 1" even though we have changed the text only one character.
>I feel that the character spacing of "Reference image 1" is also incorrect.
Hi kousuke fujii,
The iink SDK draws each recognized word with a call to Canvas::drawText(), at the position provided by the the Android framework, based on the theme settings. It should look similar to any other Japanese text rendered on Android.
However, I managed to reproduce the issue you describe: when I import "さきすせそ\nさしすせそ", I get the exact same spacing for both sentences, but when I import only "さしすせそ", I get that spacing issue.
We're looking into this issue and will let you know when we find what causes this,
Hi kousuke fujii,
The following change should improve the issue you are facing.
In FontMetricsProvider.java, replace line 138:
float x = x_px2mm(left + charBox.left);
float x = x_px2mm(left);
I hope this helps.
Note that we're working on some font rendering improvements that will be available in a future release.
Thank you for reply.
As a result of the change, the character spacing became normal.
I am interested in changing the processing of "FontMetricsProvider.java", is there any effect on other processing?
Dear kousuke fujii,
When you change the `FontMetricsProvider`, you should look for characters rendering issues and gesture recognition issues - these are the most common problems we've faced.
Note that the `FontMetricsProvider` is key to support `convert` and `import` operations: it provides the converted characters positions to the iink SDK, so that we know exactly where each glyph is positioned. Creating or updating the `FontMetricsProvider` for a given platform is a complex and tedious process, as there is usually no simple way of getting the glyphs positioning from the platform. The current implementation is not perfect, we're still working to improve it in future releases.
What kind of changes would you like to bring to `FontMetricsProvider`? Can you tell me what you are trying to achieve?