text.width has no useful effect

I find it strange that the newText function generates a display object which implements a mask with the result that setting its .width property does not change the text object’s width but in fact its mask. This means that setting the text width after creating it causes it to be cropped and not stretched.

To stretch or compress a piece of text using its .width or .height properties the text must be placed into a group and the group must be altered.

Other than the note of masking, this does not appear to be documented in the API docs and there is no reason provided.

Interesting observation. I tested and xScale / yScale work, e.g.

a = display.newText("Something", 100, 100) b = display.newText("Something", 100, 200) a.width = 100 -- crops the text b.xScale = 1.5 -- stretches the text

Have you tried this with a font?

Scrub that - I did and you’re right, it works:

a = display.newText{ text="Something", x=display.contentCenterX, y=display.contentCenterY, font="Florencesans Black", fontSize=70 } b = display.newText{ text="Something", x=display.contentCenterX, y=display.contentCenterY+200, font="Florencesans Black", fontSize=70 } a.width = 200 -- crops the text b.xScale = .5 -- stretches the text

Interesting observation. I tested and xScale / yScale work, e.g.

a = display.newText("Something", 100, 100) b = display.newText("Something", 100, 200) a.width = 100 -- crops the text b.xScale = 1.5 -- stretches the text

Have you tried this with a font?

Scrub that - I did and you’re right, it works:

a = display.newText{ text="Something", x=display.contentCenterX, y=display.contentCenterY, font="Florencesans Black", fontSize=70 } b = display.newText{ text="Something", x=display.contentCenterX, y=display.contentCenterY+200, font="Florencesans Black", fontSize=70 } a.width = 200 -- crops the text b.xScale = .5 -- stretches the text