Digital Native Studios

TextMeshPro => Feature Requests => Topic started by: zipper on June 17, 2014, 03:56:16 PM

Title: Irregular Text Bounds
Post by: zipper on June 17, 2014, 03:56:16 PM
I would be cool to flow text through arbitrary shapes -> circle, star, octagon, L shape (most useful) etc.
Title: Re: Irregular Text Bounds
Post by: Stephan B. on June 17, 2014, 04:16:35 PM
I would be cool to flow text through arbitrary shapes -> circle, star, octagon, L shape (most useful) etc.

Along with the improved word wrapping for other languages, I do want to take a look at this.
Title: Re: Irregular Text Bounds
Post by: abstractmachine on August 08, 2014, 10:32:44 AM
I would be cool to flow text through arbitrary shapes -> circle, star, octagon, L shape (most useful) etc.

There is actually an algorithm in the public domain that could achieve this, along with better word wrapping. State of the art word wrapping is the Knuth/Plass algorithm, which takes into account the entire paragraph, in lieu of "greedy" line wrapping algorithms:

http://onlinelibrary.wiley.com/doi/10.1002/spe.4380111102/abstract (http://onlinelibrary.wiley.com/doi/10.1002/spe.4380111102/abstract)

Here is a Javascript implementation:

http://www.bramstein.com/projects/typeset/ (http://www.bramstein.com/projects/typeset/)
https://github.com/bramstein/typeset (https://github.com/bramstein/typeset)

There was also this older post, about Kindle typography, that illustrates the algorithm:

http://archive.today/FwtG (http://archive.today/FwtG)

This is a more elegant solution than the current TextMesh Pro justification algorithm. That said, despite all the documentation, it would probably take some time/effort to implement.

As an added bonus to more readable text blocks, it also adds the possibility of irregular line lengths; i.e. arbitrary shapes, including text flow. There is even the possibility of adding hanging punctuation (cf. http://en.wikipedia.org/wiki/Hanging_punctuation (http://en.wikipedia.org/wiki/Hanging_punctuation)) by attributing a zero score to certain glyphs.

For my immediate needs I'll be attempting some sort of an implementation over the next few weeks for a current project. I'll let you know if I have any success.
Title: Re: Irregular Text Bounds
Post by: Stephan B. on August 08, 2014, 10:40:25 AM
I would be cool to flow text through arbitrary shapes -> circle, star, octagon, L shape (most useful) etc.

There is actually an algorithm in the public domain that could achieve this, along with better word wrapping. State of the art word wrapping is the Knuth/Plass algorithm, which takes into account the entire paragraph, in lieu of "greedy" line wrapping algorithms:

http://onlinelibrary.wiley.com/doi/10.1002/spe.4380111102/abstract (http://onlinelibrary.wiley.com/doi/10.1002/spe.4380111102/abstract)

Here is a Javascript implementation:

http://www.bramstein.com/projects/typeset/ (http://www.bramstein.com/projects/typeset/)
https://github.com/bramstein/typeset (https://github.com/bramstein/typeset)

There was also this older post, about Kindle typography, that illustrates the algorithm:

http://archive.today/FwtG (http://archive.today/FwtG)

This is a more elegant solution than the current TextMesh Pro justification algorithm. That said, despite all the documentation, it would probably take some time/effort to implement.

As an added bonus to more readable text blocks, it also adds the possibility of irregular line lengths; i.e. arbitrary shapes, including text flow. There is even the possibility of adding hanging punctuation (cf. http://en.wikipedia.org/wiki/Hanging_punctuation (http://en.wikipedia.org/wiki/Hanging_punctuation)) by attributing a zero score to certain glyphs.

For my immediate needs I'll be attempting some sort of an implementation over the next few weeks for a current project. I'll let you know if I have any success.

I have made improvements to the Word Wrapping in the next release as a result of the Text Container and for the handling of Asian Languages.

However, I will take a look at this when I have a chance.