Canvas.fontstretch readwrite property


Get or set the current Canvas font stretch. A font's stretch factor refers to how much the font has been stretched when compared to its normal aspect ratio.

This property uses an integer value from 1 to 9 to specify the font stretch. Lower values indicate narrower widths, while higher values indicate wider widths.

Stretch values are not directly related to visual appearance, but rather to metadata that the current font may or may not provide.

Example

local ui = require "ui" require "canvas" -- create a fixed Window local win = ui.Window("Canvas:align() sample", "fixed", 320, 200) -- create a Canvas local canvas = ui.Canvas(win) -- align the Canvas in all of its parent area canvas.font = "Arial" canvas.fontsize = 18 -- don't use onPaint() event, draw only once canvas:begin() for i=1, 9 do canvas.fontstretch = i canvas:print(canvas.font, 6, i*17) end canvas:flip() -- shows the Window win:show() while win.visible do ui.update() end