xOffset is used to calculate the x position of each string to be displayed. I would expect there to be no spaces between each word with this code but there is … textWidth() is returning a value that is the string itself plus an added space char ??/ Is this right?
Seems that if I don’t call textSize(), then I get what appears to be a space added to the end of each word OR the returned width value makes it appear as if there has been a space added. By calling texSIze(), the space disappears.
I can work with that … although it seems to me to be a minor bug?
No it didn’t help … if you run the test code I put in my original post what happens for you? For me I get a space between each word … “the quick brown fox” , but if I add textSize(12) I get … “thequickbrownfox”
i.e. without the textSIze() command, there is a space between the word?
I just got the same result in another program - what seemed like added spaces. Adding textSize(12) fixed it.
That’s on Windows 10 Pro, 64-bit.
I also tried it on my laptop running Linux Mint Cinnamon 19. There the result was the opposite - textWidth was a bit too short. Adding textSize fixed that too.
Processing 3.5.4 on both OS’es.
After closer inspection thanks to kll’s test, it seems that the text size is slightly off unless fixed with textSize (from flicking back and forth between the pictures below). It is sligthly too small on Windows, and slightly too big on Linux, before fixing it with textSize. Then they are the same size on both OS’es (from what I can tell anyway). The calculated widths are the same regardless.
Comparison between Linux Mint 19 Cinnamon and Windows 10 Pro, each with side-by-side comparison with and without using “textSize”.