Skip to content

Commit d92f200

Browse files
committed
workaround style change at end of syllable
1 parent fefbabe commit d92f200

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

automation/include/karaskel-auto4.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,17 @@ function karaskel.preproc_line_size(meta, styles, line)
278278
for s = 0, line.kara.n do
279279
local syl = line.kara[s]
280280

281+
syl.style = cur_style
281282
-- Detect any reset style tags
282-
local style_reset_name = syl.text:match("%{.*\\%r([^}\\]+)")
283+
local _, reset_end, style_reset_name = syl.text:find("%{.*\\%r([^}\\]+)")
283284
if style_reset_name and styles[style_reset_name] then
284285
cur_style = styles[style_reset_name]
286+
-- match does not include final }
287+
if reset_end + 1 < #syl.text then
288+
syl.style = cur_style
289+
end
285290
end
286291

287-
syl.style = cur_style
288292
syl.width, syl.height = aegisub.text_extents(syl.style, syl.text_spacestripped)
289293
syl.width = syl.width * meta.video_x_correct_factor
290294
syl.prespacewidth = aegisub.text_extents(syl.style, syl.prespace) * meta.video_x_correct_factor

0 commit comments

Comments
 (0)