https://sizu.me/oov/posts/dvf5wcma2tn6PSDToolKit v0.2beta65より精度の良い「テキストの自動折り返し」が標準実装されました
local cache=1 -- 1でキャッシュ有効
local maxw=obj.screen_w*0.95
subobj=require("PSDToolKit").subtitle:getlive(layer,obj)
if not subobj.notfound then if 0<=#subobj.text then
local txt,stxt="",subobj.text
local n,z=0,100/obj.getvalue("zoom")
repeat
n=n+1
obj.load("text",string.sub(stxt,1,#stxt/n))
until obj.w*z+1<obj.getinfo("image_max") or z == math.huge
n=math.ceil(n*obj.w*z/maxw)
if n<=1 or string.find(stxt,"\n")<#stxt or string.find(stxt,"<[#srcwp]%x")~=nil then
txt=stxt
else
local nl,i,sp=1,1,1
while i<=#stxt do
local c=string.byte(stxt,i)
i=i+1
if 0x81<=c and c<=0x9f or 0xe0<=c and c<=0xfc then i=i+1 end
if n*i>=nl*#stxt then
txt=txt..string.sub(stxt,sp,i-1).."\n"
sp=i
nl=nl+1
end
end
end
require("CacheText").rawmes(txt,cache)
end end
?>