mirror of https://github.com/odrling/Aegisub
Misc. enhancements and bugfixes to kara-templater.
Originally committed to SVN as r1234.
This commit is contained in:
parent
de81a61ee6
commit
a678ca82fe
|
@ -127,6 +127,7 @@ function parse_template(meta, styles, line, templates, mods)
|
||||||
pre = "",
|
pre = "",
|
||||||
style = line.style,
|
style = line.style,
|
||||||
loops = 1,
|
loops = 1,
|
||||||
|
layer = line.layer,
|
||||||
addtext = true,
|
addtext = true,
|
||||||
keeptags = false,
|
keeptags = false,
|
||||||
inline_fx = nil,
|
inline_fx = nil,
|
||||||
|
@ -341,8 +342,8 @@ function set_ctx_syl(varctx, line, syl)
|
||||||
varctx.sright = math.floor(line.left + syl.right+0.5)
|
varctx.sright = math.floor(line.left + syl.right+0.5)
|
||||||
if syl.isfuri then
|
if syl.isfuri then
|
||||||
varctx.sbottom = varctx.ltop
|
varctx.sbottom = varctx.ltop
|
||||||
varctx.stop = varctx.ltop - syl.height
|
varctx.stop = math.floor(varctx.ltop - syl.height + 0.5)
|
||||||
varctx.smiddle = varctx.ltop - syl.height/2
|
varctx.smiddle = math.floor(varctx.ltop - syl.height/2 + 0.5)
|
||||||
else
|
else
|
||||||
varctx.stop = varctx.ltop
|
varctx.stop = varctx.ltop
|
||||||
varctx.smiddle = varctx.lmiddle
|
varctx.smiddle = varctx.lmiddle
|
||||||
|
@ -355,8 +356,13 @@ function set_ctx_syl(varctx, line, syl)
|
||||||
elseif line.halign == "right" then
|
elseif line.halign == "right" then
|
||||||
varctx.sx = math.floor(line.left + syl.right + 0.5)
|
varctx.sx = math.floor(line.left + syl.right + 0.5)
|
||||||
end
|
end
|
||||||
-- FIXME: furigana needs different y
|
if line.valign == "top" then
|
||||||
varctx.sy = math.floor(line.y+0.5)
|
varctx.sy = varctx.stop
|
||||||
|
elseif line.valign == "middle" then
|
||||||
|
varctx.sy = varctx.smiddle
|
||||||
|
elseif line.valign == "bottom" then
|
||||||
|
varctx.sy = varctx.sbottom
|
||||||
|
end
|
||||||
varctx.left = varctx.sleft
|
varctx.left = varctx.sleft
|
||||||
varctx.center = varctx.scenter
|
varctx.center = varctx.scenter
|
||||||
varctx.right = varctx.sright
|
varctx.right = varctx.sright
|
||||||
|
@ -395,13 +401,13 @@ function apply_line(meta, styles, subs, line, templates, tenv)
|
||||||
lbottom = math.floor(line.bottom + 0.5),
|
lbottom = math.floor(line.bottom + 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)
|
||||||
-- TODO? more positioning vars
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Specific for whole-line processing
|
-- Specific for whole-line processing
|
||||||
varctx["start"] = varctx.lstart
|
varctx["start"] = varctx.lstart
|
||||||
varctx["end"] = varctx.lend
|
varctx["end"] = varctx.lend
|
||||||
varctx.dur = varctx.ldur
|
varctx.dur = varctx.ldur
|
||||||
|
varctx.kdur = math.floor(varctx.dur / 10)
|
||||||
varctx.mid = varctx.lmid
|
varctx.mid = varctx.lmid
|
||||||
varctx.i = varctx.li
|
varctx.i = varctx.li
|
||||||
varctx.left = varctx.lleft
|
varctx.left = varctx.lleft
|
||||||
|
@ -429,6 +435,7 @@ function apply_line(meta, styles, subs, line, templates, tenv)
|
||||||
applied_templates = true
|
applied_templates = true
|
||||||
local newline = table.copy(line)
|
local newline = table.copy(line)
|
||||||
tenv.line = newline
|
tenv.line = newline
|
||||||
|
newline.layer = t.layer
|
||||||
newline.text = ""
|
newline.text = ""
|
||||||
if t.pre ~= "" then
|
if t.pre ~= "" then
|
||||||
newline.text = newline.text .. run_text_template(t.pre, tenv, varctx)
|
newline.text = newline.text .. run_text_template(t.pre, tenv, varctx)
|
||||||
|
@ -648,6 +655,7 @@ function apply_one_syllable_template(syl, line, template, tenv, varctx, subs, sk
|
||||||
local newline = table.copy(line)
|
local newline = table.copy(line)
|
||||||
newline.styleref = syl.style
|
newline.styleref = syl.style
|
||||||
newline.style = syl.style.name
|
newline.style = syl.style.name
|
||||||
|
newline.layer = t.layer
|
||||||
tenv.line = newline
|
tenv.line = newline
|
||||||
newline.text = run_text_template(t.t, tenv, varctx)
|
newline.text = run_text_template(t.t, tenv, varctx)
|
||||||
if t.addtext then
|
if t.addtext then
|
||||||
|
|
Loading…
Reference in New Issue