bostrom/text-to-image

Problems with string newline character "\n"

Closed this issue · 1 comments

Hello everyone. I have a problem and would appreciate any help from you. When I'm trying to convert string with \n character only phrase before \n appears in image
Code example:

...
const image = await textToImage.generate('hello\nhow are you');
...

Image:
screenshot from 2016-11-13 19 31 36

But I also observed that if I pass configuring object with maxWidth property in it, then here is what I get as a result

Code example:

...
const image = await textToImage.generate('hello\nhow are you', { maxWidth: 100 });
...

Image:
screenshot from 2016-11-13 19 33 24

Do you have any thoughts on it?

Update And if I increase lineHeight, then I can see second line of text. But of course I can't know beforehand what lineHeight I should set. Is there some appropriate solution?

@artemT82 thanks for the issue report. I hadn't yet come across the need to use newlines in the text, so let's see if I can figure that out. The default line height and font size should be OK for text that automatically wraps onto several lines, so it seems weird that a manual newline wouldn't work. Please let me know if you find out some more.