Stringheight Web <> Desktop

Hi everybody,

Dim p as Picture
p = New Picture(100,100, 32)
p.Graphics.TextFont = “Verdana”
p.Graphics.TextSize = 12

MsgBox str(p.Graphics.StringHeight(“Test 123”,100))
MsgBox str(p.Graphics.Stringwidth(“Test 123”))


Web: 28
Desktop: 14 (correct)


Web: 72
Desktop: 55

Why there are different values?

Xojo 2013r4.1

Best regards

Stephan, did you figure out why? I have the same problem.

StringHeight and most graphics on a web app will most probably not even work if the app is installed on a regular CentOS or Linux flavor, because it has no UI, therefore no fonts.

If the app runs on Mac, Windows or a LInux Box with UI, then chances are stringwidth will work.

The only way to have a reliable measurement is to get it in JavaScript, since the client knows the actual font used, as well as the scaling set by the user.


Web and Desktop apps use different libraries.
So the result will always be different.

Thank you Michel and Christian.
Learning something new every day :slight_smile: