texlive[46641] Master/texmf-dist: typewriter (14feb18)

commits+karl at tug.org commits+karl at tug.org
Wed Feb 14 22:34:24 CET 2018


Revision: 46641
          http://tug.org/svn/texlive?view=revision&revision=46641
Author:   karl
Date:     2018-02-14 22:34:24 +0100 (Wed, 14 Feb 2018)
Log Message:
-----------
typewriter (14feb18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.pdf
    trunk/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.tex
    trunk/Master/texmf-dist/tex/lualatex/typewriter/typewriter.sty

Modified: trunk/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.tex
===================================================================
--- trunk/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.tex	2018-02-14 21:34:13 UTC (rev 46640)
+++ trunk/Master/texmf-dist/doc/lualatex/typewriter/typewriter-guide.tex	2018-02-14 21:34:24 UTC (rev 46641)
@@ -5,7 +5,7 @@
 \begin{document}
 \title{The Typewriter Package for LaTeX}
 \author{David Carlisle \thanks{https://github.com/davidcarlisle/dpctex/}}
-\date{2018-02-07}
+\date{2018-02-10}
 
 \maketitle
 
@@ -19,21 +19,41 @@
 
 \hrule
 
-Currently there are no options to the package, it just does what it does,
-Possibly later versions might document how to modify the amount of random distortion that is applied.
+Currently there are no options to the package, However there are several parameters that control the offsets
+and grey levels used to generate the variation. Any of the following
+commands may be defined before loading the package to change the defaults shown below.
 
+\begin{verbatim}
+\providecommand\ttgreyone{0.6}
+\providecommand\ttgreytwo{0.3}
+\providecommand\ttrotatebold{12}
+\providecommand\ttdownbold{20000}
+\providecommand\ttrightbold{35000}
+\providecommand\ttdownshifttwo{20000}
 
+\providecommand\ttrotatenormal{8}
+\providecommand\ttrightnormal{20000}
+\providecommand\ttdownnormal{20000}
+\end{verbatim}
+
+The grey levels should be between 0 and 1 and control the maximim
+amount grey level.
+
+The rotate values can be any angle (measured degrees), but setting values more than 20 makes the text more or less unreadable.
+
+The right and down offsets (which are in the font design units) control the
+maximum horizontal and vertical offsets of the overprinted characters
+
 There is random variability in each letter as you can see by repeating
 a letter repeatededly:
 
 OOOOOOOOOOOOONNNNNNNNNNNNNNEEEEEEEEEE
 
-TTTTTTTTTTTTooooooooooooooooowwwwwwwwwwwwwwwwwwww
+TTTTTTTTTTTTwwwwwwwwwwwwwwwwwwwwooooooooooooooooo
 
 
 
 
-
 \subsection{Text}
 
 one two three

Modified: trunk/Master/texmf-dist/tex/lualatex/typewriter/typewriter.sty
===================================================================
--- trunk/Master/texmf-dist/tex/lualatex/typewriter/typewriter.sty	2018-02-14 21:34:13 UTC (rev 46640)
+++ trunk/Master/texmf-dist/tex/lualatex/typewriter/typewriter.sty	2018-02-14 21:34:24 UTC (rev 46641)
@@ -4,15 +4,23 @@
 % See http://tex.stackexchange.com/questions/344214/use-latex-to-simulate-old-typewriter-written-texts
 
 
-\ProvidesPackage{typewriter}[2018-02-07 v1.0 typewriter package]
+\ProvidesPackage{typewriter}[2018-02-10 v1.1 typewriter package]
 
 \ifx\directlua\@undefined
 \endinput\PackageError{typewriter}{LuaLaTeX required for this package}\@ehc\fi
 
+\providecommand\ttgreyone{0.6}
+\providecommand\ttgreytwo{0.3}
+\providecommand\ttrotatebold{12}
+\providecommand\ttdownbold{20000}
+\providecommand\ttrightbold{35000}
+\providecommand\ttdownshifttwo{20000}
 
 
+\providecommand\ttrotatenormal{8}
+\providecommand\ttrightnormal{20000}
+\providecommand\ttdownnormal{20000}
 
-
 % luaotfload exlicitly loaded for latex formats before 2017/01/01
 \usepackage{luaotfload}
 
@@ -38,12 +46,12 @@
               f.type = 'virtual'
               f.fonts = {{ name = 'file:cmuntt', size = size}}
 for j,v in pairs(f.characters) do
-  local gr = 0.1*math.random()
-  local gr2 = 0.3*math.random()
+  local gr = \ttgreyone*math.random()
+  local gr2 = \ttgreytwo*math.random()
 if name == 'cmtt10bx' then
                        v.commands = {
 {'lua','
-  r1 = 0.01*math.random(-10,10)
+  r1 = math.rad(0.1*\ttrotatebold*math.random(-10,10))
 pdf.print
 (string.format(" q \%f \%f \%f \%f 0 0 cm ",
 math.cos(r1), - math.sin(r1), math.sin(r1), math.cos(r1)
@@ -50,22 +58,22 @@
 ))'},
                            {'special','pdf: ' .. string.format("\%f",gr2) .. ' g'},
 {'push'},
-{'right', math.random(-35000,35000)},
-{'down', math.random(-20000,20000)},
+{'right', math.random(-\ttrightbold,\ttrightbold)},
+{'down', math.random(-\ttdownbold,\ttdownbold)},
                            {'char',j},
 {'pop'},
 {'push'},
-{'right', math.random(-35000,35000)},
-{'down', math.random(-20000,20000)},
+{'right', math.random(-\ttrightbold,\ttrightbold)},
+{'down', math.random(-\ttdownbold,\ttdownbold)},
                            {'char',j},
 {'pop'},
 {'push'},
-{'right', math.random(-35000,35000)},
-{'down', math.random(-20000,20000)},
+{'right', math.random(-\ttrightbold,\ttrightbold)},
+{'down', math.random(-\ttdownbold,\ttdownbold)},
                            {'char',j},
 {'pop'},
 {'lua','pdf.print(" Q ")'},
-{'down', math.random(-20000,20000)},
+{'down', math.random(-\ttdownbold,\ttdownbold)},
                            {'special','pdf: ' .. string.format("\%f",gr) .. ' g'},
                            {'char',j},
                            {'special','pdf: 0 g'}
@@ -74,19 +82,19 @@
 else
                        v.commands = {
 {'lua','
-  r1 = 0.01*math.random(-10,10)
+  r1 = math.rad(0.1*\ttrotatenormal*math.random(-10,10))
 pdf.print
 (string.format(" q \%f \%f \%f \%f 0 0 cm ",
-math.cos(r1), - math.sin(r1), math.sin(r1), math.cos(r1)
+math.cos(r1), math.sin(r1), - math.sin(r1), math.cos(r1)
 ))'},
                            {'special','pdf: ' .. gr2 .. ' g'},
 {'push'},
-{'right', math.random(-20000,20000)},
-{'down', math.random(-20000,20000)},
+{'right', math.random(-\ttrightnormal,\ttrightnormal)},
+{'down', math.random(-\ttdownshifttwo,\ttdownshifttwo)},
                            {'char',j},
 {'pop'},
 {'lua','pdf.print(" Q ")'},
-{'down', math.random(-20000,20000)},
+{'down', math.random(-\ttdownnormal,\ttdownnormal)},
                            {'special','pdf: ' .. gr .. ' g'},
                            {'char',j},
                            {'special','pdf: 0 g'}
@@ -535,7 +543,8 @@
 \xUnicodeMathSymbol{"021CF}{\nRightarrow              }{\mathrel}{not implies}%
 \xUnicodeMathSymbol{"021D0}{\Leftarrow                }{\mathrel}{is implied by}%
 \xUnicodeMathSymbol{"021D1}{\Uparrow                  }{\mathrel}{up double arrow}%
-\xUnicodeMathSymbol{"021D2}{\Rightarrow               }{\mathrel}{implies}%
+%\xUnicodeMathSymbol{"021D2}{\Rightarrow               }{\mathrel}{implies}%
+\xxUnicodeMathSymbol{"02192}{\Rightarrow}{=>}
 \xUnicodeMathSymbol{"021D3}{\Downarrow                }{\mathrel}{down double arrow}%
 \xUnicodeMathSymbol{"021D4}{\Leftrightarrow           }{\mathrel}{left and right double arrow}%
 \xUnicodeMathSymbol{"021D5}{\Updownarrow              }{\mathrel}{up and down double arrow}%
@@ -615,7 +624,7 @@
 \xUnicodeMathSymbol{"02228}{\vee                      }{\mathbin}{/vee /lor b: logical or}%
 \xUnicodeMathSymbol{"02229}{\cap                      }{\mathbin}{intersection}%
 \xUnicodeMathSymbol{"0222A}{\cup                      }{\mathbin}{union or logical sum}%
-\xUnicodeMathSymbol{"0222B}{\int                      }{\mathop}{integral operator}%
+%\xUnicodeMathSymbol{"0222B}{\int                      }{\mathop}{integral operator}%
 \xUnicodeMathSymbol{"0222C}{\iint                     }{\mathop}{double integral operator}%
 \xUnicodeMathSymbol{"0222D}{\iiint                    }{\mathop}{triple integral operator}%
 \xUnicodeMathSymbol{"0222E}{\oint                     }{\mathop}{contour integral operator}%
@@ -2726,7 +2735,7 @@
 
 \let\oldhrule\hrule
 \def\hrule{\directlua{
-local h,w,d,hh,ww,dd
+local h,w,d,hh,ww,dd,lw
 h=token.scan_keyword("height")
 if(h) then
 hh=token.scan_dimen()
@@ -2739,10 +2748,51 @@
 if(w) then
 ww=token.scan_dimen()
 end
+if(not(h)) then
+h=token.scan_keyword("height")
+if(h) then
+hh=token.scan_dimen()
+end
+end
+if(not(d)) then
+d=token.scan_keyword("depth")
+if(d) then
+dd=token.scan_dimen()
+end
+end
+if(not(w)) then
+w=token.scan_keyword("width")
+if(w) then
+ww=token.scan_dimen()
+end
+end
+if(not(h)) then
+h=token.scan_keyword("height")
+if(h) then
+hh=token.scan_dimen()
+end
+end
+if(not(d)) then
+d=token.scan_keyword("depth")
+if(d) then
+dd=token.scan_dimen()
+end
+end
+if(not(w)) then
+w=token.scan_keyword("width")
+if(w) then
+ww=token.scan_dimen()
+end
+end
 %print('\string\n=====')
 %print('h' .. tostring(h) .. (hh or '*'))
 %print('d' .. tostring(d) .. (dd or '*'))
 %print('w' .. tostring(w) .. (ww or '*'))
 %print('=====\string\n')
-tex.sprint('\string\\par\string\\noindent\string\\leaders\string\\hbox{\string\\string_}\string\\hfill\string\\space')%
+if(ww) then
+lw="\string\\hskip " .. ww .. "sp\string\\hbox{}"
+else
+lw="\string\\hfill\string\\space"
+end
+tex.sprint('\string\\par\string\\noindent\string\\leaders\string\\hbox{\string\\string_}' .. lw)%
 }}
\ No newline at end of file



More information about the tex-live-commits mailing list