Adding $width and $height to kara-templater.

Originally committed to SVN as r1754.
This commit is contained in:
Niels Martin Hansen 2008-01-17 23:23:46 +00:00
parent ae641fec3d
commit 6e621dcc8c
1 changed files with 8 additions and 0 deletions

View File

@ -366,6 +366,7 @@ function set_ctx_syl(varctx, line, syl)
varctx.sleft = math.floor(line.left + syl.left+0.5) varctx.sleft = math.floor(line.left + syl.left+0.5)
varctx.scenter = math.floor(line.left + syl.center+0.5) varctx.scenter = math.floor(line.left + syl.center+0.5)
varctx.sright = math.floor(line.left + syl.right+0.5) varctx.sright = math.floor(line.left + syl.right+0.5)
varctx.swidth = math.floor(syl.width + 0.5)
if syl.isfuri then if syl.isfuri then
varctx.sbottom = varctx.ltop varctx.sbottom = varctx.ltop
varctx.stop = math.floor(varctx.ltop - syl.height + 0.5) varctx.stop = math.floor(varctx.ltop - syl.height + 0.5)
@ -375,6 +376,7 @@ function set_ctx_syl(varctx, line, syl)
varctx.smiddle = varctx.lmiddle varctx.smiddle = varctx.lmiddle
varctx.sbottom = varctx.lbottom varctx.sbottom = varctx.lbottom
end end
varctx.sheight = syl.height
if line.halign == "left" then if line.halign == "left" then
varctx.sx = math.floor(line.left + syl.left + 0.5) varctx.sx = math.floor(line.left + syl.left + 0.5)
elseif line.halign == "center" then elseif line.halign == "center" then
@ -392,9 +394,11 @@ function set_ctx_syl(varctx, line, syl)
varctx.left = varctx.sleft varctx.left = varctx.sleft
varctx.center = varctx.scenter varctx.center = varctx.scenter
varctx.right = varctx.sright varctx.right = varctx.sright
varctx.width = varctx.swidth
varctx.top = varctx.stop varctx.top = varctx.stop
varctx.middle = varctx.smiddle varctx.middle = varctx.smiddle
varctx.bottom = varctx.sbottom varctx.bottom = varctx.sbottom
varctx.height = varctx.sheight
varctx.x = varctx.sx varctx.x = varctx.sx
varctx.y = varctx.sy varctx.y = varctx.sy
end end
@ -422,9 +426,11 @@ function apply_line(meta, styles, subs, line, templates, tenv)
lleft = math.floor(line.left+0.5), lleft = math.floor(line.left+0.5),
lcenter = math.floor(line.left + line.width/2 + 0.5), lcenter = math.floor(line.left + line.width/2 + 0.5),
lright = math.floor(line.left + line.width + 0.5), lright = math.floor(line.left + line.width + 0.5),
lwidth = math.floor(line.width + 0.5),
ltop = math.floor(line.top + 0.5), ltop = math.floor(line.top + 0.5),
lmiddle = math.floor(line.middle + 0.5), lmiddle = math.floor(line.middle + 0.5),
lbottom = math.floor(line.bottom + 0.5), lbottom = math.floor(line.bottom + 0.5),
lheight = math.floor(line.height + 0.5),
lx = math.floor(line.x+0.5), lx = math.floor(line.x+0.5),
ly = math.floor(line.y+0.5) ly = math.floor(line.y+0.5)
} }
@ -439,9 +445,11 @@ function apply_line(meta, styles, subs, line, templates, tenv)
varctx.left = varctx.lleft varctx.left = varctx.lleft
varctx.center = varctx.lcenter varctx.center = varctx.lcenter
varctx.right = varctx.lright varctx.right = varctx.lright
varctx.width = varctx.lwidth
varctx.top = varctx.ltop varctx.top = varctx.ltop
varctx.middle = varctx.lmiddle varctx.middle = varctx.lmiddle
varctx.bottom = varctx.lbottom varctx.bottom = varctx.lbottom
varctx.height = varctx.lheight
varctx.x = varctx.lx varctx.x = varctx.lx
varctx.y = varctx.ly varctx.y = varctx.ly