texlive[72986] Master/texmf-dist: fancyqr (27nov24)

commits+karl at tug.org commits+karl at tug.org
Wed Nov 27 21:55:52 CET 2024


Revision: 72986
          https://tug.org/svn/texlive?view=revision&revision=72986
Author:   karl
Date:     2024-11-27 21:55:52 +0100 (Wed, 27 Nov 2024)
Log Message:
-----------
fancyqr (27nov24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/fancyqr/README.md
    trunk/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.pdf
    trunk/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.tex
    trunk/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-flat.code
    trunk/Master/texmf-dist/tex/latex/fancyqr/fancyqr.sty

Modified: trunk/Master/texmf-dist/doc/latex/fancyqr/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fancyqr/README.md	2024-11-27 20:55:43 UTC (rev 72985)
+++ trunk/Master/texmf-dist/doc/latex/fancyqr/README.md	2024-11-27 20:55:52 UTC (rev 72986)
@@ -9,7 +9,7 @@
 
 *fancyqr* is actively developed by *Florian Sihler* (contact me at: <florian.sihler at uni-ulm.de>) under the [GPLv3 License](LICENSE). I am very happy about every contribution (see [CONTRIBUTING.md](CONTRIBUTING.md)). You can find it on CTAN (<https://www.ctan.org/pkg/fancyqr>).
 
-If you do want to hide a center square (e.g., because you want to embed an image), you can use `\FancyQrDoNotPrintSquare{<x>}{<y>}` to hide a rectangle with radius x and y set from the center. If you choose this option, the default `\FancyQrRoundCut` that rounds cut corners can be changed with `\FancyQrHardCut`.
+If you do want to hide a center square (e.g., because you want to embed an image), you can use `\FancyQrDoNotPrintSquare{<x>}{<y>}` to hide a rectangle with radius x and y set from the center (with `\FancyQrDoNotPrintRadius{<factor>}` you can apply a [rounding](https://github.com/EagleoutIce/fancyqr/pull/41) to this!). If you choose this option, the default `\FancyQrRoundCut` that rounds cut corners can be changed with `\FancyQrHardCut`.
 At the moment, there are six other styles (`flat`, `frame`, `blobs`, `glitch`, and `dots`) that you can load (locally) by using `\FancyQrLoad{<name>}`. The default style is named `default` and can be 'reset' by `\FancyQrLoad{default}` or `\FancyQrLoadDefault`.
 
 There are the following extra qr-options (you can set all of them with `\fancyqrset{<keys>}`):
@@ -18,6 +18,7 @@
 | ----------------- | ----------- | :------: | ------------------------------------------------------------------------------------------------------------------------------------------ |
 | `classic`         | boolean     |  `false` | Use the classic qr-code style (black with flat rectangles, this loads the `flat` style).                                                    |
 | `color`           | color       |          | Disables the `gradient` and sets the qr color accordingly.                                                                                 |
+| `compensate`      | length      | `0.15pt` | Compensating overlap to add to avoid glitches.                                                                                             |
 | `gradient angle`  | angle       |  `135`   | Change the gradient angle.                                                                                                                 |
 | `gradient`        | boolean     |   true   | Toggle the color gradient                                                                                                                  |
 | `image`           | LaTeX       |          | Automatically center an image (you have to care for the size and maybe adjust the `version` and `level` to keep the qr-code readable).[^1] |

Modified: trunk/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.tex	2024-11-27 20:55:43 UTC (rev 72985)
+++ trunk/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.tex	2024-11-27 20:55:52 UTC (rev 72986)
@@ -35,7 +35,7 @@
 	\texorpdfstring{Florian Sihler\medskip\\*
 		\fancyqr{https://github.com/EagleoutIce/fancyqr}
 	}{Florian Sihler}}
-\date{Version v2.1 \textendash{} 2024/10/05}
+\date{Version v2.2 \textendash{} 2024/11/27}
 
 \begin{document}
    \maketitle
@@ -44,7 +44,7 @@
 	\texttt{fancyqr} is a simple package to create fancy qr-codes with the help of the \textit{\href{https://www.ctan.org/pkg/qrcode}{qrcode}}-package.
 	You can use the |\fancyqr|-macro just like the normal |\qrcode|.\footnote{\ltx{\\fancyqr[<qr-options>]\{<url>\}}}
 
-	If you do want to hide a center square (e.g, because you want to embed an image) you can use |\FancyQrDoNotPrintSquare{<x>}{<y>}| to hide a rectangle with radius x and y set from the center. If you choose this option, the default |\FancyQrRoundCut| that rounds cut corners can be changed with |\FancyQrHardCut|.
+	If you do want to hide a center square (e.g, because you want to embed an image) you can use |\FancyQrDoNotPrintSquare{<x>}{<y>}| to hide a rectangle with radius x and y set from the center (with |\FancyQrDoNotPrintRadius{<factor>}| you can apply a \href{https://github.com/EagleoutIce/fancyqr/pull/41}{rounding} to this!). If you choose this option, the default |\FancyQrRoundCut| that rounds cut corners can be changed with |\FancyQrHardCut|.
 	At the moment, there are six other styles for the qr-code |flat|, |frame|, |blobs|, |glitch|, and |dots|, that you can load (locally) by using |\FancyQrLoad{<name>}|. The default style is named |default| and can be 'reset' by |\FancyQrLoad{default}| or |\FancyQrLoadDefault|.
 
 	All of the extra qr-options (you can set all of them with |\fancyqrset{<keys>}|) are showcased in \autoref{tbl:extra-keys}.
@@ -68,6 +68,7 @@
 		\midrule
 		classic         & boolean &   false  & Use the classic qr-code style (black with flat rectangles, this loads the |flat| style).                                \\
 		color           & color   &          & Disables the |gradient| and sets the color accordingly.      \\
+		compensate      & length  & 0.15pt & Compensating overlap to add to avoid glitches.               \\
 		gradient        & boolean &   true   & Toggle the color gradient                                    \\
 		gradient angle  & angle   &  135     & Change the gradient angle.                                   \\
 		image           & \LaTeX   &          & Automatically center an image (you have to care for the size and maybe adjust the |version| and |level| to keep the qr-code readable).\footnote{The package will automatically calculate the required \ltx{\\FancyQrDoNotPrintSquare} (you have to make sure that the qr-code still has enough information to be readable). Therefore, the image will not scale with the qr-code.} \\

Modified: trunk/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-flat.code
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-flat.code	2024-11-27 20:55:43 UTC (rev 72985)
+++ trunk/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-flat.code	2024-11-27 20:55:52 UTC (rev 72986)
@@ -1,3 +1,4 @@
+\FancyQrHardCut%
 \def\fancyqr at flat@rect{\moveto(0,0)\lineto(0,1)\lineto(1,1)\lineto(1,0)\lineto(0,0)\fillpath}
 % .
 \newpattern0000{\fancyqr at flat@rect}%

Modified: trunk/Master/texmf-dist/tex/latex/fancyqr/fancyqr.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fancyqr/fancyqr.sty	2024-11-27 20:55:43 UTC (rev 72985)
+++ trunk/Master/texmf-dist/tex/latex/fancyqr/fancyqr.sty	2024-11-27 20:55:52 UTC (rev 72986)
@@ -2,7 +2,7 @@
 % Licensed under GNU General Public License version 3
 % https://opensource.org/licenses/gpl-3.0.html
 \def\filename{fancyqr}
-\ProvidesPackage{\filename}[2024/10/05 version v2.1 Fancy QR-Codes]
+\ProvidesPackage{\filename}[2024/11/27 version v2.2 Fancy QR-Codes]
 \RequirePackage{pict2e, xfp, qrcode}
 
 % element
@@ -121,12 +121,30 @@
    \else\qr at white@format\fi
 }%
 
-\def\FancyQrDoNotPrintSquare#1#2{\def\fancy at qr@donotprint at center@x{#1}\def\fancy at qr@donotprint at center@y{#2}}
+% #1 width
+% #2 height
+\def\FancyQrDoNotPrintSquare#1#2{%
+   \def\fancy at qr@donotprint at center@x{#1}%
+   \def\fancy at qr@donotprint at center@y{#2}%
+}
 \FancyQrDoNotPrintSquare00
+% is a factor between 0 and 1
+\def\FancyQrDoNotPrintRadius#1{%
+   \def\fancy at qr@donotprint at center@r{#1}%
+}
+\FancyQrDoNotPrintRadius0
 
 \newif\iffancy at qr@do at print@
 \def\qr at fancy@updateif#1#2{\fancy at qr@do at print@true
-\ifnum#1>\@do at y@min\relax \ifnum#1<\@do at y@max\relax \ifnum#2>\@do at x@min\relax \ifnum#2<\@do at x@max\relax \fancy at qr@do at print@false \fi\fi\fi\fi}
+\ifdim\fancy at qr@donotprint at center@r\p@>\z@
+   \ifnum#1>\@do at y@min\relax \ifnum#1<\@do at y@max\relax \ifnum#2>\@do at x@min\relax \ifnum#2<\@do at x@max\relax
+      \ifdim\fpeval{sqrt((#1-\@half at max@y)^2 + (#2-\@half at max@x)^2)}\p@<\@max at rcrad\p@
+         \fancy at qr@do at print@false
+      \fi
+   \fi\fi\fi\fi
+\else
+\ifnum#1>\@do at y@min\relax \ifnum#1<\@do at y@max\relax \ifnum#2>\@do at x@min\relax \ifnum#2<\@do at x@max\relax \fancy at qr@do at print@false \fi\fi\fi\fi\fi
+}
 
 \newif\iffancy at qr@roundcut@
 \fancy at qr@roundcut at true
@@ -147,8 +165,8 @@
 
 \newif\if at fancyqr@image@
 
+\def\qr at white{0}\def\qr at black{1}%
 \def\fancy at qr@printmatrix#1{%
-   \def\qr at white{0}\def\qr at black{1}%
    \protected at edef\fancyqr at currprint{#1}%
    \let\qr at black@fixed\qr at black \let\qr at white@fixed\qr at white
    \let\qr at black@format\qr at black \let\qr at white@format\qr at white
@@ -180,6 +198,7 @@
       \edef\@do at x@max{\the\numexpr\@half at max@x+\fancy at qr@donotprint at center@x+\@ne}%
       \edef\@do at y@min{\the\numexpr\@half at max@y-\fancy at qr@donotprint at center@y-\@ne}%
       \edef\@do at y@max{\the\numexpr\@half at max@y+\fancy at qr@donotprint at center@y+\@ne}%
+      \edef\@max at rcrad{\fpeval{max((\@ne-\fancy at qr@donotprint at center@r)*\fancy at qr@donotprint at center@x,(\@ne-\fancy at qr@donotprint at center@r)*\fancy at qr@donotprint at center@y)+\fancyqr at edge@compensate}}%
       \edef\@tmp at tight{\ifqr at tight\z@\else-4\fi}%
       \picture(\qr at minipagewidth,\qr at minipagewidth)(\the\numexpr\@ne+\@tmp at tight,\@tmp at tight)
       \qr at for \i=\@ne to \@max at y by \@ne{\qr at for \j=\@ne to \@max at x by \@ne{%
@@ -274,6 +293,7 @@
 \define at key{fancyqr}{random color}{\@fancyqr at randomcolor@true\def\@fancyqr at random@colors{#1}}
 \define at key{fancyqr}{width}{\setkeys{qr}{height=#1}}
 \define at key{fancyqr}{size}{\setkeys{qr}{height=#1}}
+\define at key{fancyqr}{compensate}{\setlength\fancyqr at edge@compensate{#1}}
 % \fancyqr at loaded@style
 \def\fancyqr at flat@style{flat}
 \define at boolkey{fancyqr}[@fancyqr@]{classic}[true]{} % if at fancyqr@classic
@@ -280,7 +300,7 @@
 \def\fancyqr at classic{%
 \ifx\fancyqr at loaded@style\fancyqr at flat@style\else\FancyQrLoad{\fancyqr at flat@style}\fi
 \setkeys{fancyqr}{%
-   gradient=false,color=black,l color=black,r color=black%
+   gradient=false,color=black,l color=black,r color=black,compensate=\z@\relax
 }%
 }
 



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