Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 'clip to fax/frz' functions to account for float numbers #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions ua.NecrosCopy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function fucks(subs,sel)
t=l.text

if not t:match("\\i?clip%(m") and not t:match("//i?clip%(m") then t_error("Missing \\clip on line #"..i-line0..".",1) end
cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4=t:match("clip%(m ([%d%-]+) ([%d%-]+) l ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+)")
if not cx1 then cx1,cy1,cx2,cy2=t:match("clip%(m ([%d%-]+) ([%d%-]+) l ([%d%-]+) ([%d%-]+)") end
cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4=t:match("clip%(m ([%d%-%.]+) ([%d%-%.]+) l ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+)")
if not cx1 then cx1,cy1,cx2,cy2=t:match("clip%(m ([%d%-%.]+) ([%d%-%.]+) l ([%d%-%.]+) ([%d%-%.]+)") end
if not cx1 then t_error("Line #"..i-line0..": Not enough clip points. 2 required.",1) end
sr=stylechk(subs,l.style)
nontra=t:gsub("\\t%b()","")
Expand Down Expand Up @@ -79,8 +79,8 @@ function frozt(subs,sel)
local l=subs[i]
local text=l.text
if not text:match("\\i?clip%(m") and not text:match("//i?clip%(m") then t_error("Missing \\clip on line #"..i-line0..".\nAborting.",1) end
cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4=text:match("clip%(m ([%d%-]+) ([%d%-]+) l ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+)")
if not cx1 then cx1,cy1,cx2,cy2=text:match("clip%(m ([%d%-]+) ([%d%-]+) l ([%d%-]+) ([%d%-]+)") end
cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4=text:match("clip%(m ([%d%-%.]+) ([%d%-%.]+) l ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+)")
if not cx1 then cx1,cy1,cx2,cy2=text:match("clip%(m ([%d%-%.]+) ([%d%-%.]+) l ([%d%-%.]+) ([%d%-%.]+)") end
if not cx1 then t_error("Line #"..i-line0..": Not enough clip points. 2 required.",1) end
local ad,op,tang,ang1,rota
ad=cx2-cx1
Expand Down Expand Up @@ -410,8 +410,8 @@ function shad3(subs,sel)
text2=addtag3('\\1a&HFE&',text2)
txt=text2 if l==1 then txt=text end
line2.text=txt
:gsub("\\xshad([%d%.%-]+)",function(a) xx=tostring(f*a) xx=xx:gsub("([%d%-]+%.%d%d)%d+","%1") return "\\xshad"..xx end)
:gsub("\\yshad([%d%.%-]+)",function(a) yy=tostring(f*a) yy=yy:gsub("([%d%-]+%.%d%d)%d+","%1") return "\\yshad"..yy end)
:gsub("\\xshad([%d%.%-]+)",function(a) xx=tostring(f*a) xx=xx:gsub("([%d%-%.]+%.%d%d)%d+","%1") return "\\xshad"..xx end)
:gsub("\\yshad([%d%.%-]+)",function(a) yy=tostring(f*a) yy=yy:gsub("([%d%-%.]+%.%d%d)%d+","%1") return "\\yshad"..yy end)
line2.layer=layer+(lay-l)
subs.insert(i+1,line2)
end
Expand Down