user1152442
user1152442

Reputation: 75

GWT: How to determine the height of a text/font as it appears onto a canvas?

How do you determine the height (in pixels) of a font/line of text as it appears on a canvas? Any ideas how this can be done using GWT are appreciated.

Upvotes: 0

Views: 634

Answers (1)

appbootup
appbootup

Reputation: 9537

GWT translates to Javascript and hence can only work on canvas via javascript api's. So you can either use the javascript solution invoked in GWT JSNI or rewrite the solution in native GWT Java.

I would pick Daniel Earwicker solution on stackoverflow - How can you find the height of text on an HTML canvas?

Upvotes: 1

Related Questions