diff options
author | Karl Berry <karl@freefriends.org> | 2021-01-04 21:58:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-01-04 21:58:54 +0000 |
commit | b058ac8f1d027704faaa4b1302bd75ee2a8b20d8 (patch) | |
tree | 96fac34a21190e3ab5f2a45913cda2f45e99af14 /Master/texmf-dist/tex/luatex | |
parent | 2bdc5d138ea90b621713949e27f5db50f212a7d6 (diff) |
chickenize (4jan21)
git-svn-id: svn://tug.org/texlive/trunk@57325 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
3 files changed, 472 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua b/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua index c25aa75b75d..7e5a242b07b 100644 --- a/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua +++ b/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua @@ -8,7 +8,7 @@ -- -- EXPERIMENTAL CODE -- --- This package is copyright © 2017 Arno L. Trautmann. It may be distributed and/or +-- This package is copyright © 2021 Arno L. Trautmann. It may be distributed and/or -- modified under the conditions of the LaTeX Project Public License, either version 1.3c -- of this license or (at your option) any later version. This work has the LPPL mainten- -- ance status ‘maintained’. @@ -47,8 +47,8 @@ chicken_pagenumbers = true chickenstring = {} chickenstring[1] = "chicken" -- chickenstring is a table, please remeber this! -chickenizefraction = 0.5 --- set this to a small value to fool somebody, or to see if your text has been read carefully. This is also a great way to lay easter eggs for your own class / package … +chickenizefraction = 0.5 -- set this to a small value to fool somebody, +-- or to see if your text has been read carefully. This is also a great way to lay easter eggs for your own class / package … chicken_substitutions = 0 -- value to count the substituted chickens. Makes sense for testing your proofreaders. local match = unicode.utf8.match @@ -234,7 +234,7 @@ printglyphnumber = function() end countwords = function(head) for glyph in nodetraverseid(GLYPH,head) do - if (glyph.next.id == 10) then + if (glyph.next.id == GLUE) then wordnumber = wordnumber + 1 end end @@ -245,7 +245,7 @@ printwordnumber = function() texiowrite_nl("\nNumber of words in this document: "..wordnumber) end -function detectdoublewords(head) +detectdoublewords = function(head) prevlastword = {} -- array of numbers representing the glyphs prevfirstword = {} newlastword = {} @@ -260,9 +260,102 @@ texio.write_nl("nfw:"..#newfirstword) end end -function printdoublewords() +printdoublewords = function() texio.write_nl("finished") end +francize = function(head) + for n in nodetraverseid(GLYPH,head) do + if ((n.char > 47) and (n.char < 58)) then + n.char = math.random(48,57) + end + end + return head +end +function gameofchicken() + GOC_lifetab = {} + GOC_spawntab = {} + GOC_antilifetab = {} + GOC_antispawntab = {} + -- translate the rules into an easily-manageable table + for i=1,#GOCrule_live do; GOC_lifetab[GOCrule_live[i]] = true end + for i=1,#GOCrule_spawn do; GOC_spawntab[GOCrule_spawn[i]] = true end + for i=1,#GOCrule_antilive do; GOC_antilifetab[GOCrule_antilive[i]] = true end + for i=1,#GOCrule_antispawn do; GOC_antispawntab[GOCrule_antispawn[i]] = true end +-- initialize the arrays +local life = {} +local antilife = {} +local newlife = {} +local newantilife = {} +for i = 0, GOCx do life[i] = {}; newlife[i] = {} for j = 0, GOCy do life[i][j] = 0 end end +for i = 0, GOCx do antilife[i] = {}; newantilife[i] = {} for j = 0, GOCy do antilife[i][j] = 0 end end +function applyruleslife(neighbors, lifeij, antineighbors, antilifeij) + if GOC_spawntab[neighbors] then myret = 1 else -- new cell + if GOC_lifetab[neighbors] and (lifeij == 1) then myret = 1 else myret = 0 end end + if antineighbors > 1 then myret = 0 end + return myret +end +function applyrulesantilife(neighbors, lifeij, antineighbors, antilifeij) + if (antineighbors == 3) then myret = 1 else -- new cell or keep cell + if (((antineighbors > 1) and (antineighbors < 4)) and (lifeij == 1)) then myret = 1 else myret = 0 end end + if neighbors > 1 then myret = 0 end + return myret +end +-- prepare some special patterns as starter +life[53][26] = 1 life[53][25] = 1 life[54][25] = 1 life[55][25] = 1 life[54][24] = 1 + print("start"); + for i = 1,GOCx do + for j = 1,GOCy do + if (life[i][j]==1) then texio.write("X") else if (antilife[i][j]==1) then texio.write("O") else texio.write("_") end end + end + texio.write_nl(" "); + end + os.sleep(GOCsleep) + + for i = 0, GOCx do + for j = 0, GOCy do + newlife[i][j] = 0 -- Fill the values from the start settings here + newantilife[i][j] = 0 -- Fill the values from the start settings here + end + end + + for k = 1,GOCiter do -- iterate over the cycles + texio.write_nl(k); + for i = 1, GOCx-1 do -- iterate over lines + for j = 1, GOCy-1 do -- iterate over columns -- prevent edge effects + local neighbors = (life[i-1][j-1] + life[i-1][j] + life[i-1][j+1] + life[i][j-1] + life[i][j+1] + life[i+1][j-1] + life[i+1][j] + life[i+1][j+1]) + local antineighbors = (antilife[i-1][j-1] + antilife[i-1][j] + antilife[i-1][j+1] + antilife[i][j-1] + antilife[i][j+1] + antilife[i+1][j-1] + antilife[i+1][j] + antilife[i+1][j+1]) + + newlife[i][j] = applyruleslife(neighbors, life[i][j],antineighbors, antilife[i][j]) + newantilife[i][j] = applyrulesantilife(neighbors,life[i][j], antineighbors,antilife[i][j]) + end + end + + for i = 1, GOCx do + for j = 1, GOCy do + life[i][j] = newlife[i][j] -- copy the values + antilife[i][j] = newantilife[i][j] -- copy the values + end + end + + for i = 1,GOCx do + for j = 1,GOCy do + if GOC_console then + if (life[i][j]==1) then texio.write("X") else if (antilife[i][j]==1) then texio.write("O") else texio.write("_") end end + end + if GOC_pdf then + if (life[i][j]==1) then tex.print("\\placeat("..(i/10)..","..(j/10).."){"..GOCcellcode.."}") end + if (antilife[i][j]==1) then tex.print("\\placeat("..(i/10)..","..(j/10).."){"..GOCanticellcode.."}") end + end + end + end + tex.print(".\\newpage") + os.sleep(GOCsleep) + end +end --end function gameofchicken +function make_a_gif() + os.execute("convert -verbose -dispose previous -background white -alpha remove -alpha off -density "..GOCdensity.." "..tex.jobname ..".pdf " ..tex.jobname..".gif") + os.execute("gwenview "..tex.jobname..".gif") +end local quotestrings = { [171] = true, [172] = true, [8216] = true, [8217] = true, [8218] = true, @@ -271,7 +364,7 @@ local quotestrings = { [8248] = true, [8249] = true, [8250] = true, } guttenbergenize_rq = function(head) - for n in nodetraverseid(nodeid"glyph",head) do + for n in nodetraverseid(GLYPH,head) do local i = n.char if quotestrings[i] then noderemove(head,n) @@ -301,6 +394,115 @@ hammertime = function(head) end return head end +italianizefraction = 0.5 --%% gives the amount of italianization +mynode = nodenew(GLYPH) -- prepare a dummy glyph + +italianize = function(head) + -- skip "h/H" randomly + for n in node.traverse_id(GLYPH,head) do -- go through all glyphs + if n.prev.id ~= GLYPH then -- check if it's a word start + if ((n.char == 72) or (n.char == 104)) and (tex.normal_rand() < italianizefraction) then -- if it's h/H, remove randomly + n.prev.next = n.next + end + end + end + + -- add h or H in front of vowels + for n in nodetraverseid(GLYPH,head) do + if math.random() < italianizefraction then + x = n.char + if x == 97 or x == 101 or x == 105 or x == 111 or x == 117 or + x == 65 or x == 69 or x == 73 or x == 79 or x == 85 then + if (n.prev.id == GLUE) then + mynode.font = n.font + if x > 90 then -- lower case + mynode.char = 104 + else + mynode.char = 72 -- upper case – convert into lower case + n.char = x + 32 + end + node.insert_before(head,n,node.copy(mynode)) + end + end + end + end + + -- add e after words, but only after consonants + for n in node.traverse_id(GLUE,head) do + if n.prev.id == GLYPH then + x = n.prev.char + -- skip vowels and randomize + if not(x == 97 or x == 101 or x == 105 or x == 111 or x == 117 or x == 44 or x == 46) and math.random() > 0.2 then + mynode.char = 101 -- it's always a lower case e, no? + mynode.font = n.prev.font -- adapt the current font + node.insert_before(head,n,node.copy(mynode)) -- insert the e in the node list + end + end + end + + return head +end +italianizerandwords = function(head) +words = {} +wordnumber = 0 +-- head.next.next is the very first word. However, let's try to get the first word after the first space correct. + for n in nodetraverseid(GLUE,head) do -- let's try to count words by their separators + wordnumber = wordnumber + 1 + if n.next then + words[wordnumber] = {} + words[wordnumber][1] = node.copy(n.next) + + glyphnumber = 1 + myglyph = n.next + while myglyph.next do + node.tail(words[wordnumber][1]).next = node.copy(myglyph.next) + myglyph = myglyph.next + end + end + print(#words) + if #words > 0 then + print("lengs is: ") + print(#words[#words]) + end + end +--myinsertnode = head.next.next -- first letter +--node.tail(words[1][1]).next = myinsertnode.next +--myinsertnode.next = words[1][1] + + return head +end + +italianize_old = function(head) + local wordlist = {} -- here we will store the number of words of the sentence. + local words = {} -- here we will store the words of the sentence. + local wordnumber = 0 + -- let's first count all words in one sentence, howboutdat? + wordlist[wordnumber] = 1 -- let's save the word *length* in here … + + for n in nodetraverseid(GLYPH,head) do + if (n.next.id == GLUE) then -- this is a space + wordnumber = wordnumber + 1 + wordlist[wordnumber] = 1 + words[wordnumber] = n.next.next + end + if (n.next.id == GLYPH) then -- it's a glyph + if (n.next.char == 46) then -- this is a full stop. + wordnumber = wordnumber + 1 + texio.write_nl("this sentence had "..wordnumber.."words.") + for i=0,wordnumber-1 do + texio.write_nl("word "..i.." had " .. wordlist[i] .. "glyphs") + end + texio.write_nl(" ") + wordnumber = -1 -- to compensate the fact that the next node will be a space, this would count one word too much. + else + + wordlist[wordnumber] = wordlist[wordnumber] + 1 -- the current word got 1 glyph longer + end + end + end + return head +end + itsame = function() local mr = function(a,b) rectangle({a*10,b*-10},10,10) end color = "1 .6 0" @@ -396,15 +598,15 @@ leftsideright = function(head) end return head end -local letterspace_glue = nodenew(nodeid"glue") -local letterspace_pen = nodenew(nodeid"penalty") +local letterspace_glue = nodenew(GLUE) +local letterspace_pen = nodenew(PENALTY) letterspace_glue.width = tex.sp"0pt" letterspace_glue.stretch = tex.sp"0.5pt" letterspace_pen.penalty = 10000 letterspaceadjust = function(head) - for glyph in nodetraverseid(nodeid"glyph", head) do - if glyph.prev and (glyph.prev.id == nodeid"glyph" or glyph.prev.id == nodeid"disc" or glyph.prev.id == nodeid"kern") then + for glyph in nodetraverseid(GLYPH, head) do + if glyph.prev and (glyph.prev.id == GLYPH or glyph.prev.id == DISC or glyph.prev.id == KERN) then local g = nodecopy(letterspace_glue) nodeinsertbefore(head, glyph, g) nodeinsertbefore(head, g, nodecopy(letterspace_pen)) @@ -413,9 +615,9 @@ letterspaceadjust = function(head) return head end textletterspaceadjust = function(head) - for glyph in nodetraverseid(nodeid"glyph", head) do + for glyph in nodetraverseid(GLYPH, head) do if node.has_attribute(glyph,luatexbase.attributes.letterspaceadjustattr) then - if glyph.prev and (glyph.prev.id == node.id"glyph" or glyph.prev.id == node.id"disc" or glyph.prev.id == nodeid"kern") then + if glyph.prev and (glyph.prev.id == node.id"glyph" or glyph.prev.id == node.id"disc" or glyph.prev.id == KERN) then local g = node.copy(letterspace_glue) nodeinsertbefore(head, glyph, g) nodeinsertbefore(head, g, nodecopy(letterspace_pen)) @@ -427,8 +629,8 @@ textletterspaceadjust = function(head) end matrixize = function(head) x = {} - s = nodenew(nodeid"disc") - for n in nodetraverseid(nodeid"glyph",head) do + s = nodenew(DISC) + for n in nodetraverseid(GLYPH,head) do j = n.char for m = 0,7 do -- stay ASCII for now x[7-m] = nodecopy(n) -- to get the same font etc. @@ -602,6 +804,59 @@ randomcolor = function(head) end return head end + sailheight = 12 + mastheight = 4 + hullheight = 5 + relnumber = 402 +function relationship() +--%% check if there's a problem with any character in the current font + f = font.getfont(font.current()) + fullfont = 1 + for i = 8756,8842 do + if not(f.characters[i]) then texio.write_nl((i).." not available") fullfont = 0 end + end +--%% store the result of the check for later, then go on to construct the ship: + shipheight = sailheight + mastheight + hullheight + tex.print("\\parshape "..(shipheight)) --%% prepare the paragraph shape ... + for i =1,sailheight do + tex.print(" "..(4.5-i/3.8).."cm "..((i-0.5)/2.5).."cm ") + end + for i =1,mastheight do + tex.print(" "..(3.2).."cm "..(1).."cm ") + end + for i =1,hullheight do + tex.print(" "..((i-1)/2).."cm "..(10-i).."cm ") + end + tex.print("\\noindent") --%% ... up to here, then insert relations + for i=1,relnumber do + tex.print("\\ \\char"..math.random(8756,8842)) + end + tex.print("\\break") +end +function cutparagraph(head) + local parsum = 0 + for n in nodetraverseid(HLIST,head) do + parsum = parsum + 1 + if parsum > shipheight then + node.remove(head,n) + end + end + return head +end +function missingcharstext() + if (fullfont == 0) then + local separator = string.rep("=", 28) +local texiowrite_nl = texio.write_nl + texiowrite_nl("Output written on "..tex.jobname..".pdf ("..status.total_pages.." chicken,".." eggs).") + texiowrite_nl(" ") + texiowrite_nl(separator) + texiowrite_nl("CAREFUL!!") + texiowrite_nl("\\relationship needs special characters (unicode points 8756 to 8842)") + texiowrite_nl("Your font does not support all of them!") + texiowrite_nl("consider using another one, e.g. the XITS font supplied with TeXlive.") + texiowrite_nl(separator .. "\n") + end +end substitutewords_strings = {} addtosubstitutions = function(input,output) @@ -631,9 +886,9 @@ end tabularasa_onlytext = false tabularasa = function(head) - local s = nodenew(nodeid"kern") - for line in nodetraverseid(nodeid"hlist",head) do - for n in nodetraverseid(nodeid"glyph",line.head) do + local s = nodenew(KERN) + for line in nodetraverseid(HLIST,head) do + for n in nodetraverseid(GLYPH,line.head) do if not(tabularasa_onlytext) or node.has_attribute(n,luatexbase.attributes.tabularasaattr) then s.kern = n.width nodeinsertafter(line.list,n,nodecopy(s)) @@ -644,7 +899,7 @@ tabularasa = function(head) return head end tanjanize = function(head) - local s = nodenew(nodeid"kern") + local s = nodenew(KERN) local m = nodenew(GLYPH,1) local use_letter_i = true scale = nodenew(WHAT,PDF_LITERAL) @@ -652,8 +907,8 @@ tanjanize = function(head) scale.data = "0.5 0 0 0.5 0 0 cm" scale2.data = "2 0 0 2 0 0 cm" - for line in nodetraverseid(nodeid"hlist",head) do - for n in nodetraverseid(nodeid"glyph",line.head) do + for line in nodetraverseid(HLIST,head) do + for n in nodetraverseid(GLYPH,line.head) do mimicount = 0 tmpwidth = 0 while ((n.next.id == GLYPH) or (n.next.id == 11) or (n.next.id == 7) or (n.next.id == 0)) do --find end of a word @@ -731,11 +986,18 @@ colorstretch = function (head) local rule_bad = nodenew(RULE) if colorexpansion then -- if also the font expansion should be shown +--%% here use first_glyph function!! local g = line.head +n = node.first_glyph(line.head.next) +texio.write_nl(line.head.id) +texio.write_nl(line.head.next.id) +texio.write_nl(line.head.next.next.id) +texio.write_nl(n.id) while not(g.id == GLYPH) and (g.next) do g = g.next end -- find first glyph on line. If line is empty, no glyph: if (g.id == GLYPH) then -- read width only if g is a glyph! - exp_factor = g.width / f[g.char].width - exp_color = colorstretch_coloroffset + (1-exp_factor)*10 .. " g" + exp_factor = g.expansion_factor/10000 --%% neato, luatex now directly gives me this!! + exp_color = colorstretch_coloroffset + (exp_factor*0.1) .. " g" +texio.write_nl(exp_factor) rule_bad.width = 0.5*line.width -- we need two rules on each line! end else @@ -823,10 +1085,10 @@ substlist[1512] = 64295 substlist[1514] = 64296 function variantjustification(head) math.randomseed(1) - for line in nodetraverseid(nodeid"hhead",head) do + for line in nodetraverseid(Hhead,head) do if (line.glue_sign == 1 and line.glue_order == 0) then -- exclude the last line! substitutions_wide = {} -- we store all “expandable” letters of each line - for n in nodetraverseid(nodeid"glyph",line.head) do + for n in nodetraverseid(GLYPH,line.head) do if (substlist[n.char]) then substitutions_wide[#substitutions_wide+1] = n end @@ -854,12 +1116,12 @@ zebracolorarray_bg[1] = "0.9 g" zebracolorarray_bg[2] = "0.1 g" function zebranize(head) zebracolor = 1 - for line in nodetraverseid(nodeid"hhead",head) do + for line in nodetraverseid(Hhead,head) do if zebracolor == #zebracolorarray then zebracolor = 0 end zebracolor = zebracolor + 1 color_push.data = zebracolorarray[zebracolor] line.head = nodeinsertbefore(line.head,line.head,nodecopy(color_push)) - for n in nodetraverseid(nodeid"glyph",line.head) do + for n in nodetraverseid(GLYPH,line.head) do if n.next then else nodeinsertafter(line.head,n,nodecopy(color_pull)) end @@ -889,24 +1151,39 @@ function pdf_print (...) pdf.print("\n") end -function move (p) - pdf_print(p[1],p[2],"m") +function move (p1,p2) + if (p2) then + pdf_print(p1,p2,"m") + else + pdf_print(p1[1],p1[2],"m") + end end -function line (p) - pdf_print(p[1],p[2],"l") +function line(p1,p2) + if (p2) then + pdf_print(p1,p2,"l") + else + pdf_print(p1[1],p1[2],"l") + end end -function curve(p1,p2,p3) +function curve(p11,p12,p21,p22,p31,p32) + if (p22) then + p1,p2,p3 = {p11,p12},{p21,p22},{p31,p32} + else + p1,p2,p3 = p11,p12,p21 + end pdf_print(p1[1], p1[2], - p2[1], p2[2], - p3[1], p3[2], "c") + p2[1], p2[2], + p3[1], p3[2], "c") end function close () pdf_print("h") end +drawwidth = 1 + function linewidth (w) pdf_print(w,"w") end @@ -930,9 +1207,12 @@ function strictcircle(center,radius) stroke() end +sloppynessh = 5 +sloppynessv = 5 + function disturb_point(point) - return {point[1] + math.random()*5 - 2.5, - point[2] + math.random()*5 - 2.5} + return {point[1] + (math.random() - 1/2)*sloppynessh, + point[2] + (math.random() - 1/2)*sloppynessv} end function sloppycircle(center,radius) @@ -948,7 +1228,24 @@ function sloppycircle(center,radius) move (right) curve (rightbot, leftbot, left) curve (lefttop, righttop, right_end) - linewidth(math.random()+0.5) + linewidth(drawwidth*(math.random()+0.5)) + stroke() +end + +function sloppyellipsis(center,radiusx,radiusy) + local left = disturb_point({center[1] - radiusx, center[2]}) + local lefttop = disturb_point({left[1], left[2] + 1.45*radiusy}) + local leftbot = {lefttop[1], lefttop[2] - 2.9*radiusy} + local right = disturb_point({center[1] + radiusx, center[2]}) + local righttop = disturb_point({right[1], right[2] + 1.45*radiusy}) + local rightbot = disturb_point({right[1], right[2] - 1.45*radiusy}) + + local right_end = disturb_point(right) + + move (right) + curve (rightbot, leftbot, left) + curve (lefttop, righttop, right_end) + linewidth(drawwidth*(math.random()+0.5)) stroke() end @@ -958,7 +1255,7 @@ function sloppyline(start,stop) start = disturb_point(start) stop = disturb_point(stop) move(start) curve(start_line,stop_line,stop) - linewidth(math.random()+0.5) + linewidth(drawwidth*(math.random()+0.5)) stroke() end -- diff --git a/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty b/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty index 82e4b2129aa..c0b4f7895eb 100644 --- a/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty +++ b/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty @@ -8,14 +8,13 @@ %% %% EXPERIMENTAL CODE %% -%% This package is copyright © 2017 Arno L. Trautmann. It may be distributed and/or +%% This package is copyright © 2021 Arno L. Trautmann. It may be distributed and/or %% modified under the conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. This work has the LPPL mainten- %% ance status ‘maintained’. \ProvidesPackage{chickenize}% - [2017/08/19 v0.2.5 chickenize package] + [2021/01/03 v0.3 chickenize package] \input{chickenize} - \iffalse \DeclareDocumentCommand\includegraphics{O{}m}{ \fbox{Chicken} %% actually, I'd love to draw an MP graph showing a chicken … diff --git a/Master/texmf-dist/tex/luatex/chickenize/chickenize.tex b/Master/texmf-dist/tex/luatex/chickenize/chickenize.tex index aa48c984574..d1d211c572f 100644 --- a/Master/texmf-dist/tex/luatex/chickenize/chickenize.tex +++ b/Master/texmf-dist/tex/luatex/chickenize/chickenize.tex @@ -8,7 +8,7 @@ %% %% EXPERIMENTAL CODE %% -%% This package is copyright © 2017 Arno L. Trautmann. It may be distributed and/or +%% This package is copyright © 2021 Arno L. Trautmann. It may be distributed and/or %% modified under the conditions of the LaTeX Project Public License, either version 1.3c %% of this license or (at your option) any later version. This work has the LPPL mainten- %% ance status ‘maintained’. @@ -18,11 +18,10 @@ \bgroup% \fontspec{Latin Modern Sans}% A% - \kern-.4em \raisebox{.65ex}{\scalebox{0.3}{L}}% - \kern-.0em \raisebox{-0.98ex}{T}% + \kern-.375em \raisebox{.65ex}{\scalebox{0.3}{L}}% + \kern.03em \raisebox{-.99ex}{T}% \egroup% } - \def\allownumberincommands{ \catcode`\0=11 \catcode`\1=11 @@ -170,9 +169,37 @@ \textbackslash\textbackslash\textbackslash\textbackslash\textbackslash\textbackslash\textbackslash\textbackslash\textbackslash\textbackslash... the true name of Ba'al, the soul-eater} } +\def\francize{ + \directlua{luatexbase.add_to_callback("pre_linebreak_filter",francize,"francize")}} + +\def\unfrancize{ + \directlua{luatexbase.remove_from_callback("pre_linebreak_filter",francize)}} + \def\gameoflife{ Your Life Is Tetris. Stop Playing It Like Chess. } +\def\gameofchicken#1{\directlua{ +GOCrule_live = {2,3} +GOCrule_spawn = {3} +GOCrule_antilive = {2,3} +GOCrule_antispawn = {3} +GOCcellcode = "\\scalebox{0.03}{\\drawchicken}" +GOCcellcode = "\\scalebox{0.03}{\\drawcov}" +GOCx = 100 +GOCy = 100 +GOCiter = 150 +GOC_console = false +GOC_pdf = true +GOCsleep = 0 +GOCdensity = 100 +#1 +gameofchicken() + +if (GOCmakegif == true) then + luatexbase.add_to_callback("wrapup_run",make_a_gif,"makeagif") +end +}} +\let\gameofchimken\gameofchicken % yeah, that had to be. \def\guttenbergenize{ %% makes only sense when using LaTeX \AtBeginDocument{ @@ -208,6 +235,16 @@ \let\hendlnize\chickenize % homage to Hendl/Chicken \let\unhendlnize\unchickenize % may the soldering strength always be with him +\def\italianizerandwords{ + \directlua{luatexbase.add_to_callback("pre_linebreak_filter",italianizerandwords,"italianizerandwords")}} +\def\unitalianizerandwords{ + \directlua{luatexbase.remove_from_callback("pre_linebreak_filter","italianizerandwords")}} + +\def\italianize{ + \directlua{luatexbase.add_to_callback("pre_linebreak_filter",italianize,"italianize")}} +\def\unitalianize{ + \directlua{luatexbase.remove_from_callback("pre_linebreak_filter","italianize")}} + \def\kernmanipulate{ \directlua{luatexbase.add_to_callback("pre_linebreak_filter",kernmanipulate,"kernmanipulate")}} @@ -300,6 +337,13 @@ \def\unrandomuclc{ \directlua{luatexbase.remove_from_callback("pre_linebreak_filter","randomuclc")}} +\def\relationship{% + \directlua{luatexbase.add_to_callback("post_linebreak_filter",cutparagraph,"cut paragraph") + luatexbase.add_to_callback("stop_run",missingcharstext,"charsmissing") + relationship() + } +} + \let\rongorongonize\boustrophedoninverse \let\unrongorongonize\unboustrophedoninverse @@ -436,6 +480,93 @@ sloppyline(wing_front,wing_bottom) sloppyline(wing_back,wing_bottom) } } +\long\def\drawcov{ + \luadraw{90}{ + covbody = {200,50} + covbody_rad = 50 + + covcrown_rad = 5 + crownno = 13 + for i=1,crownno do + crownpos = {covbody[1]+1.4*covbody_rad*math.sin(2*math.pi/crownno*i),covbody[2]+1.4*covbody_rad*math.cos(2*math.pi/crownno*i)} + crownconnect = {covbody[1]+covbody_rad*math.sin(2*math.pi/crownno*i),covbody[2]+covbody_rad*math.cos(2*math.pi/crownno*i)} + sloppycircle(crownpos,covcrown_rad) + sloppyline(crownpos,crownconnect) + end + + covcrown_rad = 6 + crownno = 8 + for i=1,crownno do + crownpos = {covbody[1]+0.8*covbody_rad*math.sin(2*math.pi/crownno*i),covbody[2]+0.8*covbody_rad*math.cos(2*math.pi/crownno*i)} + crownconnect = {covbody[1]+0.5*covbody_rad*math.sin(2*math.pi/crownno*i),covbody[2]+0.5*covbody_rad*math.cos(2*math.pi/crownno*i)} + sloppycircle(crownpos,covcrown_rad) + sloppyline(crownpos,crownconnect) + end + + covcrown_rad = 8 + sloppycircle(covbody,covcrown_rad) + sloppycircle(covbody,covbody_rad) + sloppyline(covbody,covbody) + } +} +\long\def\drawhorse{ + \luadraw{90}{ + horsebod = {100,-40} + sloppyellipsis(horsebod,50,20) + horsehead = {20,0} + sloppyellipsis(horsehead,25,15) + sloppyline({35,-10},{50,-40}) + sloppyline({45,5},{80,-25}) + sloppyline({60,-50},{60,-90}) + sloppyline({70,-50},{70,-90}) + sloppyline({130,-50},{130,-90}) + sloppyline({140,-50},{140,-90}) + sloppyline({150,-40},{160,-60}) + sloppyline({150,-38},{160,-58}) + sloppyline({150,-42},{160,-62}) + sloppyline({-5,-10},{10,-5}) + sloppyellipsis({30,5},5,2) %% it's an eye, aye? + sloppyline({27,15},{34,25}) + sloppyline({34,25},{37,13}) + } +} +\long\def\drawfathorse{ + \luadraw{90}{ + horsebod = {100,-40} + sloppyellipsis(horsebod,50,40) + horsehead = {20,0} + sloppyellipsis(horsehead,25,15) + sloppyline({35,-10},{50,-40}) + sloppyline({45,5},{70,-15}) + sloppyline({60,-70},{60,-90}) + sloppyline({70,-70},{70,-90}) + sloppyline({130,-70},{130,-90}) + sloppyline({140,-70},{140,-90}) + sloppyline({150,-40},{160,-60}) + sloppyline({150,-38},{160,-58}) + sloppyline({150,-42},{160,-62}) + sloppyline({-5,-10},{10,-5}) + sloppyellipsis({30,5},5,2) %% it's an eye, aye? + sloppyline({27,15},{34,25}) + sloppyline({34,25},{37,13}) + } +} +\long\def\drawunicorn{ +\color{pink!90!black} + \drawhorse + \luadraw{0}{ + sloppyline({15,20},{15,50}) + sloppyline({15,50},{25,20}) + } +} +\long\def\drawfatunicorn{ +\color{pink!90!black} + \drawfathorse + \luadraw{0}{ + sloppyline({15,20},{15,50}) + sloppyline({15,50},{25,20}) + } +} %% %% %% End of file `chickenize.tex'. |