mirror of https://github.com/odrling/Aegisub
Full workiness added to furigana code. At least it passes my tests.
Originally committed to SVN as r1184.
This commit is contained in:
parent
e2f62caf7b
commit
75548ec7cc
|
@ -385,8 +385,9 @@ function karaskel.do_furigana_layout(meta, styles, line)
|
|||
-- Furigana-less syllables always generate a new layout group
|
||||
-- So do furigana-endowed syllables that are marked as split
|
||||
-- But if current lg has no width (usually only first) don't create a new
|
||||
if (syl.furi.n == 0 or syl.furi[1].issplit or not last_had_furi) and lg.basewidth > 0 then
|
||||
aegisub.debug.out(5, "Inserting layout group, basewidth=%d, furiwidth=%d\n", lg.basewidth, lg.furiwidth)
|
||||
aegisub.debug.out(5, "syl.furi.n=%d, isbreak=%s, last_had_furi=%s, lg.basewidth=%d\n", syl.furi.n, syl.furi.n > 0 and syl.furi[1].isbreak and "y" or "n", last_had_furi and "y" or "n", lg.basewidth)
|
||||
if (syl.furi.n == 0 or syl.furi[1].isbreak or not last_had_furi) and lg.basewidth > 0 then
|
||||
aegisub.debug.out(5, "Inserting layout group, basewidth=%d, furiwidth=%d, isbreak=%s\n", lg.basewidth, lg.furiwidth, syl.furi.n > 0 and syl.furi[1].isbreak and "y" or "n")
|
||||
table.insert(lgroups, lg)
|
||||
lg = { basewidth=0, furiwidth=0, syls={}, furi={}, spillback=false }
|
||||
last_had_furi = false
|
||||
|
@ -395,7 +396,7 @@ function karaskel.do_furigana_layout(meta, styles, line)
|
|||
-- Add this syllable to lg
|
||||
lg.basewidth = lg.basewidth + syl.prespacewidth + syl.width + syl.postspacewidth
|
||||
table.insert(lg.syls, syl)
|
||||
aegisub.debug.out("\tAdding syllable to layout group: %s (width=%d)\n", syl.text_stripped, syl.width)
|
||||
aegisub.debug.out("\tAdding syllable to layout group: '%s', width=%d, isbreak=%s\n", syl.text_stripped, syl.width, syl.furi.n > 0 and syl.furi[1].isbreak and "y" or "n")
|
||||
|
||||
-- Add this syllable's furi to lg
|
||||
for f = 1, syl.furi.n do
|
||||
|
@ -483,7 +484,7 @@ function karaskel.do_furigana_layout(meta, styles, line)
|
|||
syl.right = syl.left + syl.width
|
||||
curx = syl.right + syl.postspacewidth
|
||||
end
|
||||
line.width = curx
|
||||
if curx > line.width then line.width = curx end
|
||||
-- Place furigana
|
||||
if lg.furiwidth < lg.basewidth or lg.spillback then
|
||||
-- Center over group
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
[Script Info]
|
||||
; Script generated by Aegisub v2.00 PRE-RELEASE (SVN r1170, jfs)
|
||||
; http://www.aegisub.net
|
||||
Title: Default Aegisub file
|
||||
ScriptType: v4.00+
|
||||
WrapStyle: 0
|
||||
PlayResX: 640
|
||||
PlayResY: 480
|
||||
Video Aspect Ratio: 0
|
||||
Video Zoom: 8
|
||||
Video Position: 840
|
||||
Automation Scripts: ~test-furi.lua
|
||||
Video File: ?dummy:23.976000:3000:640:480:226:221:236:c
|
||||
Audio File: E:\Anime Projekter\Zegapain\op\op.wav
|
||||
|
||||
[V4+ Styles]
|
||||
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
||||
Style: Default-furigana,Arial,10,&H00FFFFFF,&H0000FFFF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,1,1,2,10,10,10,0
|
||||
Style: Default,Arial,20,&H00FFFFFF,&H0000FFFF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,2,2,10,10,10,0
|
||||
|
||||
[Events]
|
||||
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
||||
Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0000,0000,0000,,{\k3}振|ふ{\k3}り{\k10}仮|が{\k5}名|な
|
||||
Dialogue: 0,0:00:05.00,0:00:10.00,Default,,0000,0000,0000,,{\k4}変身|か{\k12}わ{\k7}っ{\k7}た
|
||||
Dialogue: 0,0:00:10.00,0:00:15.00,Default,,0000,0000,0000,,{\k4}お{\k4}茶|ちゃ
|
||||
Dialogue: 0,0:00:15.00,0:00:20.00,Default,,0000,0000,0000,,{\k15}二|ふ{\k15}#|た{\k10}人|り{\k15}だ{\k57}け{\k5}の{\k6}地|は{\k5}球|し{\k8}で
|
||||
Dialogue: 0,0:00:20.00,0:00:25.00,Default,,0000,0000,0000,,{\k5}明日|あ{\k10}#|し{\k5}#|た{\k10}ま{\k7}だ{\k10}会{\k4}う{\k6}時{\k14}#
|
||||
Dialogue: 0,0:00:25.00,0:00:30.00,Default,,0000,0000,0000,,{\k21}遠|と{\k6}#|お{\k27}い{\k27}記|き{\k21}憶|お{\k6}#|く{\k27} {\k14}蘇|<よ{\k5}#|み{\k4}#|が{\k4}#|え{\k26}る{\k20}悲|か{\k6}#|な{\k26}し{\k26}み{\k26}も{\k16}温|<あ{\k5}#|た{\k5}#|た{\k26}め{\k26}て{\k26}行|ゆ{\k26}け{\k26}る{\k26}の{\k26}に
|
||||
Dialogue: 0,0:00:30.00,0:00:35.00,Default,,0000,0000,0000,,{\k29}筋肉|きんにく{\k15}の{\k58}長軸方向|ちょうじくほうこう{\k15}に{\k15}伸|の{\k29}びる{\k29}非常|ひじょう{\k15}に{\k29}大型|おおがた{\k14}の{\k28}細胞{\k28}で、{\k28}1個|いっこ{\k14}の{\k28}細胞|さいぼう{\k14}を{\k42}筋線維|きんせんい{\k28}とも{\k14}呼|よ{\k28}ぶ。
|
||||
Dialogue: 0,0:00:35.00,0:00:40.00,Default,,0000,0000,0000,,{\k80}中|<ちゅ{\k60}#|う{\k60}国|ご{\k60}#|く{\k60}魂|<た{\k60}#|ま{\k60}#|し{\k60}#|い
|
||||
Dialogue: 0,0:00:40.00,0:00:45.00,Default,,0000,0000,0000,,wee
|
|
@ -50,6 +50,7 @@ function layout_furi(subs)
|
|||
aegisub.progress.task(l.text)
|
||||
karaskel.preproc_line_pos(meta, styles, l)
|
||||
aegisub.progress.task("Line layouting done, rendering...")
|
||||
aegisub.debug.out(4, "line width: %.2f\n", l.width)
|
||||
-- First all syllables
|
||||
for s = 0, l.kara.n do
|
||||
local syl = l.kara[s]
|
||||
|
|
Loading…
Reference in New Issue