diff options
author | Karl Berry <karl@freefriends.org> | 2016-06-11 23:20:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-06-11 23:20:44 +0000 |
commit | 4513c9c8136432784df347315ab2929d38a980da (patch) | |
tree | eb5f3c4703d1cb362da15c580db34c5be8a01830 | |
parent | 50e1ec0263f277b1e09ec33dba67f95e44c4bebc (diff) |
lua-visual-debug (31may16)
git-svn-id: svn://tug.org/texlive/trunk@41387 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/luatex/lua-visual-debug/README | 25 | ||||
-rw-r--r-- | Master/texmf-dist/doc/luatex/lua-visual-debug/README.doc | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.pdf | bin | 307440 -> 307718 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.tex | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/luatex/lua-visual-debug/sample-plain.pdf | bin | 49145 -> 49110 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf | bin | 143046 -> 143012 bytes | |||
-rw-r--r-- | Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.lua | 43 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.sty | 10 |
8 files changed, 37 insertions, 51 deletions
diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/README b/Master/texmf-dist/doc/luatex/lua-visual-debug/README deleted file mode 100644 index 3e8ecc43d6b..00000000000 --- a/Master/texmf-dist/doc/luatex/lua-visual-debug/README +++ /dev/null @@ -1,25 +0,0 @@ -The LuaTeX package 'lua-visual-debug' shows boxes, glues, kerns and -penalties in the PDF output. - -Usage: - -LaTeX: - -\usepackage{lua-visual-debug} - -or (plain) - -\input lua-visual-debug.sty - - - -Requirements: The package has only been tested with LuaTeX and - the formats plain and LaTeX. Other formats might work as well, - but other engines only show a warning message. - - -Copyright 2012 Patrick Gundlach (patrick@gundla.ch) -Public repository: https://github.com/pgundlach/lvdebug -Licensed under the MIT license. See the Lua file for details. -The idea is heavily inspired by Hans Hagen's http://pragma-ade.com/articles/art-visi.pdf - diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/README.doc b/Master/texmf-dist/doc/luatex/lua-visual-debug/README.doc index 4562a507726..023ea89e372 100644 --- a/Master/texmf-dist/doc/luatex/lua-visual-debug/README.doc +++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/README.doc @@ -18,8 +18,8 @@ Requirements: The package has only been tested with LuaTeX and but other engines only show a warning message. -Copyright 2012 Patrick Gundlach (patrick@gundla.ch) -Package version: 0.4 +Copyright 2012–2016 Patrick Gundlach (patrick@gundla.ch) and others (see Git information) +Package version: 0.5 Public repository: https://github.com/pgundlach/lvdebug Licensed under the MIT license. See the Lua file for details. The idea is heavily inspired by Hans Hagen's http://pragma-ade.com/articles/art-visi.pdf 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 Binary files differindex 1e95f49a4b6..9986860499a 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 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 9ed5397d4cd..b466530bc12 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,6 @@ \documentclass{article} -\usepackage{graphicx,listings,lmodern,luatextra,dtklogos} -\newcommand\pkgversion{0.4} +\usepackage{graphicx,listings,lmodern,luatextra} +\newcommand\pkgversion{0.5} \newcommand*\pgsmall{\fontsize{8.5}{8.7}\selectfont\ttfamily} \lstset{basicstyle=\pgsmall, @@ -64,7 +64,7 @@ A strut box (zero width box) is marked with a red rule: \section{Copying} -Copyright 2012 Patrick Gundlach (patrick@gundla.ch), licensed under the MIT license. See the Lua file for details. +Copyright 2012–2016 Patrick Gundlach (patrick@gundla.ch) and other authors (see Git for information), licensed under the MIT license. See the Lua file for details. \end{document} 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 Binary files differindex c5c7afb2943..3b3851f39a3 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 diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf Binary files differindex 19f25382ed9..f6f6dc6e072 100644 --- a/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf +++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf 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 8d600a74bfb..eb962c06804 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 @@ -1,6 +1,6 @@ -- Copyright 2012 Patrick Gundlach, patrick@gundla.ch -- Public repository: https://github.com/pgundlach/lvdebug (issues/pull requests,...) --- Version: 0.4 +-- Version: 0.5 -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the -- "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, @@ -52,6 +52,14 @@ local number_sp_in_a_pdf_point = 65782 -- -- the pointer is "nil" if there is no next item -- end +local HLIST = node.id("hlist") +local VLIST = node.id("vlist") +local RULE = node.id("rule") +local DISC = node.id("disc") +local GLUE = node.id("glue") +local KERN = node.id("kern") +local PENALTY = node.id("penalty") + function math.round(num, idp) if idp and idp>0 then local mult = 10^idp @@ -64,7 +72,7 @@ end function show_page_elements(parent) local head = parent.list while head do - if head.id == 0 or head.id == 1 then -- hbox / vbox + if head.id == HLIST or head.id == VLIST then local rule_width = 0.1 local wd = math.round(head.width / number_sp_in_a_pdf_point - rule_width ,2) @@ -74,7 +82,7 @@ function show_page_elements(parent) -- recurse into the contents of the box show_page_elements(head) local rectangle = node.new("whatsit","pdf_literal") - if head.id == 0 then -- hbox + if head.id == HLIST then -- hbox rectangle.data = string.format("q 0.5 G %g w %g %g %g %g re s Q", rule_width, -rule_width / 2, -dp, wd, ht) else rectangle.data = string.format("q 0.1 G %g w %g %g %g %g re s Q", rule_width, -rule_width / 2, 0, wd, -ht) @@ -82,7 +90,7 @@ function show_page_elements(parent) head.list = node.insert_before(head.list,head.list,rectangle) - elseif head.id == 2 then -- rule + elseif head.id == RULE then 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 @@ -94,25 +102,29 @@ function show_page_elements(parent) parent.list = node.insert_before(parent.list,head,show_rule) - elseif head.id == 7 then -- disc + elseif head.id == DISC then local hyphen_marker = node.new("whatsit","pdf_literal") hyphen_marker.data = "q 0 0 1 RG 0.3 w 0 -1 m 0 0 l S Q" parent.list = node.insert_before(parent.list,head,hyphen_marker) - elseif head.id == 10 then -- glue - local wd = head.spec.width + elseif head.id == GLUE then + local head_spec = head.spec + if not head_spec then + head_spec = head + end + local wd = head_spec.width local color = "0.5 G" - if parent.glue_sign == 1 and parent.glue_order == head.spec.stretch_order then - wd = wd + parent.glue_set * head.spec.stretch + if parent.glue_sign == 1 and parent.glue_order == head_spec.stretch_order then + wd = wd + parent.glue_set * head_spec.stretch color = "0 0 1 RG" - elseif parent.glue_sign == 2 and parent.glue_order == head.spec.shrink_order then - wd = wd - parent.glue_set * head.spec.shrink + elseif parent.glue_sign == 2 and parent.glue_order == head_spec.shrink_order then + wd = wd - parent.glue_set * head_spec.shrink 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 + if parent.id == HLIST then 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_bp,-wd_bp,-wd_bp) @@ -120,12 +132,12 @@ function show_page_elements(parent) parent.list = node.insert_before(parent.list,head,pdfstring) - elseif head.id == 11 then -- kern + elseif head.id == KERN then 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 + if parent.id == HLIST then 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, -k ) @@ -133,7 +145,7 @@ function show_page_elements(parent) parent.list = node.insert_before(parent.list,head,rectangle) - elseif head.id == 12 then -- penalty + elseif head.id == PENALTY then local color = "1 g" local rectangle = node.new("whatsit","pdf_literal") if head.penalty < 10000 then @@ -146,4 +158,3 @@ function show_page_elements(parent) 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 49636ac10c1..0f250b4563f 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,7 +1,7 @@ % see lua file for copyright information (MIT License) -\def\lvdebugpkgdate{2012/04/06} -\def\lvdebugpkgversion{0.4} +\def\lvdebugpkgdate{2016/05/30} +\def\lvdebugpkgversion{0.5} \expandafter\ifx\csname ProvidesPackage\endcsname\relax \input ifluatex.sty\relax @@ -11,7 +11,7 @@ \RequirePackage{ifluatex} \fi -\def\dothings{% +\def\luavisualdebug@dothings{% \directlua{ lvd = require("lua-visual-debug")}% \AtBeginShipout {\directlua{lvd.show_page_elements(tex.box["AtBeginShipoutBox"])}}% } @@ -19,7 +19,7 @@ \expandafter\ifx\csname ProvidesPackage\endcsname\relax \ifluatex \input atbegshi.sty\relax - \dothings + \luavisualdebug@dothings \AtBeginShipoutInit \else \message{Warning: lua-visual-debug only works with LuaTeX (plain and LaTeX format)} @@ -27,7 +27,7 @@ \else \ifluatex \RequirePackage{atbegshi} - \dothings + \luavisualdebug@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.} \fi |