Skip to content

Instantly share code, notes, and snippets.

@wrtlprnft
Last active May 7, 2016
Embed
What would you like to do?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="45mm"
height="10mm"
viewBox="0 0 159.44882 35.433071"
id="svg3338"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="snake.svg">
<defs
id="defs3340" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="16"
inkscape:cx="80.024171"
inkscape:cy="16.379713"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
showguides="true"
inkscape:guide-bbox="true"
inkscape:object-nodes="true"
inkscape:snap-smooth-nodes="true"
inkscape:snap-global="false"
inkscape:window-width="3834"
inkscape:window-height="2123"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1">
<sodipodi:guide
position="41.41272,4.2543626"
orientation="0,1"
id="guide3346" />
<sodipodi:guide
position="40.227961,14.432521"
orientation="0,1"
id="guide3348" />
<sodipodi:guide
position="35.433071,24.447105"
orientation="1,0"
id="guide3350"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="53.149607,32.796289"
orientation="1,0"
id="guide3352"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="106.29921,43.8125"
orientation="1,0"
id="guide4274"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
</sodipodi:namedview>
<metadata
id="metadata3343">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1016.9291)">
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 106.29921,1048.1078 c -8.045094,10e-5 -17.004321,-1.9935 -25.887911,-2.0108 -8.88359,-0.017 -19.752978,2.0108 -27.261692,2.0108 l -17.716536,0 c -6.913259,0 -12.953414,-0.6388 -17.553977,-4.0928 -4.600563,-3.454 -4.949947,-11.4365 -8.0779042,-14.3787 -3.1279569,-2.9422 -7.1624079,-1.9866 -7.1624079,-4.2005 0,-2.2138 4.8465554,-1.9925 7.1624079,-1.9925 2.3158522,0 6.4672332,1.968 8.3471672,7.1623 1.879934,5.1944 9.26141,7.3241 17.284714,7.3241 l 17.716536,0 c 4.02526,-10e-5 18.324321,-2.5171 27.221602,-2.4969 8.89728,0.02 16.990089,2.4969 25.928001,2.4969 8.93791,0 15.99725,-5.0289 15.99725,-9.2627 0,-4.2338 4.55954,-9.0473 8.83184,-9.0473 4.2723,0 13.24776,4.3002 13.24776,8.3472 0,4.047 -2.84549,3.5004 -6.89314,3.5004 -4.04765,0 -6.37646,1.2215 -8.36941,6.4624 -1.99296,5.2408 -14.76921,10.178 -22.8143,10.1781 z"
id="path3354"
inkscape:connector-curvature="0"
sodipodi:nodetypes="zzsszzzzzsszzzzzzzz" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 144.59145,1029.4209 c 3.4859,0 3.45066,4.4284 5.92379,5.116"
id="path3362"
inkscape:connector-curvature="0" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.49960631;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 150.56603,1034.3025 c 2.47313,0.6876 4.30392,-0.9453 6.75976,-0.9453"
id="path3358"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
id="path4166"
d="m 150.47766,1034.7918 c 2.47313,0.6876 4.21261,-0.3875 6.66845,-0.3875"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.49960631;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<ellipse
style="fill:#000000;stroke:none;stroke-width:0.49960631;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none"
id="path4168"
cx="135.27458"
cy="1024.6434"
rx="1.5625"
ry="2.59375" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 122.29643,1028.667 2.29065,7.0639 -7.20018,-0.1622 c 2.13738,-1.8366 4.40734,-4.5349 4.90953,-6.9017 z"
id="path4170"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4172"
d="m 114.78625,1036.2724 -2.79418,6.8802 -5.40562,-4.7589 c 2.81789,-0.03 6.29195,-0.6334 8.1998,-2.1213 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 52.922245,1037.6395 -4.073343,6.2091 -4.382011,-5.7154 z"
id="path4174"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4176"
d="m 33.600716,1037.9659 -5.415571,5.0811 -2.919854,-6.5835 c 2.572164,1.1512 5.980163,2.0561 8.335425,1.5024 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4178"
d="m 43.972924,1037.4406 -4.073343,6.2091 -4.382011,-5.7154 c 2.770388,0.5161 6.295542,0.5967 8.455354,-0.4937 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 22.126185,1035.2468 -4.843558,0.4752 1.114175,-4.5865 c 0.876022,1.6258 2.284685,3.4578 3.729383,4.1113 z"
id="path4180"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4182"
d="m 16.270456,1027.6697 -3.804995,0.3734 0.875272,-3.6031 c 0.906197,0.7322 2.373745,1.269 2.929723,3.2297 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4276"
d="m 62.840174,1036.8173 -3.57876,6.5066 -4.812707,-5.3579 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 73.004834,1035.7566 -3.57876,6.5066 -4.812707,-5.3579 z"
id="path4278"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4280"
d="m 82.660288,1035.3442 -4.077757,6.2061 -4.377931,-5.7187 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 94.191733,1037.0318 -5.54665,4.9375 -2.746516,-6.6578 z"
id="path4282"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path4284"
d="m 104.98167,1038.0271 -4.82018,5.6489 -3.63025,-6.2202 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</svg>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
\documentclass{article}
%\usepackage{luatextra}
\usepackage[text={1.2in,3in}]{geometry}
\usepackage[none]{hyphenat}
\directlua{
PDF_LITERAL = node.subtype("pdf_literal")
WS = node.id("whatsit")
GLUE = node.id("glue")
add_image = function(line, n, width, height, name)
local sni = img.node{filename=name}
sni.height = height
sni.width = width
return node.insert_before(line,n,sni)
end
add_snake = function(line, n, width, height)
local segments_middle = 0;
local segments_wave = 0;
local unstretched_width = height * (1.0 + 1.5)
while unstretched_width + height * 1.5 < width do
unstretched_width = unstretched_width + height * 1.5
segments_wave = segments_wave + 1
end
while unstretched_width + height * 0.5 < width do
unstretched_width = unstretched_width + height * 0.5
segments_middle = segments_middle + 1
end
local stretch = width / unstretched_width
line = add_image(line, n, height * 1.0 * stretch, height, "snake_tail.pdf")
for i = 1, segments_wave do
line = add_image(line, n, height * 1.5 * stretch, height, "snake_wave.pdf")
end
for i = 1, segments_middle do
line = add_image(line, n, height * 0.5 * stretch, height, "snake_middle.pdf")
end
line = add_image(line, n, height * 1.5 * stretch, height, "snake_head.pdf")
return line
end
local w = 1250000 % remove when effective_glue works!
snakefill = function(head)
for line in node.traverse_id(0,head) do
for n in node.traverse_id(GLUE,line.head) do
if n.subtype == 9 then
%local w = node.effective_glue(n,line) / 65536
w = w * 1.1 % remove when effective_glue works!
local h = 500000
line = add_snake(line, n, w, 500000)
end
end
end
return head
end
}
\def\snakefill{%
\directlua{
luatexbase.add_to_callback("post_linebreak_filter",snakefill,"snake fill")
}%
}
\def\offsnakefill{%
\directlua{
luatexbase.remove_from_callback("post_linebreak_filter","snake fill")
}%
}
\begin{document}
\raggedright
\snakefill
\noindent Their famous paper on the relationship between deindustrialization and the growth of ecological\ldots\par
\noindent Their famous paper on the relationship between deindustrialization and the growth of ecological\ldots\par
\noindent Their famous paper on the relationship between deindustrialization and the growth of ecological\ldots\par
\end{document}
@nanmu42
Copy link

nanmu42 commented May 7, 2016

Lovely work, bro!

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment