TextField now has new optional 'sample' parameter in it's constructor:
TextField.new(font, text, sample) |
where `sample` is a string to set Y position and line height of a text.
Sample parameter is very useful to vertically align texts. When sample is defined Textfield gets it's highest char Y as a start line to align every char from `text`:
TextField.new(font, "my world", "l")
TextField.new(font, "my world", "m")
TextField.new(font, "my world") |
You can also use new method `getLineHeight()` to get sample height and make your own multiline text. For this you need to use same `sample` parameter for each text field and shift their Ys by line height. It is different from `getHeight()` method because last one uses `text` to measure height instead of `sample`. On that pic line height is shown with red boxes.
You can get `sample` of each textfield with `getSample()` method.
And `setFont(font)` method is self-descriptive:) It changes a font of the textfield on-the-fly, so no need to create new textfields anymore for that.
So, in short, TextField has 4 new methods:
setFont(font) -- font should be either bitmap or true type font
setSample(sample) -- sample should be a string
getSample() -- returns sample string
getLineHeight() -- returns height of the sample as a number |