summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex')
-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
3 files changed, 71 insertions, 24 deletions
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