summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-08-23 22:23:28 +0000
committerKarl Berry <karl@freefriends.org>2013-08-23 22:23:28 +0000
commit36d1d77df4b427cbfe704728c105d21f7309501e (patch)
tree20f8d4389f0c7cef02c77710795ee565053267f2 /Master/texmf-dist
parentb44a7f20775186141f597af51da768dfdb3a65f1 (diff)
chickenize (23aug13)
git-svn-id: svn://tug.org/texlive/trunk@31505 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/luatex/chickenize/README2
-rw-r--r--Master/texmf-dist/doc/luatex/chickenize/chickenize.pdfbin173504 -> 172855 bytes
-rw-r--r--Master/texmf-dist/source/luatex/chickenize/chickenize.dtx116
-rw-r--r--Master/texmf-dist/tex/luatex/chickenize/chickenize.lua71
-rw-r--r--Master/texmf-dist/tex/luatex/chickenize/chickenize.sty4
-rw-r--r--Master/texmf-dist/tex/luatex/chickenize/chickenize.tex20
6 files changed, 159 insertions, 54 deletions
diff --git a/Master/texmf-dist/doc/luatex/chickenize/README b/Master/texmf-dist/doc/luatex/chickenize/README
index 04a6c635204..d31156506d3 100644
--- a/Master/texmf-dist/doc/luatex/chickenize/README
+++ b/Master/texmf-dist/doc/luatex/chickenize/README
@@ -6,7 +6,7 @@ To produce the package files, run lualatex on chickinize.dtx, wich should result
chickenize.sty (LaTeX user interface)
chickenize.lua (Lua package code) [does the actual work]
-You need an up-to-date TeX Live (2011 or 2012, if possible) to use this package. Maybe a full MiKTeX will do, too.
+You need an up-to-date TeX Live (2013) to use this package. Maybe a full MiKTeX will do, too.
For any comments or suggestions, contact me:
arno dot trautmann at gmx dot de
diff --git a/Master/texmf-dist/doc/luatex/chickenize/chickenize.pdf b/Master/texmf-dist/doc/luatex/chickenize/chickenize.pdf
index a9af82a86a0..984bbf81f3a 100644
--- a/Master/texmf-dist/doc/luatex/chickenize/chickenize.pdf
+++ b/Master/texmf-dist/doc/luatex/chickenize/chickenize.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/luatex/chickenize/chickenize.dtx b/Master/texmf-dist/source/luatex/chickenize/chickenize.dtx
index 63449b4a9d7..e1a127811cd 100644
--- a/Master/texmf-dist/source/luatex/chickenize/chickenize.dtx
+++ b/Master/texmf-dist/source/luatex/chickenize/chickenize.dtx
@@ -19,7 +19,7 @@ arno dot trautmann at gmx dot de
Hope you have fun with this package!
-This package is copyright © 2012 Arno L. Trautmann. It may be distributed and/or
+This package is copyright © 2013 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’.
@@ -37,7 +37,7 @@ ance status ‘maintained’.
EXPERIMENTAL CODE
-This package is copyright © 20012 Arno L. Trautmann. It may be distributed and/or
+This package is copyright © 2013 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’.
@@ -116,7 +116,7 @@ chickenize
\unrainbowcolor
-\centerline{v0.2}
+\centerline{v0.2.1a}
\centerline{\hspace*{2cm} Arno Trautmann}
\centerline{\href{mailto:arno.trautmann@gmx.de}{arno.trautmann@gmx.de}}
@@ -129,7 +129,7 @@ The documentation of this package is far from being well-readable, consistent or
For a better understanding of what's going on in the code of this package, there is a small \hyperlink{tutorial}{tutorial} below that explains shortly the most important features used here.
-\emph{Attention}: This package is under development and everything presented here might be subject to incompatible changes. If, by any reason, you decide to use this package for an important document, please make a local copy of the source code and use that. This package will not be considered stable until it reaches at least v0.5.
+\emph{Attention}: This package is under development and everything presented here might be subject to incompatible changes. If, by any reason, you decide to use this package for an important document, please make a local copy of the source code and use that. This package will not be considered stable until it reaches at least v0.5, which might never happen.
If you have any suggestions or comments, just drop me a mail, I’ll be happy to get any response! The latet source code is hosted on github: \url{https://github.com/alt/chickenize}. Feel free to comment or report bugs there, to fork, pull, etc.
@@ -137,7 +137,7 @@ If you have any suggestions or comments, just drop me a mail, I’ll be happy to
\small\noindent
\fbox{\parbox{.97\textwidth}{
-This package is copyright © 2012 Arno L. Trautmann. It may be distributed and/or
+This package is copyright © 2013 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 maintenance status ‘maintained’.}}
\vspace*{1cm}
@@ -163,6 +163,7 @@ A small and incomplete overview of the functionalities offered by this package.
\cmidrule(lr){1-2}
\hyperref[sec:boustrophedon]{boustrophedon} & invert every second line in the style of archaic greek texts\\
\hyperref[sec:countglyphs]{countglyphs} & counts the number of glyphs in the whole document\\
+\hyperref[sec:countwords]{countwords} & counts the number of words in the whole document\\
\hyperref[sec:leetspeak]{leetspeak} & translates the (latin-based) input into 1337 5p34k\\
\hyperref[sec:randomuclc]{randomuclc} & alternates randomly between uppercase and lowercase\\
\hyperref[sec:randomrainbowcolor]{rainbowcolor} & changes the color of letters slowly according to a rainbow\\
@@ -204,7 +205,7 @@ The effect of the commands can be influenced, not with arguments, but only via t
\begin{description}
\def\command#1{\item[\ttfamily \color{blue} \textbackslash#1]}
\command{boustrophedon} Reverts every second line. This immitates archaic greek writings where one line was right-to-left, the next one left-to-right etc.\footnote{\url{en.wikipedia.org/wiki/Boustrophedon}} Interestingly, also every glyph was adaptet to the writing direction, so all glyphs are inverted in the right-to-left lines. Actually, there are two versions of this command that differ in their implementation: |\boustrophedon| rotates the whole line, while |\boustrophedonglyphs| changes the writing direction and reverses glyph-wise. The second one takes much more compilation time, but may be more reliable. A Rongorongo\footnote{\url{en.wikipedia.org/wiki/Rongorongo}} similar style boustrophedon is available with |\boustrophedoninverse| or |\rongorongonize|, where subsequent lines are rotated by 180° instead of mirrored.
-\command{countglyphs} Counts every printed character that appeared in anything that is a paragraph. Which is quite everything, in fact, \emph{exept} math mode! The total number will be printed at the end of the log file/console output.
+\command{countglyphs} \textcolor{blue}{\texttt{\textbackslash countwords}} Counts every printed character (or word, respectively) that appeared in anything that is a paragraph. Which is quite everything, in fact, \emph{exept} math mode! The total number will be printed at the end of the log file/console output.
\command{chickenize} Replaces every word of the input with the word “chicken”. Maybe sometime the replacement will be made configurable, but up to now, it's only chicken. To be a bit less static, about every 10\textsuperscript{th} chicken is uppercase. However, the beginning of a sentence is not recognized automatically.\footnote{If you have a nice implementation idea, I'd love to include this!}
\command{colorstretch} Inspired by Paul Isambert's code, this command prints boxes instead of lines. The greyness of the first (left-hand) box corresponds to the badness of the line, i.\,e. it is a measure for how much the space between words has been extended to get proper paragraph justification. The second box on the right-hand side shows the amount of stretching/shrinking when font expansion is used. Together, the greyness of both boxes indicate how well the greyness is distributed over the typeset page.
\command{dubstepize} wub wub wub wub wub BROOOOOAR WOBBBWOBBWOBB BZZZRRRRRRROOOOOOAAAAA … (inspired by \url{http://www.youtube.com/watch?v=ZFQ5EpO7iHk} and \url{http://www.youtube.com/watch?v=nGxpSsbodnw})
@@ -437,15 +438,29 @@ The namespace of the chickenize package is \emph{not} consistent. Please don't t
\directlua{luatexbase.remove_from_callback("post_linebreak_filter","stretch_expansion")}}
\def\countglyphs{
- \directlua{glyphnumber = 0
+ \directlua{glyphnumber = 0 spacenumber = 0
luatexbase.add_to_callback("post_linebreak_filter",countglyphs,"countglyphs")
luatexbase.add_to_callback("stop_run",printglyphnumber,"printglyphnumber")
}
}
+\def\countwords{
+ \directlua{wordnumber = 0
+ luatexbase.add_to_callback("pre_linebreak_filter",countwords,"countwords")
+ luatexbase.add_to_callback("stop_run",printwordnumber,"printwordnumber")
+ }
+}
+
+\def\detectdoublewords{
+ \directlua{
+ luatexbase.add_to_callback("post_linebreak_filter",detectdoublewords,"detectdoublewords")
+ luatexbase.add_to_callback("stop_run",printdoublewords,"printdoublewords")
+ }
+}
+
\def\dosomethingfunny{
%% should execute one of the “funny” commands, but randomly. So every compilation is completely different. Maybe a list of commands could be specified to exclude total nonesense-functions. Maybe also on a per-paragraph-basis?
- }
+}
\def\dubstepenize{
\chickenize
@@ -712,7 +727,7 @@ sloppyline(flugel_vorne,flugel_unten) sloppyline(flugel_hinten,flugel_unten)
% Some code might be implemented to manipulate figures for full chickenization. However, I will \emph{not} load any packages at this place, as loading of expl3 or TikZ or whatever takes too much time for such a tiny package like this one. If you require any of the features presented here, you have to load the packages on your own. Maybe this will change.
% \begin{macrocode}
\ProvidesPackage{chickenize}%
- [2013/02/24 v0.2 chickenize package]
+ [2013/08/22 v0.2.1a chickenize package]
\input{chickenize}
% \end{macrocode}
% \subsection{Definition of User-Level Macros}
@@ -743,6 +758,7 @@ sloppyline(flugel_vorne,flugel_unten) sloppyline(flugel_hinten,flugel_unten)
local nodenew = node.new
local nodecopy = node.copy
+local nodetail = node.tail
local nodeinsertbefore = node.insert_before
local nodeinsertafter = node.insert_after
local noderemove = node.remove
@@ -763,8 +779,8 @@ color_push = nodenew(WHAT,COL)
color_pop = nodenew(WHAT,COL)
color_push.stack = 0
color_pop.stack = 0
-color_push.cmd = 1
-color_pop.cmd = 2
+color_push.command = 1
+color_pop.command = 2
% \end{macrocode}
% \subsection{chickenize}\label{sec:chickenize}
% The infamous |\chickenize| macro. Substitutes every word of the input with the given string. This can be elaborated arbitrarily, and whenever I feel like, I might add functionality. So far, only the string replaces the word, and even hyphenation is not possible.
@@ -778,10 +794,6 @@ 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 tbl = font.getfont(font.current())
-local space = tbl.parameters.space
-local shrink = tbl.parameters.space_shrink
-local stretch = tbl.parameters.space_stretch
local match = unicode.utf8.match
chickenize_ignore_word = false
% \end{macrocode}
@@ -892,8 +904,8 @@ boustrophedon = function(head)
w = line.width/65536*0.99625 -- empirical correction factor (?)
rot.data = "-1 0 0 1 "..w.." 0 cm"
rot2.data = "-1 0 0 1 "..-w.." 0 cm"
- line.head = node.insert_before(line.head,line.head,node.copy(rot))
- node.insert_after(line.head,node.tail(line.head),node.copy(rot2))
+ line.head = node.insert_before(line.head,line.head,nodecopy(rot))
+ nodeinsertafter(line.head,nodetail(line.head),nodecopy(rot2))
odd = true
else
odd = false
@@ -915,8 +927,8 @@ boustrophedon_glyphs = function(head)
w = -g.width/65536*0.99625
rot.data = "-1 0 0 1 " .. w .." 0 cm"
rot2.data = "-1 0 0 1 " .. -w .." 0 cm"
- line.head = node.insert_before(line.head,g,node.copy(rot))
- node.insert_after(line.head,g,node.copy(rot2))
+ line.head = node.insert_before(line.head,g,nodecopy(rot))
+ nodeinsertafter(line.head,g,nodecopy(rot2))
end
odd = false
else
@@ -952,14 +964,17 @@ end
% \end{macrocode}
%
% \subsection{countglyphs}\label{sec:countglyphs}
-% Counts the glyphs in your documnt. Where “glyph” means every printed character in everything that is a paragraph – formulas do \emph{not} work! However, hyphenations \emph{do} work and the hyphen sign \emph{is counted}! And that is the sole reason for this function – every simple script could read the letters in a doucment, but only after the hyphenation it is possible to count the real number of printed characters – where the hyphen does count.
+% Counts the glyphs in your document. Where “glyph” means every printed character in everything that is a paragraph – formulas do \emph{not} work! However, hyphenations \emph{do} work and the hyphen sign \emph{is counted}! And that is the sole reason for this function – every simple script could read the letters in a doucment, but only after the hyphenation it is possible to count the real number of printed characters – where the hyphen does count. Also, spaces are count, but only spaces between glyphs in the output (i.\,e. nothing at the end/beginning of the lines), excluding indentation.
%
-% This function will be extended to allow counting of whatever you want.
+% This function will (maybe, upon request) be extended to allow counting of whatever you want.
% \begin{macrocode}
countglyphs = function(head)
for line in nodetraverseid(0,head) do
for glyph in nodetraverseid(37,line.head) do
glyphnumber = glyphnumber + 1
+ if (glyph.next.id == 10) and (glyph.next.next.id ==37) then
+ spacenumber = spacenumber + 1
+ end
end
end
return head
@@ -968,7 +983,50 @@ end
% To print out the number at the end of the document, the following function is registered in the |stop_run| callback. This will prevent the normal message from being printed, informing the user about page and memory stats etc. But I guess when counting characters, everything else does not matter at all? …
% \begin{macrocode}
printglyphnumber = function()
- texiowrite_nl("\n Number of glyphs in this document: "..glyphnumber.."\n")
+ texiowrite_nl("\nNumber of glyphs in this document: "..glyphnumber)
+ texiowrite_nl("Number of spaces in this document: "..spacenumber)
+ texiowrite_nl("Glyphs plus spaces: "..glyphnumber+spacenumber.."\n")
+end
+% \end{macrocode}
+% \subsection{countwords}\label{sec:countwords}
+% Counts the number of words in the document. The function works directly before the line breaking, so all macros are expanded. A “word” then is everything that is between two spaces before paragraph formatting. The beginning of a paragraph is a word, and the last word of a paragraph is accounted for by explicit increasing the counter, as no space token follows.
+% \begin{macrocode}
+countwords = function(head)
+ for glyph in nodetraverseid(37,head) do
+ if (glyph.next.id == 10) then
+ wordnumber = wordnumber + 1
+ end
+ end
+ wordnumber = wordnumber + 1 -- add 1 for the last word in a paragraph which is not found otherwise
+ return head
+end
+% \end{macrocode}
+% Printing is done at the end of the compilation in the |stop_run| callback:
+% \begin{macrocode}
+printwordnumber = function()
+ texiowrite_nl("\nNumber of words in this document: "..wordnumber)
+end
+% \end{macrocode}
+
+% \subsection{detectdoublewords}\label{sec:detectdoublewords}
+% \begin{macrocode}
+function detectdoublewords(head)
+ prevlastword = {} -- array of numbers representing the glyphs
+ prevfirstword = {}
+ newlastword = {}
+ newfirstword = {}
+ for line in nodetraverseid(0,head) do
+ for g in nodetraverseid(37,line.head) do
+texio.write_nl("next glyph",#newfirstword+1)
+ newfirstword[#newfirstword+1] = g.char
+ if (g.next.id == 10) then break end
+ end
+texio.write_nl("nfw:"..#newfirstword)
+ end
+end
+
+function printdoublewords()
+ texio.write_nl("finished")
end
% \end{macrocode}
% \subsection{guttenbergenize}\label{sec:guttenbergenize}
@@ -1135,7 +1193,7 @@ local letterspace_spec = nodenew(nodeid"glue_spec")
local letterspace_pen = nodenew(nodeid"penalty")
letterspace_spec.width = tex.sp"0pt"
-letterspace_spec.stretch = tex.sp"2pt"
+letterspace_spec.stretch = tex.sp"0.05pt"
letterspace_glue.spec = letterspace_spec
letterspace_pen.penalty = 10000
% \end{macrocode}
@@ -1143,7 +1201,7 @@ letterspace_pen.penalty = 10000
% \begin{macrocode}
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") then
+ if glyph.prev and (glyph.prev.id == nodeid"glyph" or glyph.prev.id == nodeid"disc" or glyph.prev.id == nodeid"kern") then
local g = nodecopy(letterspace_glue)
nodeinsertbefore(head, glyph, g)
nodeinsertbefore(head, g, nodecopy(letterspace_pen))
@@ -1156,12 +1214,12 @@ end
% The |\text...|-version of |letterspaceadjust|. Just works, without the need to call |\letterspaceadjust| globally or anything else. Just put the |\textletterspaceadjust| around the part of text you want the function to work on. Might have problems with surrounding spacing, take care!
% \begin{macrocode}
textletterspaceadjust = function(head)
- for glyph in node.traverse_id(node.id"glyph", head) do
+ for glyph in nodetraverseid(nodeid"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") 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
local g = node.copy(letterspace_glue)
- node.insert_before(head, glyph, g)
- node.insert_before(head, g, node.copy(letterspace_pen))
+ nodeinsertbefore(head, glyph, g)
+ nodeinsertbefore(head, g, nodecopy(letterspace_pen))
end
end
end
@@ -1647,7 +1705,7 @@ function pdf_print (...)
for _, str in ipairs({...}) do
pdf.print(str .. " ")
end
- pdf.print("\string\n")
+ pdf.print("\n")
end
function move (p)
diff --git a/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua b/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua
index 7a3dda51cb3..6a2b3f648db 100644
--- a/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua
+++ b/Master/texmf-dist/tex/luatex/chickenize/chickenize.lua
@@ -8,13 +8,14 @@
--
-- EXPERIMENTAL CODE
--
--- This package is copyright © 20012 Arno L. Trautmann. It may be distributed and/or
+-- This package is copyright © 2013 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’.
local nodenew = node.new
local nodecopy = node.copy
+local nodetail = node.tail
local nodeinsertbefore = node.insert_before
local nodeinsertafter = node.insert_after
local noderemove = node.remove
@@ -32,8 +33,8 @@ color_push = nodenew(WHAT,COL)
color_pop = nodenew(WHAT,COL)
color_push.stack = 0
color_pop.stack = 0
-color_push.cmd = 1
-color_pop.cmd = 2
+color_push.command = 1
+color_pop.command = 2
chicken_pagenumbers = true
chickenstring = {}
@@ -43,10 +44,6 @@ 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 tbl = font.getfont(font.current())
-local space = tbl.parameters.space
-local shrink = tbl.parameters.space_shrink
-local stretch = tbl.parameters.space_stretch
local match = unicode.utf8.match
chickenize_ignore_word = false
chickenize_real_stuff = function(i,head)
@@ -145,8 +142,8 @@ boustrophedon = function(head)
w = line.width/65536*0.99625 -- empirical correction factor (?)
rot.data = "-1 0 0 1 "..w.." 0 cm"
rot2.data = "-1 0 0 1 "..-w.." 0 cm"
- line.head = node.insert_before(line.head,line.head,node.copy(rot))
- node.insert_after(line.head,node.tail(line.head),node.copy(rot2))
+ line.head = node.insert_before(line.head,line.head,nodecopy(rot))
+ nodeinsertafter(line.head,nodetail(line.head),nodecopy(rot2))
odd = true
else
odd = false
@@ -165,8 +162,8 @@ boustrophedon_glyphs = function(head)
w = -g.width/65536*0.99625
rot.data = "-1 0 0 1 " .. w .." 0 cm"
rot2.data = "-1 0 0 1 " .. -w .." 0 cm"
- line.head = node.insert_before(line.head,g,node.copy(rot))
- node.insert_after(line.head,g,node.copy(rot2))
+ line.head = node.insert_before(line.head,g,nodecopy(rot))
+ nodeinsertafter(line.head,g,nodecopy(rot2))
end
odd = false
else
@@ -200,12 +197,48 @@ countglyphs = function(head)
for line in nodetraverseid(0,head) do
for glyph in nodetraverseid(37,line.head) do
glyphnumber = glyphnumber + 1
+ if (glyph.next.id == 10) and (glyph.next.next.id ==37) then
+ spacenumber = spacenumber + 1
+ end
end
end
return head
end
printglyphnumber = function()
- texiowrite_nl("\n Number of glyphs in this document: "..glyphnumber.."\n")
+ texiowrite_nl("\nNumber of glyphs in this document: "..glyphnumber)
+ texiowrite_nl("Number of spaces in this document: "..spacenumber)
+ texiowrite_nl("Glyphs plus spaces: "..glyphnumber+spacenumber.."\n")
+end
+countwords = function(head)
+ for glyph in nodetraverseid(37,head) do
+ if (glyph.next.id == 10) then
+ wordnumber = wordnumber + 1
+ end
+ end
+ wordnumber = wordnumber + 1 -- add 1 for the last word in a paragraph which is not found otherwise
+ return head
+end
+printwordnumber = function()
+ texiowrite_nl("\nNumber of words in this document: "..wordnumber)
+end
+
+function detectdoublewords(head)
+ prevlastword = {} -- array of numbers representing the glyphs
+ prevfirstword = {}
+ newlastword = {}
+ newfirstword = {}
+ for line in nodetraverseid(0,head) do
+ for g in nodetraverseid(37,line.head) do
+texio.write_nl("next glyph",#newfirstword+1)
+ newfirstword[#newfirstword+1] = g.char
+ if (g.next.id == 10) then break end
+ end
+texio.write_nl("nfw:"..#newfirstword)
+ end
+end
+
+function printdoublewords()
+ texio.write_nl("finished")
end
local quotestrings = {
[171] = true, [172] = true,
@@ -331,12 +364,12 @@ local letterspace_spec = nodenew(nodeid"glue_spec")
local letterspace_pen = nodenew(nodeid"penalty")
letterspace_spec.width = tex.sp"0pt"
-letterspace_spec.stretch = tex.sp"2pt"
+letterspace_spec.stretch = tex.sp"0.05pt"
letterspace_glue.spec = letterspace_spec
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") then
+ if glyph.prev and (glyph.prev.id == nodeid"glyph" or glyph.prev.id == nodeid"disc" or glyph.prev.id == nodeid"kern") then
local g = nodecopy(letterspace_glue)
nodeinsertbefore(head, glyph, g)
nodeinsertbefore(head, g, nodecopy(letterspace_pen))
@@ -345,12 +378,12 @@ letterspaceadjust = function(head)
return head
end
textletterspaceadjust = function(head)
- for glyph in node.traverse_id(node.id"glyph", head) do
+ for glyph in nodetraverseid(nodeid"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") 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
local g = node.copy(letterspace_glue)
- node.insert_before(head, glyph, g)
- node.insert_before(head, g, node.copy(letterspace_pen))
+ nodeinsertbefore(head, glyph, g)
+ nodeinsertbefore(head, g, nodecopy(letterspace_pen))
end
end
end
@@ -711,7 +744,7 @@ function pdf_print (...)
for _, str in ipairs({...}) do
pdf.print(str .. " ")
end
- pdf.print("\string\n")
+ pdf.print("\n")
end
function move (p)
diff --git a/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty b/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty
index c957e335f34..fc58953a20d 100644
--- a/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty
+++ b/Master/texmf-dist/tex/luatex/chickenize/chickenize.sty
@@ -8,12 +8,12 @@
%%
%% EXPERIMENTAL CODE
%%
-%% This package is copyright © 20012 Arno L. Trautmann. It may be distributed and/or
+%% This package is copyright © 2013 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}%
- [2013/02/24 v0.2 chickenize package]
+ [2013/08/22 v0.2.1a chickenize package]
\input{chickenize}
\iffalse
\DeclareDocumentCommand\includegraphics{O{}m}{
diff --git a/Master/texmf-dist/tex/luatex/chickenize/chickenize.tex b/Master/texmf-dist/tex/luatex/chickenize/chickenize.tex
index 36aff989800..955102e8a41 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 © 20012 Arno L. Trautmann. It may be distributed and/or
+%% This package is copyright © 2013 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’.
@@ -78,15 +78,29 @@
\directlua{luatexbase.remove_from_callback("post_linebreak_filter","stretch_expansion")}}
\def\countglyphs{
- \directlua{glyphnumber = 0
+ \directlua{glyphnumber = 0 spacenumber = 0
luatexbase.add_to_callback("post_linebreak_filter",countglyphs,"countglyphs")
luatexbase.add_to_callback("stop_run",printglyphnumber,"printglyphnumber")
}
}
+\def\countwords{
+ \directlua{wordnumber = 0
+ luatexbase.add_to_callback("pre_linebreak_filter",countwords,"countwords")
+ luatexbase.add_to_callback("stop_run",printwordnumber,"printwordnumber")
+ }
+}
+
+\def\detectdoublewords{
+ \directlua{
+ luatexbase.add_to_callback("post_linebreak_filter",detectdoublewords,"detectdoublewords")
+ luatexbase.add_to_callback("stop_run",printdoublewords,"printdoublewords")
+ }
+}
+
\def\dosomethingfunny{
%% should execute one of the “funny” commands, but randomly. So every compilation is completely different. Maybe a list of commands could be specified to exclude total nonesense-functions. Maybe also on a per-paragraph-basis?
- }
+}
\def\dubstepenize{
\chickenize