texlive[63550] Master: showhyphenation (11jun22)

commits+karl at tug.org commits+karl at tug.org
Sat Jun 11 22:42:22 CEST 2022


Revision: 63550
          http://tug.org/svn/texlive?view=revision&revision=63550
Author:   karl
Date:     2022-06-11 22:42:22 +0200 (Sat, 11 Jun 2022)
Log Message:
-----------
showhyphenation (11jun22)

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/lualatex/showhyphenation/
    trunk/Master/texmf-dist/doc/lualatex/showhyphenation/DEPENDS.txt
    trunk/Master/texmf-dist/doc/lualatex/showhyphenation/README.md
    trunk/Master/texmf-dist/doc/lualatex/showhyphenation/showhyphenation.pdf
    trunk/Master/texmf-dist/doc/lualatex/showhyphenation/showhyphenation.tex
    trunk/Master/texmf-dist/tex/lualatex/showhyphenation/
    trunk/Master/texmf-dist/tex/lualatex/showhyphenation/showhyphenation.lua
    trunk/Master/texmf-dist/tex/lualatex/showhyphenation/showhyphenation.sty
    trunk/Master/tlpkg/tlpsrc/showhyphenation.tlpsrc

Added: trunk/Master/texmf-dist/doc/lualatex/showhyphenation/DEPENDS.txt
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/showhyphenation/DEPENDS.txt	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/showhyphenation/DEPENDS.txt	2022-06-11 20:42:22 UTC (rev 63550)
@@ -0,0 +1 @@
+ifluatex
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/lualatex/showhyphenation/DEPENDS.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/showhyphenation/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/showhyphenation/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/showhyphenation/README.md	2022-06-11 20:42:22 UTC (rev 63550)
@@ -0,0 +1,20 @@
+The package shows the hyphenation points in the document
+by either inserting small triangles below the baseline or
+by typesetting explicit hyphens.
+The markers are correctly placed even within ligatures and
+their size adjusts to the font size. By option the markers
+can be placed behind or in front of the glyphs.
+The package requires LuaLaTeX.
+
+Copyright (c) 2022 Thomas Kelkel kelkel at emaileon.de
+
+The files of this package may be distributed and/or
+modified under the conditions of the LaTeX Project
+Public License, either version 1.3c of this license
+or (at your option) any later version. The latest
+version of this license is in
+
+   http://www.latex-project.org/lppl.txt
+
+and version 1.3c or later is part of all distributions
+of LaTeX version 2009/09/24 or later.
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/lualatex/showhyphenation/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/showhyphenation/showhyphenation.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/lualatex/showhyphenation/showhyphenation.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/showhyphenation/showhyphenation.pdf	2022-06-11 20:41:57 UTC (rev 63549)
+++ trunk/Master/texmf-dist/doc/lualatex/showhyphenation/showhyphenation.pdf	2022-06-11 20:42:22 UTC (rev 63550)

Property changes on: trunk/Master/texmf-dist/doc/lualatex/showhyphenation/showhyphenation.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/lualatex/showhyphenation/showhyphenation.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/showhyphenation/showhyphenation.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/lualatex/showhyphenation/showhyphenation.tex	2022-06-11 20:42:22 UTC (rev 63550)
@@ -0,0 +1,412 @@
+\documentclass[
+ukenglish,%
+twoside=false,%
+fontsize=10pt,%
+bibliography=totoc,%
+numbers=autoenddot,%
+headings=normalsize,%
+overfullrule,%
+headings=optiontotoc,%
+]
+{scrartcl}
+
+\makeatletter
+\providecommand\@ix{9.6}
+\providecommand\@xi{10.4}
+\providecommand\@xiii{13.15}
+\def\subfootnotesize{%
+    \@setfontsize%
+    \subfootnotesize%
+    {7.6}{8}%
+}
+\def\supernormalsize{%
+    \@setfontsize%
+    \supernormalsize%
+    \@xi{12}%
+}
+\def\subnormalsize{%
+    \@setfontsize%
+    \subnormalsize%
+    \@ix{11}%
+}
+\def\sublarge{%
+    \@setfontsize%
+    \sublarge%
+    {11.2}{13}%
+}
+\def\superlarge{%
+    \@setfontsize%
+    \superlarge%
+    \@xiii{16}%
+}
+\makeatother
+
+\newcommand*{\sectionas}{2.3ex plus .2ex}
+\newcommand*{\sectionbs}{-3.5ex plus -1ex minus -.2ex}
+\newcommand*{\sectiontbs}{3.6pt}
+\newcommand*{\subsectiontbs}{1.2pt}
+\newcommand*{\subsectionas}{1.5ex plus .2ex}
+\newcommand*{\subsectionbs}{-3.25ex plus -1ex minus -.2ex}
+\newcommand*{\subsubsectionas}{\subsectionas}
+\newcommand*{\subsubsectionbs}{\subsectionbs}
+\newcommand*{\paragraphas}{-1em}
+\newcommand*{\paragraphbs}{.8\baselineskip}
+
+\newlength{\tnwsection}
+\newlength{\tnwsubsection}
+\newlength{\tnwsubsubsection}
+\newlength{\tnwparagraph}
+\newlength{\tisection}
+\newlength{\tisubsection}
+\newlength{\tisubsubsection}
+\newlength{\tiparagraph}
+
+\setlength{\tnwsection}{1.2em}
+\addtolength{\tnwsection}{.6em}
+\setlength{\tnwsubsection}{\tnwsection}
+\addtolength{\tnwsubsection}{.75em}
+\setlength{\tnwsubsubsection}{\tnwsubsection}
+\addtolength{\tnwsubsubsection}{.75em}
+\setlength{\tnwparagraph}{\tnwsubsubsection}
+\addtolength{\tnwparagraph}{.75em}
+
+\setlength{\tisection}{0em}
+\setlength{\tisubsection}{\tisection}
+\addtolength{\tisubsection}{\tnwsection}
+\setlength{\tisubsubsection}{\tisubsection}
+\addtolength{\tisubsubsection}{\tnwsubsection}
+\setlength{\tiparagraph}{\tisubsubsection}
+\addtolength{\tiparagraph}{\tnwsubsubsection}
+
+\RedeclareSectionCommands[%
+    tocraggedentrytext=true,%
+]%
+{section,subsection,subsubsection,paragraph}
+
+\RedeclareSectionCommand[%
+    tocindent=\tisection,%
+    tocnumwidth=\tnwsection,%
+    tocbeforeskip=\sectiontbs,%
+    tocentryformat=\supernormalsize\sffamily\bfseries,%
+    tocentrynumberformat=\supernormalsize\sffamily\bfseries,%
+    tocpagenumberformat=\supernormalsize\sffamily\bfseries%
+]%
+{section}
+
+\RedeclareSectionCommand[%
+    tocindent=\tisubsection,%
+    tocnumwidth=\tnwsubsection,%
+    tocbeforeskip=\subsectiontbs,%
+    tocentryformat=\subnormalsize,%
+    tocentrynumberformat=\subnormalsize,%
+    tocpagenumberformat=\subnormalsize%
+]%
+{subsection}
+
+\RedeclareSectionCommand[%
+    tocindent=\tisubsubsection,%
+    tocnumwidth=\tnwsubsubsection,%
+    tocbeforeskip=\sectiontbs%
+]%
+{subsubsection}
+
+\RedeclareSectionCommand[%
+    afterskip=\paragraphas,%
+    beforeskip=\paragraphbs,%
+    tocindent=\tiparagraph,%
+    tocnumwidth=\tnwparagraph,%
+    tocbeforeskip=\sectiontbs%
+]%
+{paragraph}
+
+\linespread{1.1}
+
+\newcommand*{\hs}{\hspace{.45em}}
+
+\usepackage{fontspec}
+
+\directlua{
+
+    fonts.handlers.otf.addfeature {
+        name = "onumkern",
+        type = "kern",
+        data = {
+            ["v"] = { ["zero.taboldstyle"] = 80 },
+            ["two.taboldstyle"] = { ["zero.taboldstyle"] = 30, ["/"] = 50 },
+            ["five.taboldstyle"] = { ["/"] = 20 },
+            ["»"] = { ["I"] = 50 },
+        },
+    }
+
+}
+
+\setmainfont{Tangent}[
+    BoldFont = *-Medium,
+    ItalicFont = *-Italic,
+    Ligatures = {Common, TeX},
+    Numbers = OldStyle,
+    RawFeature = +onumkern
+]
+
+\setsansfont{SegoeUI}[
+    BoldFont = seguisb.ttf,
+    Ligatures = {Discretionary, TeX},
+    Numbers = OldStyle
+]
+
+\setmonofont{Consolas}[
+    ItalicFont = *-Italic,
+    Numbers = OldStyle
+]
+
+\newcommand*{\mono}[1]{%
+    {\subnormalsize\texttt{#1}}%
+}
+
+\usepackage{babel}
+\usepackage[paper=a4paper,marginratio={2:1,3:4}]{geometry}
+\usepackage{spacekern}
+\usepackage{hyperref}
+\usepackage{bookmark}
+\usepackage{microtype}
+
+\hypersetup{%
+    pdflang=en,%
+    unicode=true,%
+	pdfborder={0 0 0},%
+	bookmarksopen=true,%
+    bookmarksopenlevel=0,%
+	bookmarksnumbered=true,%
+    pdftitle={The showhyphenation package},
+    pdfsubject={Marking of hyphenation points},
+    pdfauthor={Thomas Kelkel},
+    pdfkeywords={tex, latex, hyphenation}
+}
+
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{.4\baselineskip}
+
+\newcommand*{\q}[1]{%
+    ›%
+    #1%
+    ‹%
+}
+\newcommand*{\qq}[1]{%
+    »%
+    #1%
+    «%
+}
+
+\newcommand*{\textnote}[1]{%
+    {%
+        \ttfamily%
+        \char174{}%
+        #1%
+        \char174{}%
+    }%
+}
+
+\usepackage{luacode}
+
+\begin{luacode}
+
+local FLOOR = math.floor
+
+local function round ( num, dec )
+    return FLOOR ( num * 10^dec + 0.5 ) / 10^dec
+end
+
+local p_array = {false, false, false, false, false}
+local p_counter = 0
+local ID = node.id
+local NEW = node.new
+local COPY = node.copy
+local REM = node.remove
+local PREV = node.prev
+local NEXT = node.next
+local TAIL = node.tail
+local T_ID = node.traverse_id
+local T_GLYPH = node.traverse_glyph
+local INS_B = node.insert_before
+local GLYPH = ID ( "glyph" )
+local GLUE = ID ( "glue" )
+local KERN = ID ( "kern" )
+local HLIST = ID ( "hlist" )
+local SWAPPED = table.swapped
+local SUBTYPES = node.subtypes
+local SPACESKIP = SWAPPED ( SUBTYPES ("glue") )["spaceskip"]
+local WIDTH = round ( tex.sp ( "1.6em" ), 0 )
+local ipairs = ipairs
+local page_counter = 0
+local INS_A = node.insert_after
+local p_counter_x = 0
+local ATC = luatexbase.add_to_callback
+
+local function make_marks ( head, char, id, array, counter )
+    for n in T_GLYPH ( head ) do
+        if n.char == char then
+            counter = counter + 1
+            array[counter] = {false, false, false}
+            head = INS_B ( head, n, NEW ( GLYPH ) )
+            PREV ( n ).data = id
+            local NEXT = n.next
+            local inside_counter = 0
+            while NEXT.char ~= char do
+                inside_counter = inside_counter + 1
+                array[counter][inside_counter] = COPY ( NEXT )
+                NEXT = NEXT.next
+                REM ( head, NEXT.prev )
+            end
+            head = REM ( head, NEXT )
+            head = REM ( head, n )
+        end
+    end
+    return head, array, counter
+end
+
+local function mark_notes ( head )
+    head, p_array, p_counter = make_marks ( head, 174, 427956, p_array, p_counter )
+    return head
+end
+
+local function make_margin_notes ( head, id, array, counter )
+    for n in T_ID ( HLIST, head ) do
+        local first_kern = 0
+        local first_width = 0
+        for glyph_node in T_GLYPH ( n.head ) do
+            if glyph_node.data == id then
+                counter = counter + 1
+                local tail_node = TAIL ( n.head )
+                local glue_node = NEW ( GLUE )
+                glue_node.subtype = SPACESKIP
+                glue_node.width = WIDTH
+                local NEXT
+                local switch_counter = 1 -- page_counter
+                n.head = INS_A ( n.head, TAIL ( n.head ), glue_node )
+                if ( switch_counter % 2 == 0 ) then
+                    NEXT = glue_node
+                else
+                    NEXT = tail_node
+                end
+                local kern_value = 0
+                for _, value in ipairs ( array[counter] ) do
+                    if value ~= false then
+                        local NUMBER = COPY ( value )
+                            n.head = INS_A ( n.head, NEXT, NUMBER)
+                            if NEXT.next then
+                                NEXT = NEXT.next
+                            end
+                        if NUMBER.width then
+                            kern_value = kern_value - NUMBER.width
+                        end
+                    end
+                end
+                local kern_node = NEW ( KERN )
+                kern_node.kern = kern_value - glue_node.width
+                if switch_counter % 2 ~= 0  then
+                    kern_node.kern = kern_node.kern - tex.hsize + first_kern
+                    n.head = INS_A ( n.head, tail_node, kern_node )
+                end
+                if ( switch_counter % 2 == 0 ) and ( first_kern < 0 ) then
+                    kern_node.kern = kern_node.kern - first_kern + first_width - kern_value
+                    n.head = INS_A ( n.head, tail_node, kern_node )
+                end
+                first_kern = kern_node.kern
+                first_width = kern_value
+            end
+        end
+    end
+    return head, counter
+end
+
+local function make_text_notes ( head )
+    page_counter = page_counter + 1
+    head, p_counter_x = make_margin_notes ( head, 427956, p_array, p_counter_x )
+    return head
+end
+
+    ATC ( "ligaturing", mark_notes , "mark notes" )
+    ATC ( "pre_output_filter", make_text_notes , "count pages" )
+
+\end{luacode}
+
+\flushbottom
+
+\RedeclareSectionCommand[%
+    afterskip=1.3ex plus .2ex,%
+    beforeskip=-2.5ex plus -1ex minus -.2ex,%
+    font=\superlarge%
+]%
+{section}
+
+\RedeclareSectionCommand[%
+    beforeskip=.5\baselineskip%
+]%
+{paragraph}
+
+\usepackage{showhyphenation}
+
+\hyphenation{package}
+
+\begin{document}
+
+\title{The showhyphenation package\vspace{.25\baselineskip}\\\superlarge{}\directlua{luatexbase.remove_from_callback ( "post_linebreak_filter", "show hyphenation points in postline" ) luatexbase.remove_from_callback ( "hpack_filter", "show hyphenation points in hpack" )}Marking of hyphenation points}%
+\author{\sublarge{}Thomas Kelkel\vspace{-.25\baselineskip}\\\sublarge{}kelkel at emaileon.de\vspace{-.25\baselineskip}}%
+\date{\addfontfeature{LetterSpace=2}\sublarge{}2022/05/31\quad{}v0.1}%
+\maketitle
+
+\hyphenation{pack-age}
+
+\section{Introduction}
+
+This package shows the hyphenation points in the document.% Optionally either by markers below the baseline, or by explicit hyphens in the text.
+
+There is already the \mono{showhyphens} package by Patrick Gundlach, which provides similar functionality. However, the \mono{showhyphenation} package differs by a number of improvements and enhancements:
+
+\paragraph{Visibility}
+
+The size of the markers adjusts to the font size. Furthermore, the markers do not cover the glyphs.
+
+\paragraph{Ligatures}
+
+The markers are correctly placed even within ligatures and there are no issues with kern nodes next to ligatures.
+
+\paragraph{Explicit hyphens}
+
+The \mono{make} option allows the user to have the hyphenation points typeset as explicit hyphens in the text.
+
+%The hyphenation package offers the feature to typeset the hyphenation points as explicit hyphens in the text.
+
+\section{Basic usage}
+
+To load the package, simply add the following line to the preamble of the document:
+
+\begin{quote}
+    \mono{\textbackslash{}usepackage\{showhyphenation\}}
+\end{quote}
+
+\section{Package options}
+
+Options can be loaded by adding them comma separated within square brackets:
+
+\begin{quote}
+    \mono{\textbackslash{}usepackage[\textit{<option1>,<option2>,…}]\{showhyphenation\}}
+\end{quote}
+
+\addcontentsline{toc}{subsection}{make}
+
+\textnote{make}By default, hyphenation points are marked by triangles below the baseline. Loading this option will typeset them as hyphens instead.
+
+\addcontentsline{toc}{subsection}{ontop}
+
+\textnote{ontop}By default, the triangles are placed behind the glyphs. With this option they are in front of them.
+
+\addcontentsline{toc}{subsection}{lime}
+
+\textnote{lime}Changes the color of the markers from raspberry to lime.
+
+\section{License}
+
+This package is copyright © 2022 Thomas Kelkel. It may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license or (at your option) any later version. This work has the LPPL maintenance status \qq{author maintained}.
+
+\end{document}
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/lualatex/showhyphenation/showhyphenation.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/lualatex/showhyphenation/showhyphenation.lua
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/showhyphenation/showhyphenation.lua	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/lualatex/showhyphenation/showhyphenation.lua	2022-06-11 20:42:22 UTC (rev 63550)
@@ -0,0 +1,263 @@
+-- Copyright (c) 2022 Thomas Kelkel kelkel at emaileon.de
+
+-- This file may be distributed and/or modified under the
+-- conditions of the LaTeX Project Public License, either
+-- version 1.3c of this license or (at your option) any later
+-- version. The latest version of this license is in
+
+--    http://www.latex-project.org/lppl.txt
+
+-- and version 1.3c or later is part of all distributions of
+-- LaTeX version 2009/09/24 or later.
+
+-- Version: 0.1
+
+local FLOOR = math.floor
+
+local function round ( num, dec )
+    return FLOOR ( num * 10^dec + 0.5 ) / 10^dec
+end
+
+local ID = node.id
+local GLYPH = ID ( "glyph" )
+local DISC = ID ( "disc" )
+local KERN = ID ( "kern" )
+local GLUE = ID ( "glue" )
+local WI = ID ( "whatsit" )
+local HLIST = ID ( "hlist" )
+local VLIST = ID ( "vlist" )
+local RIGHTSKIP = table.swapped ( node.subtypes ("glue") )["rightskip"]
+local NEW = node.new
+local COPY = node.copy
+local REM = node.remove
+local PREV = node.prev
+local NEXT = node.next
+local HAS_GLYPH = node.has_glyph
+local INS_B = node.insert_before
+local INS_A = node.insert_after
+local T = node.traverse
+local T_ID = node.traverse_id
+local T_GLYPH = node.traverse_glyph
+local WIS = node.whatsits()
+local pdfliteral
+local pairs = pairs
+local GET_FONT = font.getfont
+local ATC = luatexbase.add_to_callback
+
+local make = false
+local on_top = false
+local DIR = PREV
+local AB = INS_B
+local f = 1
+local color = "1 .25 .45"
+
+function make_not_on_top ()
+    on_top = false
+    DIR = PREV
+    AB = INS_B
+    f = 1
+end
+
+function make_on_top ()
+    on_top = true
+    DIR = NEXT
+    AB = INS_A
+    f = - 1
+end
+
+local in_use = make_not_on_top
+
+for key, value in pairs ( WIS ) do
+    if value == "pdf_literal" then
+        pdfliteral = key
+    end
+end
+
+function showhyphenation_make ()
+    make = true
+end
+
+function showhyphenation_on_top ()
+    in_use = make_on_top
+    in_use()
+end
+
+function showhyphenation_lime ()
+    color = ".75 1 .25"
+end
+
+local function calc_value ( value )
+    value = round ( value / 65536, 3 )
+    return value
+end
+
+local function get_x_value ( n, x_value, minus )
+    local exp_fac = 1
+    local f = 1
+    if minus then
+        f = - 1
+    end
+    if n.expansion_factor then
+        exp_fac = n.expansion_factor / 1000000 + 1
+    end
+    if n.id == GLYPH then
+        x_value = x_value + calc_value ( n.width ) * exp_fac * f
+    elseif n.id == KERN then
+        x_value = x_value + calc_value ( n.kern ) * exp_fac * f
+    end
+    return x_value
+end
+
+local line_end_count = 0
+
+local function find_glyph ( n, d, kern_value )
+    local line_end = nil
+    local ligtype_mark = nil
+    if d ( n ) then
+        n = d ( n )
+        while not ( ( n.id == GLYPH and n.char ~= 45 ) or ( n.id == DISC and n.replace and HAS_GLYPH ( n.replace ) ) ) do
+            if n.width and not ( n.char and n.char == 45 ) then
+                kern_value = get_x_value ( n, kern_value ) -- rules, etc.
+            elseif n.kern then
+                kern_value = get_x_value ( n, kern_value ) * 0.5 -- hyphen kern
+            end
+            if n.char == 45 then
+                line_end = true
+                line_end_count = line_end_count + 1
+            end
+            if line_end and n.user_id == 848485 then
+                ligtype_mark = true
+            end
+            n = d ( n )
+        end
+        if n.replace then
+            local REPLACE = n.replace
+            for some_node in T ( REPLACE ) do
+                if some_node.width then
+                    kern_value = get_x_value ( some_node, kern_value )
+                elseif some_node.kern then
+                    kern_value = get_x_value ( some_node, kern_value )
+                end
+            end
+        else
+            if n.width then
+                kern_value = get_x_value ( n, kern_value )
+            end
+        end
+    end
+    return n, kern_value, ligtype_mark
+end
+
+local function check_linebreak ( n, d )
+    while n.id ~= GLYPH do
+        if d ( n ) then
+            n = d ( n )
+        else break end
+    end
+    if ( n.char == 45 and d == PREV ) or ( n.id == GLUE and n.subtype == RIGHTSKIP and d == NEXT ) then
+        make_not_on_top()
+        return true
+    end
+end
+
+local function hyphenation_points ( head )
+    for n in T ( head ) do
+        if n.id == HLIST or n.id == VLIST then
+            n.head = hyphenation_points ( n.head )
+        elseif n.id == DISC then
+            check_linebreak ( n, PREV )
+            check_linebreak ( n, NEXT )
+            local lig_add = 0
+            local prev_next_kern = 0
+            local prev_next_kern_lig = 0
+            if n.replace then
+                if not HAS_GLYPH ( n.replace ) then
+                    local REPLACE = n.replace
+                    for some_node in T ( REPLACE ) do
+                        if some_node.kern and not ( check_linebreak ( n, DIR ) ) then
+                            prev_next_kern_lig = get_x_value ( some_node, prev_next_kern_lig ) * 0.5
+                        end
+                    end
+                else
+                    if n.post then
+                        for glyph_node in T_GLYPH ( n.pre ) do
+                            if glyph_node.width then
+                                lig_add = get_x_value ( glyph_node, lig_add )
+                                break -- hyphen!
+                            end
+                        end
+                        if not on_top then
+                            if n.replace.kern then
+                                prev_next_kern_lig = get_x_value ( n.replace, prev_next_kern_lig )
+                            end
+                        end
+                    else
+                        if n.replace.kern then
+                            prev_next_kern_lig = get_x_value ( n.replace, prev_next_kern_lig ) * 0.5
+                        end
+                        for glyph_node in T_GLYPH ( n.replace ) do -- short-armed f
+                            if glyph_node.char ~= 45 then
+                                lig_add = get_x_value ( glyph_node, lig_add )
+                            end
+                        end
+                    end
+                    if on_top then
+                        for some_node in T ( n.replace ) do
+                            if some_node.width then
+                                lig_add = get_x_value ( some_node, lig_add, true )
+                            elseif some_node.kern and some_node ~= n.replace then
+                                lig_add = get_x_value ( some_node, lig_add, true )
+                            end
+                        end
+                    end
+                end
+            end
+            local prev_next_glyph = n
+            local ligtype_mark = nil
+            prev_next_glyph, prev_next_kern, ligtype_mark = find_glyph ( prev_next_glyph, DIR, 0 )
+            head = AB ( head, prev_next_glyph, NEW ( WI, pdfliteral ) )
+            lig_add = lig_add + ( prev_next_kern + prev_next_kern_lig ) * f
+            DIR ( prev_next_glyph ).mode = 0
+            local size_factor = 1
+            if font.current() then
+                size_factor = calc_value ( GET_FONT ( font.current() ).size / 10 )
+            end
+            local DATA
+            if ( PREV ( n ) and PREV ( n ).user_id and PREV ( n ).user_id == 848485 ) or ligtype_mark then
+                DATA = "q " .. ( lig_add - 2 * size_factor ) ..  " " .. -3 * size_factor .. " m " .. ( lig_add + 2 * size_factor ) ..  " " .. -3 * size_factor .. " l " .. ( lig_add + 2 * size_factor ) .. " " .. -4 * size_factor .. " l " .. ( lig_add - 2 * size_factor ) ..  " " .. -4 * size_factor .. " l " .. color .. " rg f Q"
+            else
+                DATA = "q " .. lig_add ..  " 0 m " .. lig_add + 2 * size_factor ..  " " .. -3 * size_factor .. " l " .. lig_add - 2 * size_factor .. " " .. -3 * size_factor .. " l " .. color .. " rg f Q"
+            end
+            DIR ( prev_next_glyph ).data = DATA
+            in_use()
+        end
+    end
+    return head
+end
+
+local function make_hyphens ( head )
+    for n in T_ID ( DISC, head ) do
+        local REPLACE = n.replace
+        for some_node in T ( REPLACE ) do
+            REM ( REPLACE, some_node )
+        end
+        local PRE = n.pre
+        for some_node in T_GLYPH ( PRE ) do
+            REPLACE = INS_A ( REPLACE, REPLACE, COPY ( some_node ) )
+        end
+        local POST = n.post
+        for some_node in T_GLYPH ( POST ) do
+            REPLACE = INS_A ( REPLACE, REPLACE, COPY ( some_node ) )
+        end
+        n.replace = REPLACE
+    end
+end
+
+function showhyphenation_start ()
+    if make then
+        ATC ( "ligaturing", make_hyphens, "make hyphens" )
+    else
+        ATC ( "post_linebreak_filter", hyphenation_points, "show hyphenation points in postline", 1 )
+        ATC ( "hpack_filter", hyphenation_points, "show hyphenation points in hpack" )
+    end
+end
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/lualatex/showhyphenation/showhyphenation.lua
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/lualatex/showhyphenation/showhyphenation.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/showhyphenation/showhyphenation.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/lualatex/showhyphenation/showhyphenation.sty	2022-06-11 20:42:22 UTC (rev 63550)
@@ -0,0 +1,28 @@
+% Copyright (c) 2022 Thomas Kelkel kelkel at emaileon.de
+
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3c of this license or (at your option) any later
+% version. The latest version of this license is in
+
+%    http://www.latex-project.org/lppl.txt
+
+% and version 1.3c or later is part of all distributions of
+% LaTeX version 2009/09/24 or later.
+
+\ProvidesPackage{showhyphenation}[2022/04/17 v0.1 Show hyphenation points]
+\RequirePackage{ifluatex,luatexbase}
+
+\ifluatex
+    \directlua{require ( "showhyphenation.lua" )}
+
+    \DeclareOption{make}{\directlua{showhyphenation_make()}}
+    \DeclareOption{ontop}{\directlua{showhyphenation_on_top()}}
+    \DeclareOption{lime}{\directlua{showhyphenation_lime()}}
+    \ProcessOptions
+
+    \directlua{showhyphenation_start()}
+\else
+    \errhelp{Compile with LuaLaTeX to be able to use the "showhyphenation" package.}
+    \errmessage{Package "showhyphenation" error: This package requires LuaLaTeX!}
+\fi
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/lualatex/showhyphenation/showhyphenation.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/tlpkg/tlpsrc/showhyphenation.tlpsrc
===================================================================


More information about the tex-live-commits mailing list.