summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/chickenize
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-05-28 22:28:21 +0000
committerKarl Berry <karl@freefriends.org>2012-05-28 22:28:21 +0000
commit38055ecf761273ee9824bdf3fc588a16d58b9987 (patch)
tree88ca8aaba2261e72b64f3288ee0e04dbd10025a7 /Master/texmf-dist/tex/luatex/chickenize
parent65711d244a945c9cedc95c63a1e7097daf60bc20 (diff)
chickenize (29may12)
git-svn-id: svn://tug.org/texlive/trunk@26702 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/chickenize')
-rw-r--r--Master/texmf-dist/tex/luatex/chickenize/chickenize.lua36
-rw-r--r--Master/texmf-dist/tex/luatex/chickenize/chickenize.sty5
-rw-r--r--Master/texmf-dist/tex/luatex/chickenize/chickenize.tex23
3 files changed, 36 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua b/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua
index a331b6536f8..670ec02b2e5 100644
--- a/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua
+++ b/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua
@@ -8,11 +8,6 @@
--
-- EXPERIMENTAL CODE
--
--- Do not distribute this file without also distributing the
--- source files specified above.
---
--- Do not distribute a modified version of this file under the same name.
---
-- This package is copyright © 20012 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-
@@ -118,7 +113,7 @@ chickenize = function(head)
return head
end
-local separator = string.rep("=", 28)
+local separator = string.rep("=", 28)
local texiowrite_nl = texio.write_nl
nicetext = function()
texiowrite_nl("Output written on "..tex.jobname..".pdf ("..status.total_pages.." chicken,".." eggs).")
@@ -292,6 +287,19 @@ matrixize = function(head)
end
return head
end
+local separator = string.rep("=", 28)
+local texiowrite_nl = texio.write_nl
+pancaketext = function()
+ texiowrite_nl("Output written on "..tex.jobname..".pdf ("..status.total_pages.." chicken,".." eggs).")
+ texiowrite_nl(" ")
+ texiowrite_nl(separator)
+ texiowrite_nl("Soo ... you decided to use \\pancakenize.")
+ texiowrite_nl("That means you owe me a pancake!")
+ texiowrite_nl(" ")
+ texiowrite_nl("(This goes by document, not compilation.)")
+ texiowrite_nl(separator.."\n\n")
+ texiowrite_nl("Looking forward for my pancake! :)")
+end
local randomfontslower = 1
local randomfontsupper = 0
randomfonts = function(head)
@@ -397,7 +405,7 @@ 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.list) do
+ for n in nodetraverseid(nodeid"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))
@@ -407,14 +415,18 @@ tabularasa = function(head)
end
return head
end
+uppercasecolor_onlytext = false
+
uppercasecolor = function (head)
for line in nodetraverseid(Hhead,head) do
for upper in nodetraverseid(GLYPH,line.head) do
- if (((upper.char > 64) and (upper.char < 91)) or
- ((upper.char > 57424) and (upper.char < 57451))) then -- for small caps! nice ☺
- color_push.data = randomcolorstring() -- color or grey string
- line.head = nodeinsertbefore(line.head,upper,nodecopy(color_push))
- nodeinsertafter(line.head,upper,nodecopy(color_pop))
+ if not(uppercasecolor_onlytext) or node.has_attribute(upper,luatexbase.attributes.uppercasecolorattr) then
+ if (((upper.char > 64) and (upper.char < 91)) or
+ ((upper.char > 57424) and (upper.char < 57451))) then -- for small caps! nice ☺
+ color_push.data = randomcolorstring() -- color or grey string
+ line.head = nodeinsertbefore(line.head,upper,nodecopy(color_push))
+ nodeinsertafter(line.head,upper,nodecopy(color_pop))
+ end
end
end
end
diff --git a/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty b/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty
index 60d18dff98f..18ef07d7c50 100644
--- a/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty
+++ b/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty
@@ -8,11 +8,6 @@
%%
%% EXPERIMENTAL CODE
%%
-%% Do not distribute this file without also distributing the
-%% source files specified above.
-%%
-%% Do not distribute a modified version of this file under the same name.
-%%
%% This package is copyright © 20012 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-
diff --git a/Master/texmf-dist/tex/luatex/chickenize/chickenize.tex b/Master/texmf-dist/tex/luatex/chickenize/chickenize.tex
index a6304f359f8..d47e345380c 100644
--- a/Master/texmf-dist/tex/luatex/chickenize/chickenize.tex
+++ b/Master/texmf-dist/tex/luatex/chickenize/chickenize.tex
@@ -8,17 +8,12 @@
%%
%% EXPERIMENTAL CODE
%%
-%% Do not distribute this file without also distributing the
-%% source files specified above.
-%%
-%% Do not distribute a modified version of this file under the same name.
-%%
%% This package is copyright © 20012 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 ‘author-maintained’.
\input{luatexbase.sty}
-\directlua{dofile("chickenize.lua")}
+\directlua{dofile(kpse.find_file("chickenize.lua"))}
\def\chickenize{
\directlua{luatexbase.add_to_callback("pre_linebreak_filter",chickenize,"chickenize")
@@ -128,15 +123,13 @@
\def\unmatrixize{
\directlua{luatexbase.remove_from_callback("pre_linebreak_filter",matrixize)}}
-\def\milkcow{ %% to be implemented
+\def\milkcow{ %% FIXME %% to be implemented
\directlua{}}
\def\unmilkcow{
\directlua{}}
-\def\pancakenize{ %% to be implemented
- \directlua{}}
-\def\unpancakenize{
- \directlua{}}
+\def\pancakenize{
+ \directlua{luatexbase.add_to_callback("stop_run",pancaketext,"pancaketext")}}
\def\rainbowcolor{
\directlua{luatexbase.add_to_callback("post_linebreak_filter",randomcolor,"rainbowcolor")
@@ -152,6 +145,11 @@
\def\unrandomcolor{
\directlua{luatexbase.remove_from_callback("post_linebreak_filter","randomcolor")}}
+\def\randomerror{ %% FIXME
+ \directlua{luatexbase.add_to_callback("post_linebreak_filter",randomcolor,"randomcolor")}}
+\def\unrandomerror{ %% FIXME
+ \directlua{luatexbase.remove_from_callback("post_linebreak_filter","randomcolor")}}
+
\def\randomfonts{
\directlua{luatexbase.add_to_callback("post_linebreak_filter",randomfonts,"randomfonts")}}
\def\unrandomfonts{
@@ -191,6 +189,7 @@
\newluatexattribute\randfontsattr
\newluatexattribute\randuclcattr
\newluatexattribute\tabularasaattr
+\newluatexattribute\uppercasecolorattr
\long\def\textleetspeak#1%
{\setluatexattribute\leetattr{42}#1\unsetluatexattribute\leetattr}
@@ -204,6 +203,8 @@
{\setluatexattribute\randuclcattr{42}#1\unsetluatexattribute\randuclcattr}
\long\def\texttabularasa#1%
{\setluatexattribute\tabularasaattr{42}#1\unsetluatexattribute\tabularasaattr}
+\long\def\textuppercasecolor#1%
+ {\setluatexattribute\uppercasecolorattr{42}#1\unsetluatexattribute\uppercasecolorattr}
\def\chickenizesetup#1{\directlua{#1}}
\long\def\luadraw#1#2{%
\vbox to #1bp{%