View Single Post
Old 09-04-2014, 12:36 PM   #201
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kaufman View Post
What if instead of doing it that way, you did it by taking the current font size and determining how many characters per line that was. Then you could internally just convert the number of lines to a number of characters and continue the way you do now. This wouldn't be an exact answer because of kerning, but it would get you a pretty good result. If you cut the internal character count by 5%, you would probably never go over the number of lines requested and it would still work well.

If the non-deterministic-ness of this bothers you, I withdraw the suggestion.
That would be incredibly inaccurate. We are using variable-width fonts, raising the question "What character width does one use?" The letter i is very different from the letter m, l from w, and the like. Add into this characters in other alphabets and the results are probably less deterministic than a character count.

Also, I really have no idea how big a "line" is. The system computes that after having laid out all the components, including the thumb, the padding, the read mark (which might not be there on a book-by-book basis) and the like.

FWIW: as far as I can tell, Android neither kerns nor uses ligatures when layout out text boxes, so these at least would not be a problem.
chaley is offline   Reply With Quote