koreader/koreader — pull request #447 by thotypous (2014-01-10 03:30:14+00:00)
Title: Avoid off-limits dictionary title and make font size adjustable

Implements the following features:
* Avoids dictionary title from going off-limits: currently, if the user has a dictionary whose name is too large, it will be rendered after the close button or even after the dict lookup window borders.
* Make font size adjustable: some dictionaries have embedded word-wrap, i.e. there are newlines, and spaces in the beginning of a line, which were added by the dictionary author in order to achieve the desired formatting. In those cases, the user may want to reduce the font size to one allowing to display the text with no additional word wrappings than those already embedded, thus making the text more readable.

Some remarks:
* The `RenderText:renderUtf8Text` was modified in a way such that the new `width` parameter is optional, so no changes are needed in other places which call this function.
* The `buffer_width` variable was renamed to `text_width`, as it apparently should be, because `x` is summed to `pen_x` when rendering, so perhaps the previous code might draw off bounds if `x > 0` and the text is sufficiently large.
* I did not test if the change above is sufficient to completely avoid drawing off-bounds. (Maybe we should sum the character width also?)
* The `button_padding` is subtracted from the width for avoiding drawing over the close button. This is not the ideal calculation, but I think getting the real button width would need messing too much with the code for only a cosmetic change.