summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-03-09 01:33:08 +0000
committerKarl Berry <karl@freefriends.org>2012-03-09 01:33:08 +0000
commitebd5de2be2cfa581ccf2318a23b14362f3bcb006 (patch)
treeecfbae16c7c5745b5932f2e8b18f0271c4a89824 /Master
parent1a1835b1fbe4ffb735d55bac3f95554e32c8e2f5 (diff)
lua-visual-debug (8mar12)
git-svn-id: svn://tug.org/texlive/trunk@25586 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/luatex/lua-visual-debug/README2
-rw-r--r--Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.pdfbin355891 -> 234590 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.tex5
-rw-r--r--Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.pdfbin49370 -> 49233 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdfbin99566 -> 143183 bytes
-rw-r--r--Master/texmf-dist/doc/luatex/lua-visual-debug/sample.tex2
-rw-r--r--Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.lua42
-rw-r--r--Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.sty6
8 files changed, 36 insertions, 21 deletions
diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/README b/Master/texmf-dist/doc/luatex/lua-visual-debug/README
index 94fd2312ec9..3e8ecc43d6b 100644
--- a/Master/texmf-dist/doc/luatex/lua-visual-debug/README
+++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/README
@@ -9,7 +9,7 @@ LaTeX:
or (plain)
-\input lua-visual-debug
+\input lua-visual-debug.sty
diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.pdf b/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.pdf
index 62aa83bdfa1..cfc68665c85 100644
--- a/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.pdf
+++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.tex b/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.tex
index 3655b96c1d1..27000645d54 100644
--- a/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.tex
+++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.tex
@@ -1,6 +1,5 @@
\documentclass{article}
-\usepackage{graphicx,listings,lmodern}
-\newcommand\LuaLaTeX{Lua\LaTeX}
+\usepackage{graphicx,listings,lmodern,luatextra}
\newcommand*\pgsmall{\fontsize{8.5}{8.7}\selectfont\ttfamily}
\lstset{basicstyle=\pgsmall,
@@ -13,7 +12,7 @@
}
\begin{document}
-\title{The lua-visual-debug package (V0.2)}
+\title{The lua-visual-debug package (V0.3)}
\author{Patrick Gundlach}
% \address{patrick@gundla.ch}
\maketitle
diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.pdf b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.pdf
index f77d7bf010c..f3632746021 100644
--- a/Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.pdf
+++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf
index 088303edca9..a649aa706d4 100644
--- a/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf
+++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.tex b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.tex
index 7a0c75e4f36..aa9fbf14122 100644
--- a/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.tex
+++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.tex
@@ -13,7 +13,7 @@ A wonderful serenity has taken possession of my entire soul, like these sweet
mornings of spring which I enjoy with my whole heart. I am alone, and feel
the charm of existence in this spot, which was created for the bliss of souls
like mine. I am so happy, my dear friend, so absorbed in the exquisite sense
-of mere tranquil existence, that I neglect my talents.
+of mere tranquil existence, that I neglect my talents\footnote{A very special note for you}.
\begin{itemize}
\item one
diff --git a/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.lua b/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.lua
index e4aae142737..af2f02c93e1 100644
--- a/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.lua
+++ b/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.lua
@@ -51,6 +51,14 @@ local number_sp_in_a_pdf_point = 65782
-- -- the pointer is "nil" if there is no next item
-- end
+function math.round(num, idp)
+ if idp and idp>0 then
+ local mult = 10^idp
+ return math.floor(num * mult + 0.5) / mult
+ end
+ return math.floor(num + 0.5)
+end
+
function show_page_elements(parent)
local head = parent.list
@@ -58,9 +66,9 @@ function show_page_elements(parent)
if head.id == 0 or head.id == 1 then -- hbox / vbox
local rule_width = 0.1
- local wd = head.width / number_sp_in_a_pdf_point - rule_width
- local ht = (head.height + head.depth) / number_sp_in_a_pdf_point - rule_width
- local dp = head.depth / number_sp_in_a_pdf_point - rule_width / 2
+ local wd = math.round(head.width / number_sp_in_a_pdf_point - rule_width ,2)
+ local ht = math.round((head.height + head.depth) / number_sp_in_a_pdf_point - rule_width ,2)
+ local dp = math.round(head.depth / number_sp_in_a_pdf_point - rule_width / 2 ,2)
-- recurse into the contents of the box
show_page_elements(head)
@@ -74,11 +82,15 @@ function show_page_elements(parent)
elseif head.id == 2 then -- rule
- if head.width == 0 then head.width = 0.4 * 2^16 end
- local goback = node.new("kern")
- goback.kern = -head.width
- node.insert_after(parent.list,head,goback)
- head = goback
+ local show_rule = node.new("whatsit","pdf_literal")
+ if head.width == -1073741824 or head.height == -1073741824 or head.depth == -1073741824 then
+ -- ignore for now -- these rules are stretchable
+ else
+ local dp = math.round( head.depth / number_sp_in_a_pdf_point ,2)
+ local ht = math.round( head.height / number_sp_in_a_pdf_point ,2)
+ show_rule.data = string.format("q 1 0 0 RG 1 0 0 rg 0.4 w 0 %g m 0 %g l S Q",-dp,ht)
+ end
+ parent.list = node.insert_before(parent.list,head,show_rule)
elseif head.id == 7 then -- disc
@@ -87,7 +99,7 @@ function show_page_elements(parent)
parent.list = node.insert_before(parent.list,head,hyphen_marker)
- elseif head.id == 10 then -- glue
+ elseif head.id == 10 then -- glue
local wd = head.spec.width
local color = "0.5 G"
if parent.glue_sign == 1 and parent.glue_order == head.spec.stretch_order then
@@ -98,10 +110,11 @@ function show_page_elements(parent)
color = "1 0 1 RG"
end
local pdfstring = node.new("whatsit","pdf_literal")
+ local wd_bp = math.round(wd / number_sp_in_a_pdf_point,2)
if parent.id == 0 then --hlist
- pdfstring.data = string.format("q %s [0.2] 0 d 0.5 w 0 0 m %g 0 l s Q",color,wd / number_sp_in_a_pdf_point)
+ pdfstring.data = string.format("q %s [0.2] 0 d 0.5 w 0 0 m %g 0 l s Q",color,wd_bp)
else -- vlist
- pdfstring.data = string.format("q 0.1 G 0.1 w -0.5 0 m 0.5 0 l -0.5 %g m 0.5 %g l s [0.2] 0 d 0.5 w 0.25 0 m 0.25 %g l s Q",-wd / number_sp_in_a_pdf_point,-wd / number_sp_in_a_pdf_point,-wd / number_sp_in_a_pdf_point)
+ pdfstring.data = string.format("q 0.1 G 0.1 w -0.5 0 m 0.5 0 l -0.5 %g m 0.5 %g l s [0.2] 0 d 0.5 w 0.25 0 m 0.25 %g l s Q",-wd_bp,-wd_bp,-wd_bp)
end
parent.list = node.insert_before(parent.list,head,pdfstring)
@@ -110,13 +123,15 @@ function show_page_elements(parent)
local rectangle = node.new("whatsit","pdf_literal")
local color = "1 1 0 rg"
if head.kern < 0 then color = "1 0 0 rg" end
+ local k = math.round(head.kern / number_sp_in_a_pdf_point,2)
if parent.id == 0 then --hlist
- rectangle.data = string.format("q %s 0 w 0 0 %g 1 re B Q",color, head.kern / number_sp_in_a_pdf_point )
+ rectangle.data = string.format("q %s 0 w 0 0 %g 1 re B Q",color, k )
else
- rectangle.data = string.format("q %s 0 w 0 0 1 %g re B Q",color, -head.kern / number_sp_in_a_pdf_point )
+ rectangle.data = string.format("q %s 0 w 0 0 1 %g re B Q",color, -k )
end
parent.list = node.insert_before(parent.list,head,rectangle)
+
elseif head.id == 12 then -- penalty
local color = "1 g"
local rectangle = node.new("whatsit","pdf_literal")
@@ -128,5 +143,6 @@ function show_page_elements(parent)
end
head = head.next
end
+ return true
end
diff --git a/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.sty b/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.sty
index 72839e48d93..7479e0fc6b9 100644
--- a/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.sty
+++ b/Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.sty
@@ -1,11 +1,11 @@
-% Version: 0.2
+% Version: 0.3
% see lua file for copyright information (MIT License)
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
\input ifluatex.sty\relax
\else
\NeedsTeXFormat{LaTeX2e}
- \ProvidesPackage{lua-visual-debug}[2012/02/24 v0.2 Visual debugging in LuaLaTeX (PGU)]
+ \ProvidesPackage{lua-visual-debug}[2012/02/24 v0.3 Visual debugging in LuaLaTeX (PGU)]
\RequirePackage{ifluatex}
\fi
@@ -24,7 +24,7 @@
\fi
\else
\ifluatex
- \RequirePackage{luatexbase,atbegshi}
+ \RequirePackage{atbegshi}
\dothings
\else
\PackageWarning{lua-visual-debug}{You are using this package without LuaTeX. This is not supported, so you don't get any visual debugging.}