diff options
author | Karl Berry <karl@freefriends.org> | 2023-01-04 21:19:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-01-04 21:19:29 +0000 |
commit | 02d10a61d06b998bad3984a37e8ec40abed76d69 (patch) | |
tree | dfcd88866addb7bfc61ef6fac761a646c5b38996 /Master | |
parent | 65ffe6ad33b269a2503ca0291a0642319594b62a (diff) |
lua-visual-debug (4jan23)
git-svn-id: svn://tug.org/texlive/trunk@65464 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/luatex/lua-visual-debug/README.md | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/luatex/lua-visual-debug/lvdebug-doc.pdf | bin | 210686 -> 210880 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 | 49217 -> 49220 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/luatex/lua-visual-debug/sample.pdf | bin | 45516 -> 45515 bytes | |||
-rw-r--r-- | Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.lua | 87 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/lua-visual-debug/lua-visual-debug.sty | 4 |
7 files changed, 58 insertions, 43 deletions
diff --git a/Master/texmf-dist/doc/luatex/lua-visual-debug/README.md b/Master/texmf-dist/doc/luatex/lua-visual-debug/README.md index 0e07af14c1e..ee857405691 100644 --- a/Master/texmf-dist/doc/luatex/lua-visual-debug/README.md +++ b/Master/texmf-dist/doc/luatex/lua-visual-debug/README.md @@ -20,9 +20,9 @@ Requirements: The package has only been tested with LuaTeX and but other engines only show a warning message. -Copyright 2012–2021 Patrick Gundlach (<patrick@gundla.ch>) and others (see Git information) +Copyright 2012–2023 Patrick Gundlach (<patrick@gundla.ch>) and others (see Git information) -Package version: 0.8 +Package version: 0.9 Public repository: <https://github.com/pgundlach/lvdebug> 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 c05b287e378..729a9d88611 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 736096e2c80..5fd3df4b8d4 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} -\newcommand\pkgversion{0.8} +\newcommand\pkgversion{0.9} \newcommand*\pgsmall{\fontsize{8.5}{8.7}\selectfont\ttfamily} \lstset{basicstyle=\pgsmall, @@ -48,7 +48,7 @@ When you load the package \texttt{lua-visual-debug} in your \LuaLaTeX\ document \noindent\includegraphics[width=.9\textwidth]{lvdebugdetail1-num} \begin{enumerate} \item A vertical glue. Beginning and end are marked with a small tick. At the mark 1, two vertical glues are connected. -\item A horizontal glue. +\item A horizontal glue. Blue dashed lines represent stretched glues, magenta lines represent shrunk glues, gray at their natural width. \item A negative kern. Positive kerns are yellow. \item A possible hyphenation point. \item Horizontal and vertical boxes are drawn with a border. @@ -64,7 +64,7 @@ A strut box (zero width box) is marked with a red rule: \section{Copying} -Copyright 2012–2021 Patrick Gundlach (patrick@gundla.ch) and other authors (see Git for information), licensed under the MIT license. See the Lua file for details. +Copyright 2012–2023 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 6d9b740524d..e9e1a5fd13d 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 8583f2d291a..2de1ad5490c 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 4fb7465a81e..524d0893c2f 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,23 +1,26 @@ --- Copyright 2012-2021 Patrick Gundlach, patrick@gundla.ch --- Public repository: https://github.com/pgundlach/lvdebug (issues/pull requests,...) --- Version: 0.8 - --- 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, --- publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do --- so, subject to the following conditions: +-- Copyright 2012-2023 Patrick Gundlach, patrick@gundla.ch Public repository: +-- https://github.com/pgundlach/lvdebug (issues/pull requests,...) Version: see +-- Makefile + +-- 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, publish, distribute, sublicense, and/or sell +-- copies of the Software, and to permit persons to whom the Software is +-- furnished to do so, subject to the following conditions: -- --- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +-- The above copyright notice and this permission notice shall be included in +-- all copies or substantial portions of the Software. -- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE --- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION --- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +-- SOFTWARE. - -module(...,package.seeall) - -- There are 65782 scaled points in a PDF point -- Therefore we need to divide all TeX lengths by -- this amount to get the PDF points. @@ -27,13 +30,13 @@ local number_sp_in_a_pdf_point = 65782 -- The idea is the following: at page shipout, all elements on a page are fixed. -- TeX creates an intermediate data structure before putting that into the PDF -- We can "intercept" that data structure and add pdf_literal (whatist) nodes, --- that makes glues, kerns and other items visible by drawing a rule, rectangle or --- other visual aids. --- This has no influence on typeset material, because these pdf_literal instructions --- are only visible to the PDF file (PDF renderer) and have no size themselves. +-- that makes glues, kerns and other items visible by drawing a rule, rectangle +-- or other visual aids. This has no influence on typeset material, because +-- these pdf_literal instructions are only visible to the PDF file (PDF +-- renderer) and have no size themselves. --- We recursively loop through the contents of boxes and look at the (linear) list of --- items in that box. We start at the "shipout box". +-- We recursively loop through the contents of boxes and look at the (linear) +-- list of items in that box. We start at the "shipout box". -- The "algorithm" goes like this: -- @@ -61,7 +64,7 @@ local GLUE = node.id("glue") local KERN = node.id("kern") local PENALTY = node.id("penalty") -function math.round(num, idp) +local function math_round(num, idp) if idp and idp>0 then local mult = 10^idp return math.floor(num * mult + 0.5) / mult @@ -69,19 +72,26 @@ function math.round(num, idp) return math.floor(num + 0.5) end -local curdir = {}, pardir +local curdir = {} + +local show_page_elements function show_page_elements(parent) local head = parent.list while head do local has_dir = false - if head.dir == "TLT" then table.insert(curdir,"ltr") has_dir=true elseif head.dir == "TRT" then table.insert(curdir,"rtl") has_dir=true end + if head.dir == "TLT" then + table.insert(curdir,"ltr") + has_dir=true + elseif head.dir == "TRT" then + table.insert(curdir,"rtl") has_dir=true + end 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) - 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) + 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) @@ -100,8 +110,8 @@ function show_page_elements(parent) 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) + 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) @@ -122,7 +132,7 @@ function show_page_elements(parent) elseif mode == "-" then local x = table.remove(curdir) if x ~= ldir then - warning("paragraph direction incorrect, found %s, expected %s",ldir,x) + print(string.format("paragraph direction incorrect, found %s, expected %s",ldir,x)) end end @@ -141,13 +151,13 @@ 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) + local wd_bp = math_round(wd / number_sp_in_a_pdf_point,2) if curdir[#curdir] == "rtl" then wd_bp = wd_bp * -1 end 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) + 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) + 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) @@ -155,9 +165,9 @@ 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) + local k = math_round(head.kern / number_sp_in_a_pdf_point,2) if parent.id == HLIST then - rectangle.data = string.format("q %s 0 w 0 0 %g 1 re B Q",color, k ) + 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 ) end @@ -180,3 +190,8 @@ function show_page_elements(parent) end return true end + + +return { + show_page_elements = show_page_elements +}
\ No newline at end of file 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 8f3aac8ea3b..839e045b0dd 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{2021/01/07} -\def\lvdebugpkgversion{0.8} +\def\lvdebugpkgdate{2023/01/04} +\def\lvdebugpkgversion{0.9} \ifx\ProvidesPackage\undefined \input ifluatex.sty\relax |