Line 22: |
Line 22: |
| | <u><center>y</center></u> || number || the ''y'' coordinate of the beginning of the string. Relative to ''position''. | | | <u><center>y</center></u> || number || the ''y'' coordinate of the beginning of the string. Relative to ''position''. |
| |- | | |- |
− | | <u><center>position</center></u> || string || the string’s anchor point. It can either be "baseline", “bottom”, “middle”, or “top”. | + | | <u><center>position</center></u> || string || the string’s anchor point (vertical alignment). It can either be "baseline", “bottom”, “middle”, or “top”. See screenshot below. |
| |} | | |} |
| + | |
| + | The ''position'' argument is optional, and defaults to "bottom" when not specified in apilevels < 2.3. For apilevels >= 2.3, the default is "top". |
| + | |
| == Example == | | == Example == |
| <syntaxhighlight>function on.paint(gc) | | <syntaxhighlight>function on.paint(gc) |
Line 29: |
Line 32: |
| end</syntaxhighlight> | | end</syntaxhighlight> |
| will display Hello World at the top-left part of the screen. | | will display Hello World at the top-left part of the screen. |
| + | |
| | | |
| == Good to know == | | == Good to know == |
− | In order to clear up what 'position' does, here's an animated image with the 4 possibilities, showing a text that is drawn at the same 60;60 coordinates, but with different "position" attributes. | + | In order to clear up what 'position' does, here's an animated image with the 4 possibilities, showing a text that is drawn at the same 60;60 coordinates, but with different "position" attributes.<br /> |
| [[File:drawString_text_position.gif]] | | [[File:drawString_text_position.gif]] |
| | | |
| <br /><br /> | | <br /><br /> |
| [[Category:gc]] | | [[Category:gc]] |