kivy/kivy — pull request #1935 by matham (2014-03-05 22:19:53+00:00)
Title: Improve text rendering algo, fully implement padding, improve justify

This updates the core text render algorithm. Among the things it fixed / changed:

* padding_x and padding_y, although used some places was largely not actually implemented. And even where it was implemented, it was pretty inconsistent. This fully implements it.
* justify was not implemented when text_size width was not None. This implements it.
* Kerning was completely ignored and instead character caches was used. Therefore, we lost a lot of space where more words could be fit on a line. In fact shorten was blamed as a result of this, because shorten did use kerning and fitted more words on the single line. But render didn't and split the lines into two, making it appear that shorten was broken.
* When a very long word that couldn't fit on a single was present, it was placed on a single line anyway, cutting off the rest. This splits long words in as many lines needed.
* Some speed improvement came because before, even if the height was constrained by the user we'd still render everything, including what couldn't be displayed. This only computes the minimum amount of lines needed.
* In general, it makes the algorithm consistent and I added a ton of comments so we could see what is going on.

When I tested it, if text_size was not `None`, I got a 10x improvement in my case. Otherwise, it seemed to be about the same speed.

* Shorten still needs to be fixed to allow shortening from right/left/center among other things.
* MarkupLabel also needs to be fixed because its has many similar issues that label had, including not implementing kerning or padding.