Width of text: RESOLVED

Started by garry23, May 19, 2017, 02:39:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

garry23

@dmilligan

David I hope you can put me out of my misery.

I'm needing to right justify some text and need to the width of a string.

I've tried using font:width(text) but I'm obviously using it wrong.

Could you help me please, ie how do I get the pixel width of a piece of text.

Sorry to be a pain.

Cheers

Garry

dmilligan

FONT.LARGE:width("test")

See also editor.lua

garry23

@dmilligan

Thanks: tried that but get nil value medium error.

Here is the code I used, message is a string.

  local qq = FONT.MEDIUM:width(message)

garry23

@dmilligan

David: BTW here's the screen dump.


garry23

SORTED!

Looked in ML source and realised should MED not MEDIUM

:-)