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

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

@ -282,7 +282,10 @@ function render_text(obj,dc,x0,y0,pen,dpen,disabled)
end end
end 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 token.x2 = x
end end
width = math.max(width, x) width = math.max(width, x)