Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,42 @@
-- in some movie script
----------------------------------------
-- Wraps specified text into lines of specified width (in px), returns lines as list of strings
-- @param {string} str
-- @param {integer} pixelWidth
-- @param {propList} [style]
-- @return {list}
----------------------------------------
on hardWrapText (str, pixelWidth, style)
if voidP(style) then style = [:]
lines = []
-- create a new field member
m = new(#field)
m.text = str
m.rect = rect(0,0,pixelWidth,0)
-- assign style props (if not specified, defaults are used)
repeat with i = 1 to style.count
m.setProp(style.getPropAt(i), style[i])
end repeat
-- create an invisible temporary sprite
s = channel(1).makeScriptedSprite(m)
s.loc = point(0,0)
s.visible = false
_movie.updateStage()
-- get the wrapped lines
charPos = 0
repeat with y = 0 to s.height-1
n = s.pointToChar(point(pixelWidth-1, y))
if n<>charPos then
lines.add(str.char[charPos+1..n])
charPos = n
end if
end repeat
channel(1).removeScriptedSprite()
return lines
end

View file

@ -0,0 +1,12 @@
str = "Lorem ipsum dolor sit amet, consectetur adipisici elit, sed "&\
"eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim "&\
"veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi "&\
"consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu "&\
"fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in "&\
"culpa qui officia deserunt mollit anim id est laborum."
lines = hardWrapText(str, 320, [#font: "Arial", #fontSize:24])
repeat with l in lines
put l
end repeat