iink SDK on Device

Answered

Actual font size computation

We are working with a text document and adjusting the font size using the styling options (which is now possible with version 1.4):

editor.setTheme(".text { font-size: 8;  }");

However, we noticed that the actual size of the letters is different on a tablet and a phone after converting using DIGITAL_EDIT. I suppose that the SDK takes into account the specs of the device and adjusts the actual text size based on those. We would like to be able to set the text size ourselves based on the size of the device (for example, the size of the letters would be 10mm on a 10 inch wide screen and 5mm on a 5 inch wide screen). But right now if we specify font-size: 10 on one and font-size: 5 on the other, the smaller letters won't be half the size of the small ones.

We would like to know how the actual size of the letters is computed so we can use that knowledge to match our requirements.

Thank you!


Best Answer

Dear Nicolas,

thank you for contacting us and your question.

Currently, We have some computation inside the iink SDK (and also Nebo) that tune the font size to ensure what we believe is an optimal digital edit font size, digital publish font size and line height.

First, before further explanation, we will refer to the following parameters:
The font-size will correspond to the "Font size" parameter requested by the user in the theme css
The line-height will correspond to the "line-height" parameter requested by the user in the theme css
dpiY will correspond to the Y dpi provided at the Renderer creation

Here is how it works :
generic-font-size = font-size * 2.4
generic-font-size-px = FontMetricsProvider::getFontSizePx(generic-font-size) -> outcome depends on the UI Reference Implementation on each plateform
dots-per-mm-y = dpiY/ 25.4
digital-publish-font-size = generic-font-size-px / dots-per-mm-y
digital-edit-font-size = digital-publish-font-size * 2
line-gap = digital-publish-font-size* line-height * 2

In the end, in the application, the values used for the font size will be the digital-publish-font-size (when in digital publish) and the digital-edit-font-size (when in digital publish).

As you can see, you cannot change only one font-size, (e.g. digital publish or edit), they will always be related to each other (digital-edit-font-size = digital-publish-font-size * 2)

Best regards,

Olivier

1 Comment

Answer

Dear Nicolas,

thank you for contacting us and your question.

Currently, We have some computation inside the iink SDK (and also Nebo) that tune the font size to ensure what we believe is an optimal digital edit font size, digital publish font size and line height.

First, before further explanation, we will refer to the following parameters:
The font-size will correspond to the "Font size" parameter requested by the user in the theme css
The line-height will correspond to the "line-height" parameter requested by the user in the theme css
dpiY will correspond to the Y dpi provided at the Renderer creation

Here is how it works :
generic-font-size = font-size * 2.4
generic-font-size-px = FontMetricsProvider::getFontSizePx(generic-font-size) -> outcome depends on the UI Reference Implementation on each plateform
dots-per-mm-y = dpiY/ 25.4
digital-publish-font-size = generic-font-size-px / dots-per-mm-y
digital-edit-font-size = digital-publish-font-size * 2
line-gap = digital-publish-font-size* line-height * 2

In the end, in the application, the values used for the font size will be the digital-publish-font-size (when in digital publish) and the digital-edit-font-size (when in digital publish).

As you can see, you cannot change only one font-size, (e.g. digital publish or edit), they will always be related to each other (digital-edit-font-size = digital-publish-font-size * 2)

Best regards,

Olivier