找回密码
 立即注册
12
返回列表 发新帖
楼主: DeXiao

请问如何使字幕主体居中,文字左对齐(BD内字幕样式)……

9

主题

42

回帖

1490

VC币

星辰大海

Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20

积分
479491
MingY 发表于 2023-6-17 19:35:36 | 显示全部楼层
来挖个坟,提供一个比较完美的解决方案(虽然代码写得有点丑)

  1. Comment: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,code once,function split(inputstr, sep) local t = {} for str in string.gmatch(inputstr, "([^"..sep.."]+)") do _G.table.insert(t, str) end return t end
  2. Comment: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,code line,p=split(line.text_stripped, "\\N") lmaxwidth=0 for _, c in _G.ipairs(p) do w, _ = _G.aegisub.text_extents(line.styleref, c) lmaxwidth = math.max(lmaxwidth, w) end left = math.floor(line.center - lmaxwidth/2 + 0.5)
  3. Comment: 0,0:00:00.00,0:00:00.00,Default,,0,0,0,template line noblank keeptags,{\an1\pos(!left!,$bottom)}
复制代码
MingYSub 译制的字幕作品(GitHub 仓库),若无特别标注,均基于 CC BY-NC-SA 4.0 协议共享,转载时请遵守共享协议。
回复

使用道具 举报

12
返回列表 发新帖
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表