Word wrap (justify + minimum raggedness) + inner content / change font style
Posted: Thu Sep 15, 2016 1:45 am
Hi,
I've written the code for this for my personal use. However, I feel it may be useful for some of you.
What it offers:
Love file:
https://drive.google.com/open?id=0B1pb1 ... FRiemd3LXc
Enjoy
Edit: I'm sill going to improve it. I want to use Ascent, Baseline and Descent information from the fonts, so that changing the font in the middle of the text gets prettier. Anyways...
I've written the code for this for my personal use. However, I feel it may be useful for some of you.
What it offers:
- Paragraph justification with minimum raggedness (it is prettier than just filling a line until it has no space for the next word, then creating a new line. The code minimizes the sum of the squares of the extra empty space of each line);
- It gives the position and size of each word, so it is easy to track a specific word in order to turn it clickable;
- Each word is actually an object that has a draw function (big texts are converted automatically), so it is possible to insert figures, different fonts, colors, etc., in the middle of the text. The code includes, as example, a special first letter for the paragraph and a random word of the text is turned blue;
- Basic control over minimum line height, padding-top and minimum space between words.
Love file:
https://drive.google.com/open?id=0B1pb1 ... FRiemd3LXc
Enjoy
Edit: I'm sill going to improve it. I want to use Ascent, Baseline and Descent information from the fonts, so that changing the font in the middle of the text gets prettier. Anyways...