diff options
author | Karl Berry <karl@freefriends.org> | 2012-02-22 23:35:00 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-02-22 23:35:00 +0000 |
commit | 56ca78224fc5998bdbafd36c1861af1323d7715d (patch) | |
tree | 7c8c26cc3477dc381fa0a34558988e408c03efa1 | |
parent | f1ecfdedac68a0b0aff5e22b7b69fb42ce8067c5 (diff) |
new lualatex package lua-visual-debug (22feb12)
git-svn-id: svn://tug.org/texlive/trunk@25475 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lua-visual-debug/README | 15 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.pdf | bin | 0 -> 99300 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.tex | 48 | ||||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-sample.pdf | bin | 0 -> 46233 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/lualatex/lua-visual-debug/sample.tex | 26 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.lua | 91 | ||||
-rw-r--r-- | Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.sty | 9 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/lua-visual-debug.tlpsrc | 0 |
9 files changed, 190 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/lualatex/lua-visual-debug/README b/Master/texmf-dist/doc/lualatex/lua-visual-debug/README new file mode 100644 index 00000000000..ffec4835ed8 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/lua-visual-debug/README @@ -0,0 +1,15 @@ +The LaTeX package 'lua-visual-debug' shows boxes, glues, kerns and +penalties in the PDF output. + +Usage: + +\usepackage{lua-visual-debug} + +Requirements: The package only works with LuaLaTeX. + With other engines, a warning message will be shown. + +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/lualatex/lua-visual-debug/lvdebug-doc.pdf b/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.pdf Binary files differnew file mode 100644 index 00000000000..8991337eb24 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.pdf diff --git a/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.tex b/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.tex new file mode 100644 index 00000000000..f57fb7c539d --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-doc.tex @@ -0,0 +1,48 @@ +\documentclass{article} +\usepackage{graphics} +\newcommand\LuaLaTeX{Lua\LaTeX} + +\begin{document} +\section{Documentation} + +When you load the package \texttt{lua-visual-debug} in your \LuaLaTeX\ document, \LaTeX\ will highlight boxes, penalties, glues and kerns in the PDF. This package requires you to process the document with \LuaLaTeX. + +\begin{verbatim} +\documentclass{article} +\usepackage{lua-visual-debug} + +\listfiles +\setlength\textwidth{300pt} +\setlength\textheight{10cm} + +\begin{document} + +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. + + +\bgroup\fontsize{30}{34}\selectfont +\centerline{\TeX} +\egroup + +\vbox{\strut Hello}\kern .5cm\vbox{\strut World} + +\[ e=mc^2 \] + +\includegraphics[width=4cm]{cow} +\end{document} +\end{verbatim} + +yields \vspace{5mm} + +\noindent \includegraphics{lvdebug-sample.pdf} + +\section{Copying} + +Copyright 2012 Patrick Gundlach (patrick@gundla.ch), licensed under the MIT license. See the Lua file for details. + + +\end{document} diff --git a/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-sample.pdf b/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-sample.pdf Binary files differnew file mode 100644 index 00000000000..3c011d86e48 --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/lua-visual-debug/lvdebug-sample.pdf diff --git a/Master/texmf-dist/doc/lualatex/lua-visual-debug/sample.tex b/Master/texmf-dist/doc/lualatex/lua-visual-debug/sample.tex new file mode 100644 index 00000000000..44be4b744ad --- /dev/null +++ b/Master/texmf-dist/doc/lualatex/lua-visual-debug/sample.tex @@ -0,0 +1,26 @@ +\documentclass{article} +\usepackage{lua-visual-debug} + +\listfiles +\setlength\textwidth{300pt} +\setlength\textheight{10cm} + +\begin{document} + +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. + + +\bgroup\fontsize{30}{34}\selectfont +\centerline{\TeX} +\egroup + +\vbox{\strut Hello}\kern .5cm\vbox{\strut World} + +\[ e=mc^2 \] + +%\includegraphics[width=4cm]{cow} +\end{document} diff --git a/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.lua b/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.lua new file mode 100644 index 00000000000..1e37af791c0 --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.lua @@ -0,0 +1,91 @@ +-- Copyright 2012 Patrick Gundlach, patrick@gundla.ch +-- released under the "MIT license" (see footer of this file) +-- Public repository: https://github.com/pgundlach/lvdebug (issues/pull requests,...) + +module(...,package.seeall) + +local factor = 65782 -- big points vs. TeX points +local rule_width = 0.1 + + +local function draw_pagebox(head,parent) + while head do + if head.id == 0 or head.id == 1 then -- hbox / vbox + + local wd = head.width / factor - rule_width + local ht = (head.height + head.depth) / factor - rule_width + local dp = head.depth / factor - rule_width / 2 + + draw_pagebox(head.list,head) + local wbox = node.new("whatsit","pdf_literal") + if head.id == 0 then -- hbox + wbox.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 + wbox.data = string.format("q 0.1 G %g w %g %g %g %g re s Q", rule_width, -rule_width / 2, 0, wd, -ht) + end + wbox.mode = 0 + + head.list = node.insert_before(head.list,head.list,wbox) + + 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 + 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 + color = "1 0 1 RG" + end + + local wbox = node.new("whatsit","pdf_literal") + if parent.id == 0 then --hlist + wbox.data = string.format("q %s [0.2] 0 d 0.5 w 0 0 m %g 0 l s Q",color,wd / factor) + else -- vlist + wbox.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 / factor,-wd / factor,-wd / factor) + end + wbox.mode = 0 + + node.insert_before(parent.list,head,wbox) + elseif head.id == 11 then -- kern + local wbox = node.new("whatsit","pdf_literal") + local color = "1 1 0 rg" + if head.kern < 0 then color = "1 0 0 rg" end + if parent.id == 0 then --hlist + wbox.data = string.format("q %s 0 w 0 0 %g 1 re B Q",color, head.kern / factor ) + else + wbox.data = string.format("q %s 0 w 0 0 1 %g re B Q",color, -head.kern / factor ) + end + node.insert_before(parent.list,head,wbox) + elseif head.id == 12 then -- penalty + local color = "1 g" + local wbox = node.new("whatsit","pdf_literal") + if head.penalty < 10000 then + color = string.format("%d g", 1 - head.penalty / 10000) + end + wbox.data = string.format("q %s 0 w 0 0 1 1 re B Q",color) + node.insert_before(parent.list,head,wbox) + else + -- ignore + end + head = head.next + end +end + +local function draw() + draw_pagebox(tex.box["AtBeginShipoutBox"].list,tex.box["AtBeginShipoutBox"]) +end + +return { draw = draw } + +-- 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 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. diff --git a/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.sty b/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.sty new file mode 100644 index 00000000000..95671861a2e --- /dev/null +++ b/Master/texmf-dist/tex/lualatex/lua-visual-debug/lua-visual-debug.sty @@ -0,0 +1,9 @@ +\ProvidesPackage{lua-visual-debug}[2012/02/22 v0.1 Visual debugging in LuaLaTeX (PGU)] +\RequirePackage{ifluatex} +\ifluatex + \RequirePackage{luatexbase,atbegshi} + \directlua{ lvdebug = require("lua-visual-debug") } + \AtBeginShipout {\directlua{lvdebug.draw()}} +\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 diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 5b2b75035a0..d2bf38f92f1 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1222,6 +1222,7 @@ $standardtex='\.(.bx|cfg|sty|clo|ldf|cls|def|fd|cmap|4ht)$'; 'listings-ext','\.sty', # not .cfg 'logic', 'milstd\.tex|' . $standardtex, 'ltxkeys', '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$', # not cfg + 'lua-visual-debug', '\.lua|' . $standardtex, 'lualatex-math', '\.sty', # not phst-doc.cls 'magyar', 'NULL', # do not install in runtime, conflicts with babel 'manjutex', '\.sty|\.clo|\.ldf|\.cls|\.def|\.fd$|manju.tex', diff --git a/Master/tlpkg/tlpsrc/lua-visual-debug.tlpsrc b/Master/tlpkg/tlpsrc/lua-visual-debug.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/lua-visual-debug.tlpsrc |