texlive[57412] Master/texmf-dist: pxpic (13jan21)
commits+karl at tug.org
commits+karl at tug.org
Wed Jan 13 23:13:55 CET 2021
Revision: 57412
http://tug.org/svn/texlive?view=revision&revision=57412
Author: karl
Date: 2021-01-13 23:13:54 +0100 (Wed, 13 Jan 2021)
Log Message:
-----------
pxpic (13jan21)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/pxpic/README.md
trunk/Master/texmf-dist/doc/latex/pxpic/pxpic.pdf
trunk/Master/texmf-dist/source/latex/pxpic/pxpic.dtx
trunk/Master/texmf-dist/tex/latex/pxpic/pxpic.sty
Modified: trunk/Master/texmf-dist/doc/latex/pxpic/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/pxpic/README.md 2021-01-13 22:13:25 UTC (rev 57411)
+++ trunk/Master/texmf-dist/doc/latex/pxpic/README.md 2021-01-13 22:13:54 UTC (rev 57412)
@@ -2,7 +2,7 @@
-------------------------------------------------------------------------------
# pxpic -- draw pixel pictures
-Version 2021-01-10 v1.0
+Version 2021-01-13 v1.1
Released under the LaTeX Project Public License v1.3c or later
See http://www.latex-project.org/lppl.txt
Modified: trunk/Master/texmf-dist/doc/latex/pxpic/pxpic.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/pxpic/pxpic.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/pxpic/pxpic.dtx 2021-01-13 22:13:25 UTC (rev 57411)
+++ trunk/Master/texmf-dist/source/latex/pxpic/pxpic.dtx 2021-01-13 22:13:54 UTC (rev 57412)
@@ -54,7 +54,7 @@
\expandafter\endgroup
\fi
%
-\ProvidesFile{pxpic.dtx}[2021-01-10 v1.0 draw pixel pictures]
+\ProvidesFile{pxpic.dtx}[2021-01-13 v1.1 draw pixel pictures]
\PassOptionsToPackage{full}{textcomp}
\documentclass{l3doc}
\RequirePackage[oldstylenums,nott]{kpfonts}
@@ -138,6 +138,7 @@
\DoNotIndex{\egroup,\ekvdef,\ekvdefNoVal,\ekvifdefinedNoVal,\ekvletkv,\ekvparse}
\DoNotIndex{\ekvsetdef,\endcsname,\endgroup,\expandafter}
\DoNotIndex{\hbox,\hskip}
+\DoNotIndex{\kern}
\DoNotIndex{\leavevmode,\let,\long,\lower}
\DoNotIndex{\newcommand,\newdimen}
\DoNotIndex{\PackageError,\protected,\ProvidesPackage}
@@ -172,6 +173,24 @@
{\end{description}}%
}
{\end{description}}
+^^A the following pixelart logo is taken from that package's dtx.
+\newcommand*\pixelart
+ {^^A
+ \leavevmode
+ \pxpic[mode=px,colours={M=black},skip=.,size=.15ex]
+ {
+ {MMMMMM...MM...................MMM.....M...............M}
+ {.MM..MM..MM....................MM....MMM.............MM}
+ {.MM..MM........................MM...MM.MM............MM}
+ {.MM..MM.MMM..MM....MM..MMMMM...MM..MM...MM.MM.MMM..MMMMMM}
+ {.MMMMM...MM...MM..MM..MM...MM..MM..MM...MM..MMM.MM...MM}
+ {.MM......MM....MMMM...MMMMMMM..MM..MMMMMMM..MM..MM...MM}
+ {.MM......MM.....MM....MM.......MM..MM...MM..MM.......MM}
+ {.MM......MM....MMMM...MM.......MM..MM...MM..MM.......MM}
+ {.MM......MM...MM..MM..MM...MM..MM..MM...MM..MM.......MM.MM}
+ {MMMM....MMMM.MM....MM..MMMMM..MMMM.MM...MM.MMMM.......MMM}
+ }^^A
+ }
\begin{document}
\title
{^^A
@@ -188,7 +207,7 @@
\Large draw pixel pictures^^A
}{pxpic - draw pixel pictures}^^A
}
- \date{2021-01-10 v1.0}
+ \date{2021-01-13 v1.1}
\author{Jonathan P. Spratte\thanks{\protect\randomize{jspratte at yahoo.de}}}
\DocInput{pxpic.dtx}
\end{document}
@@ -325,7 +344,7 @@
% }
% \end{minipage}
%
-% A heart (shamelessly copied example from \pkg{pixelart}):\par\nobreak
+% A heart (shamelessly copied example from \pixelart):\par\nobreak
% \noindent
% \begin{minipage}[c]{.5\linewidth}\footnotesize
% \begin{lstlisting}
@@ -555,6 +574,13 @@
% for a description of the value's syntax. No pixel definitions are made by
% the package.
% \item[colours] \emph{see \texttt{colors}.}
+% \item[gap-hack] To fix the issues with visible gaps in \textsc{pdf} viewers
+% you can introduce some negative kerns to make the pixels overlap (lines
+% overlap to the top, pixels to the left). This option expects a dimension
+% as its value. A positive value will (maybe) close the gaps, a negative
+% value will introduce real gaps. In any case the outermost pixels' borders
+% still coincide with the borders of the surrounding \CS{hbox}. Take a look
+% at my babbling about this issue in \autoref{sec:misc}.
% \item[ht] Set the height of the pixels.
% \item[mode] Set the used mode, see \autoref{sec:modes} for available modes.
% Initial value is |px|.
@@ -651,20 +677,34 @@
% This draws the logo of \pxpicname. The \meta{size} controls the pixel size.
% \end{function}
%
-% \subsection{Miscellaneous}
+% \subsection{Miscellaneous}\label{sec:misc}
%
% If you find bugs or have suggestions I'll be glad to hear about it, you can
% either open a ticket on Github (\url{https://github.com/Skillmon/ltx_pxpic})
% or email me (see the first page).
%
-% A similar package is \pkg{pixelart}, which, as of writing this, is described
-% as a ``working draft'' by its author. \pxpicname\ wasn't intended as a direct
+% A similar package is \pixelart, which, as of writing this, is described as a
+% ``working draft'' by its author. \pxpicname\ wasn't intended as a direct
% competitor (I already started coding \pxpicname\ when I learned about
-% \pkg{pixelart}'s existence), but I took inspiration from the ``Bugs, Ideas,
-% Undefined behaviours'' section of \pkg{pixelart}'s documentation for the
-% syntax of |mode=px|.
+% \pixelart's existence), but I took inspiration from the ``Bugs, Ideas,
+% Undefined behaviours'' section of \pixelart's documentation for the syntax of
+% |mode=px|.
%
+% \paragraph{Regarding the gap issue:}
+% The pixels are output touching each other with no real gap, however some
+% \textsc{pdf} viewers and tools will display such a gap. To make things even
+% worse, the effect depends on the viewers current magnification.
+% \pxpicname\ has the |gap-hack| option to provide some crude hack that might
+% fix the issue, at the cost that the pixels are smaller than they were
+% specified to be, except for the pixels at the right and bottom border. Also
+% pixels next to skipped pixels have a different size (skipped pixels don't
+% cover pixels to their left or top as they are transparent). You'll want to
+% find a good trade-off value if you want to use |gap-hack|, that mitigates the
+% effect but isn't too big (to make the errors less obvious). You can play with
+% the value and decide for yourself what's the lesser evil. Or you do like me,
+% don't use |gap-hack| and blame the viewers.
%
+%
% \end{documentation}^^A=<<
%
% \begin{implementation}^^A>>=
@@ -678,7 +718,7 @@
%
% Report who we are
% \begin{macrocode}
-\ProvidesPackage{pxpic}[2021-01-10 v1.0 draw pixel pictures]
+\ProvidesPackage{pxpic}[2021-01-13 v1.1 draw pixel pictures]
% \end{macrocode}
% and load dependencies
% \begin{macrocode}
@@ -690,10 +730,19 @@
% \begin{macrocode}
\@ifdefinable\pxpicHT{\newdimen\pxpicHT}
\@ifdefinable\pxpicWD{\newdimen\pxpicWD}
-\pxpicHT=1pt
-\pxpicWD=\pxpicHT
+\pxpicHT1pt
+\pxpicWD\pxpicHT
% \end{macrocode}
% \end{variable}
+% \begin{variable}[internal]{\pxpic at kern}
+% To fix the visible gaps in some \textsc{pdf} viewers if the user chooses so
+% with the |gap-hack| option we introduce some \CS{kern}s of the length
+% stored in this register.
+% \begin{macrocode}
+\@ifdefinable\pxpic at kern{\newdimen\pxpic at kern}
+\pxpic at kern\z@
+% \end{macrocode}
+% \end{variable}
%
%
% \subsection{Options}
@@ -707,9 +756,10 @@
%
% \begin{macrocode}
\protected\ekvdef{pxpic}{size}
- {\pxpicHT=\dimexpr#1\relax\pxpicWD=\dimexpr#1\relax}
-\protected\ekvdef{pxpic}{ht}{\pxpicHT=\dimexpr#1\relax}
-\protected\ekvdef{pxpic}{wd}{\pxpicWD=\dimexpr#1\relax}
+ {\pxpicHT\dimexpr#1\relax\pxpicWD\dimexpr#1\relax}
+\protected\ekvdef{pxpic}{ht}{\pxpicHT\dimexpr#1\relax}
+\protected\ekvdef{pxpic}{wd}{\pxpicWD\dimexpr#1\relax}
+\protected\ekvdef{pxpic}{gap-hack}{\pxpic at kern\dimexpr#1\relax}
\protected\ekvdef{pxpic}{skip}{\ekvdefNoVal{pxpic at px}{#1}{\pxskip}}
% \end{macrocode}
% The |colours| option is parsed using \CS{ekvparse} and \CS{pxpic at setcolor}.
@@ -742,7 +792,8 @@
% are stacked vertically without gaps. \CS{pxpic at parse} will parse the
% \meta{pixel list} until \CS{pxpic at end} is hit. The final \CS{egroup} closes
% the \CS{hbox}. The row-wise output is done via a \CS{vbox} in which each
-% pixel row will be wrapped inside an \CS{hbox}.
+% pixel row will be wrapped inside an \CS{hbox}. The \CS{kern} negates a
+% negative \CS{kern} in \CS{pxpic at parse} so that the first line isn't moved.
% \begin{macrocode}
\newcommand*\pxpic{\hbox\bgroup\pxpic@}
\newcommand\pxpic@[2][]
@@ -753,6 +804,7 @@
\let\px\pxpic at px
\let\pxskip\pxpic at skip
\baselineskip\pxpicHT
+ \kern\pxpic at kern
\pxpic at parse#2\pxpic at end
}%
\egroup
@@ -845,14 +897,18 @@
% a new \CS{hbox} (which will form a row in the \CS{vbox} placed by
% \CS{pxpic@}) in which the inner parsing loop is run. Then call the next
% iteration. If we're done just gobble the remainder of the current iteration.
+% First we introduce our \CS{kern} which might fix the gap issue. Another
+% \CS{kern} is done at the start of each \CS{hbox} to compensate the
+% unnecessary \CS{kern} done by the first \CS{pxpic at parseline}.
% \begin{macrocode}
\newcommand\pxpic at parse[1]
{%
\pxpic at ifend#1\pxpic at done\pxpic at end
- \hbox{\pxpic at parseline#1\pxpic at end}%
+ \kern-\pxpic at kern
+ \hbox{\kern\pxpic at kern\pxpic at parseline#1\pxpic at end}%
\pxpic at parse
}
-\long\def\pxpic at done\pxpic at end\hbox#1\pxpic at parse{}
+\long\def\pxpic at done\pxpic at end\kern-\pxpic at kern\hbox#1\pxpic at parse{}
% \end{macrocode}
% \end{macro}
%
@@ -861,15 +917,19 @@
% pixel using the current definition of \CS{pxpic at parse@px} (which will be set
% by the current |mode|) and afterwards call the next iteration. If we're done
% we gobble the remainder of the current iteration and control goes back to
-% \CS{pxpic at parse}.
+% \CS{pxpic at parse}. Before each pixel we introduce a negative \CS{kern} to
+% maybe fix the gap issue by letting the pixels overlap a bit.
% \begin{macrocode}
\newcommand\pxpic at parseline[1]
{%
\pxpic at ifend#1\pxpic at linedone\pxpic at end
+ \kern-\pxpic at kern
\pxpic at parse@px{#1}%
\pxpic at parseline
}
-\long\def\pxpic at linedone\pxpic at end\pxpic at parse@px#1\pxpic at parseline{}
+\long\def\pxpic at linedone
+ \pxpic at end\kern-\pxpic at kern\pxpic at parse@px#1\pxpic at parseline
+ {}
% \end{macrocode}
% \end{macro}
%
Modified: trunk/Master/texmf-dist/tex/latex/pxpic/pxpic.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/pxpic/pxpic.sty 2021-01-13 22:13:25 UTC (rev 57411)
+++ trunk/Master/texmf-dist/tex/latex/pxpic/pxpic.sty 2021-01-13 22:13:54 UTC (rev 57412)
@@ -29,17 +29,20 @@
%% and the derived files pxpic.pdf
%% pxpic.sty
%%
-\ProvidesPackage{pxpic}[2021-01-10 v1.0 draw pixel pictures]
+\ProvidesPackage{pxpic}[2021-01-13 v1.1 draw pixel pictures]
\RequirePackage{xcolor}
\RequirePackage{expkv}
\@ifdefinable\pxpicHT{\newdimen\pxpicHT}
\@ifdefinable\pxpicWD{\newdimen\pxpicWD}
-\pxpicHT=1pt
-\pxpicWD=\pxpicHT
+\pxpicHT1pt
+\pxpicWD\pxpicHT
+\@ifdefinable\pxpic at kern{\newdimen\pxpic at kern}
+\pxpic at kern\z@
\protected\ekvdef{pxpic}{size}
- {\pxpicHT=\dimexpr#1\relax\pxpicWD=\dimexpr#1\relax}
-\protected\ekvdef{pxpic}{ht}{\pxpicHT=\dimexpr#1\relax}
-\protected\ekvdef{pxpic}{wd}{\pxpicWD=\dimexpr#1\relax}
+ {\pxpicHT\dimexpr#1\relax\pxpicWD\dimexpr#1\relax}
+\protected\ekvdef{pxpic}{ht}{\pxpicHT\dimexpr#1\relax}
+\protected\ekvdef{pxpic}{wd}{\pxpicWD\dimexpr#1\relax}
+\protected\ekvdef{pxpic}{gap-hack}{\pxpic at kern\dimexpr#1\relax}
\protected\ekvdef{pxpic}{skip}{\ekvdefNoVal{pxpic at px}{#1}{\pxskip}}
\protected\ekvdef{pxpic}{colors}{\ekvparse\pxpic at noval\pxpic at setcolor{#1}}
\ekvletkv{pxpic}{colours}{pxpic}{colors}
@@ -61,6 +64,7 @@
\let\px\pxpic at px
\let\pxskip\pxpic at skip
\baselineskip\pxpicHT
+ \kern\pxpic at kern
\pxpic at parse#2\pxpic at end
}%
\egroup
@@ -105,17 +109,21 @@
\newcommand\pxpic at parse[1]
{%
\pxpic at ifend#1\pxpic at done\pxpic at end
- \hbox{\pxpic at parseline#1\pxpic at end}%
+ \kern-\pxpic at kern
+ \hbox{\kern\pxpic at kern\pxpic at parseline#1\pxpic at end}%
\pxpic at parse
}
-\long\def\pxpic at done\pxpic at end\hbox#1\pxpic at parse{}
+\long\def\pxpic at done\pxpic at end\kern-\pxpic at kern\hbox#1\pxpic at parse{}
\newcommand\pxpic at parseline[1]
{%
\pxpic at ifend#1\pxpic at linedone\pxpic at end
+ \kern-\pxpic at kern
\pxpic at parse@px{#1}%
\pxpic at parseline
}
-\long\def\pxpic at linedone\pxpic at end\pxpic at parse@px#1\pxpic at parseline{}
+\long\def\pxpic at linedone
+ \pxpic at end\kern-\pxpic at kern\pxpic at parse@px#1\pxpic at parseline
+ {}
\newcommand\pxpic at parse@px at px[1]
{%
\ekvifdefinedNoVal{pxpic at px}{#1}
More information about the tex-live-commits
mailing list.