From 51400e096ca50dd3c9303cf8aea839947ea4c0dc Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 5 Feb 2016 23:35:28 +0000 Subject: showhyphens (5feb16) git-svn-id: svn://tug.org/texlive/trunk@39593 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/lualatex/showhyphens/README | 2 +- .../doc/lualatex/showhyphens/showhyphens-doc.pdf | Bin 82101 -> 82999 bytes .../doc/lualatex/showhyphens/showhyphens-doc.tex | 22 ++++++++--- .../tex/lualatex/showhyphens/showhyphens.sty | 43 +++++++++++++++------ 4 files changed, 49 insertions(+), 18 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/lualatex/showhyphens/README b/Master/texmf-dist/doc/lualatex/showhyphens/README index 41d0b060fd3..cf245e5b752 100644 --- a/Master/texmf-dist/doc/lualatex/showhyphens/README +++ b/Master/texmf-dist/doc/lualatex/showhyphens/README @@ -7,5 +7,5 @@ Usage: Requirements: The package only works with LuaLaTeX. -Copyright 2011-2015 Patrick Gundlach (patrick@gundla.ch), +Copyright 2011-2016 Patrick Gundlach (patrick@gundla.ch), licensed under the MIT license. See the style for details. diff --git a/Master/texmf-dist/doc/lualatex/showhyphens/showhyphens-doc.pdf b/Master/texmf-dist/doc/lualatex/showhyphens/showhyphens-doc.pdf index 292c4cf927d..85c52932a5b 100644 Binary files a/Master/texmf-dist/doc/lualatex/showhyphens/showhyphens-doc.pdf and b/Master/texmf-dist/doc/lualatex/showhyphens/showhyphens-doc.pdf differ diff --git a/Master/texmf-dist/doc/lualatex/showhyphens/showhyphens-doc.tex b/Master/texmf-dist/doc/lualatex/showhyphens/showhyphens-doc.tex index c43ef2239a9..6a273113490 100644 --- a/Master/texmf-dist/doc/lualatex/showhyphens/showhyphens-doc.tex +++ b/Master/texmf-dist/doc/lualatex/showhyphens/showhyphens-doc.tex @@ -1,7 +1,7 @@ \documentclass{ltxdockit} \usepackage{dtklogos,csquotes,graphicx} -\newcommand\pkgversion{0.4a} +\newcommand\pkgversion{0.5b} \titlepage{% title={The showhyphens package}, @@ -18,8 +18,8 @@ \section{Documentation} -When you load the package \texttt{showhyphens} in your \LuaLaTeX\ document, \LaTeX\ will show all possible hyphenation points. This -package requires you to process the document with \LuaLaTeX. +When you load the package \texttt{showhyphens} in your Lua\LaTeX\ document, \LaTeX\ will show all possible hyphenation points. This +package requires you to process the document with Lua\LaTeX. \begin{verbatim} \documentclass{article} @@ -49,8 +49,9 @@ yields \vspace{5mm} \section{Bugs and limitations} % see http://tex.stackexchange.com/q/268884 -Ligatures will give incorrect results. For example \enquote{office} gives: -offi'ce but should show of'fice instead. While it is possible to look inside +Hyphenation points within ligatures cannot be shown correctly. The package marks the ligature with a horizontal bar on top. The hyphenation point is somewhere within the ligature. +For example \enquote{office} gives the word \enquote{office} with a horizontal bar on top of \enquote{ffi} but should show of'fice instead. +While it is possible to look inside the ffi ligature and find out where the original hyphen character was placed (between the first f and the following component fi), it is very hard to draw the line indicating the hyphenation point correctly. The ffi ligature is one @@ -67,6 +68,15 @@ pure luck, and therefore out of the scope of the package. \section{Changes} \begin{changelog} +\begin{release}{0.5b}{2016-02-05} + \item Fix version number +\end{release} +\begin{release}{0.5a}{2016-02-05} + \item Remove debug message +\end{release} +\begin{release}{0.5}{2016-02-05} + \item Mark ligatures +\end{release} \begin{release}{0.4a}{2015-09-23} \item Documentation update. \end{release} @@ -83,7 +93,7 @@ pure luck, and therefore out of the scope of the package. \section{Copying} -Copyright 2011-2014 Patrick Gundlach (patrick@gundla.ch), licensed under the MIT license. See the style for details. +Copyright 2011-2016 Patrick Gundlach (patrick@gundla.ch), licensed under the MIT license. See the style for details. \end{document} diff --git a/Master/texmf-dist/tex/lualatex/showhyphens/showhyphens.sty b/Master/texmf-dist/tex/lualatex/showhyphens/showhyphens.sty index b8e0c480851..cf1cf02006a 100644 --- a/Master/texmf-dist/tex/lualatex/showhyphens/showhyphens.sty +++ b/Master/texmf-dist/tex/lualatex/showhyphens/showhyphens.sty @@ -1,8 +1,8 @@ -\ProvidesPackage{showhyphens}[2015/09/23 v0.4a Show hyphenation points (PGU)] +\ProvidesPackage{showhyphens}[2016/02/05 v0.5b Show hyphenation points (PGU)] \RequirePackage{ifluatex,luatexbase} % License: MIT style license -% Copyright (c) 2011-2015 Patrick Gundlach patrick@gundla.ch +% Copyright (c) 2011-2016 Patrick Gundlach patrick@gundla.ch % 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, @@ -26,25 +26,46 @@ local show_hyph local hlist_node = node.id("hlist") local vlist_node = node.id("vlist") local disc_node = node.id("disc") +local glyph_node = node.id("glyph") + +local function round(num) + return math.floor(num * 10^3 + 0.5) / 10^3 +end show_hyph = function(head) while head do if head.id == hlist_node or head.id == vlist_node then - show_hyph(head.head) + show_hyph(head.list) elseif head.id == disc_node then - local n = node.new("whatsit","pdf_literal") - n.mode = 0 - n.data = "q \lua@SHcolor RG 0.3 w 0 2 m 0 7 l S Q" - n.next = head.next - head.next.prev = n - n.prev = head - head.next = n - head = n + if head.replace and head.replace.id == glyph_node and head.replace.components then + local wd = round(head.replace.width / 65781) or 0 + local ht = round(head.replace.height / 65781) + 0.5 or 0 + local r = node.new("whatsit","pdf_literal") + r.data = "q 0.3 w 0 " .. tostring(ht) .. " m " .. tostring(-wd) .. " " .. tostring(ht) .. " l S Q" + node.insert_after(head.replace,head.replace,r) + else + local n = node.new("whatsit","pdf_literal") + n.mode = 0 + n.data = "q \lua@SHcolor RG 0.3 w 0 2 m 0 7 l S Q" + n.next = head.next + head.next.prev = n + n.prev = head + head.next = n + head = n + end end head = head.next end return true end + +require("viznodelist") + +showme = function(head) + + viznodelist.nodelist_visualize(head,"mybox.dot") +end + luatexbase.add_to_callback("post_linebreak_filter",show_hyph,"show_hyph") } \else -- cgit v1.2.3