BrOrlandi / StarWarsIntroCreator

Create your own Star Wars intro.

Home Page:https://starwarsintrocreator.kassellabs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider a different line-breaking algorithm and kerning the text

zawsx opened this issue · comments

commented

I'd like to use this great idea in a way that does not go anywhere near anyone's copyright. Find/compose a tune and use my own words. Be nice would be if the spacing algorithm was improved.

At the moment, on some lines, there are several spaces between each word, presumably because the space is distributed between the words to make the edge words line up. By using spaces at smaller font sizes and selective degrees of kerning, it might be possible to add an extra word to some lines.

Could go further and add an interactive, tetris-like facility to build the text from a set of words...

Let me see if I understand your issue.
I think you having this spacing problem because the text-align is justify.
You want an option to set the text-align to center?

commented

Here's an example using the first three lines:
..
It is a period of civil war. Rebel
spaceships, striking from a
hidden base, have won their first
...
The line:
spaceships, striking from a

has more inter-word spaces than most other lines.
http://www.w3.org/wiki/CSS/Properties/word-spacing
If that line was spaced differently, it might be able to accommodate an extra word:

spaceships, striking from a hidden

that in turn might allow the final line to not be a single word:
...
It is a period of civil war. Rebel
spaceships, striking from a hidden
base, have won their first victory
against the evil Galactic Empire.
...
Just a suggested feature improvement. No big deal.
Might make your work look better when other than your default text is being used.

I've tested here and I figure out, with -4px in word-spacing will get the result you proposed to the default text. But in other texts we may not have the same result because it depends on the last word on a line.
Take the two lines, from lorem ipsum, bellow:

ligula pretium, bibendum ex sit
amet, mollis risus. Donec
sollicitudin hendrerit mollis

The word "sollicitudin" will take the last line because the word is too big for the second line.
Therefore I will not change the word-spacing because it will not improve the spacing on most cases.

commented

Thanks Bruno - I appreciate the care you take. If I can discover an algorithm that will do 'best fit' then I'll post it here.
Thanks again for the good work.
C.