1

I have one little problem: I am trying go center a given text inside a Canvas with PlayN. I do not have any FontMetrics, because GWT does not offer one, and simple repositioning depending of character number and fontsize just does not works :(..

Can somebody please help

4

1 回答 1

2

用于Graphics.layoutText创建TextLayout.

TextLayout提供文本的宽度和高度,您可以使用它来随意定位它并使用Canvas.drawText(TextLayout,x,y).

于 2012-02-09T18:36:46.720 回答