Added minimal width specification to label text tokens.

develop
Warmist 2012-11-28 19:13:17 +02:00
parent 3964c8a581
commit 8081ab8f51
2 changed files with 8 additions and 1 deletions

@ -2736,7 +2736,11 @@ containing newlines, or a table with the following possible fields:
* ``token.id``
Specifies a unique identifier for the token.
* ``token.minw``
Specifies minimal token width
* ``token.line``, ``token.x1``, ``token.x2``
Reserved for internal use.

@ -282,7 +282,10 @@ function render_text(obj,dc,x0,y0,pen,dpen,disabled)
end
end
end
if token.minw and x<token.minw then
dc:advance(token.minw-x)
x = math.max(x,token.minw or 0)
end
token.x2 = x
end
width = math.max(width, x)