summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-04-13 20:33:40 +0000
committerKarl Berry <karl@freefriends.org>2024-04-13 20:33:40 +0000
commita1ee7011184d0d683d32554437b325ccb60ad185 (patch)
treea65937e019a6cb916bb063010b2f5c3cad93cf27 /Master
parent1e31cc5b0586e4394ef5c9c61081693f56cd27a4 (diff)
fancyqr (13apr24)
git-svn-id: svn://tug.org/texlive/trunk@70935 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/fancyqr/README.md19
-rw-r--r--Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.pdfbin248469 -> 247479 bytes
-rw-r--r--Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.tex57
-rw-r--r--Master/texmf-dist/doc/latex/fancyqr/qr-example.tex24
-rw-r--r--Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-blobs.code47
-rw-r--r--Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-dots.code33
-rw-r--r--Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-flat.code33
-rw-r--r--Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-frame.code27
-rw-r--r--Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-glitch.code46
-rw-r--r--Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-swift.code26
-rw-r--r--Master/texmf-dist/tex/latex/fancyqr/fancyqr.sty173
11 files changed, 267 insertions, 218 deletions
diff --git a/Master/texmf-dist/doc/latex/fancyqr/README.md b/Master/texmf-dist/doc/latex/fancyqr/README.md
index ebb21733483..63432f93e05 100644
--- a/Master/texmf-dist/doc/latex/fancyqr/README.md
+++ b/Master/texmf-dist/doc/latex/fancyqr/README.md
@@ -1,16 +1,16 @@
# fancyqr
-[![made-with-latex](https://img.shields.io/badge/Made%20with-LaTeX-1f425f.svg)](https://www.latex-project.org/) [![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://opensource.org/licenses/GPL-3.0) [![PR's Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com) [![compile qr](https://github.com/EagleoutIce/fancyqr/actions/workflows/compile.yaml/badge.svg)](https://github.com/EagleoutIce/fancyqr/actions/workflows/compile.yaml)
+[![made-with-latex](https://img.shields.io/badge/Made%20with-LaTeX-1f425f.svg)](https://www.latex-project.org/) [![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://opensource.org/licenses/GPL-3.0) [![PR's Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com) [![CTAN](https://badgen.net/badge/On/CTAN/cyan)](https://www.ctan.org/pkg/fancyqr) [![compile qr](https://github.com/EagleoutIce/fancyqr/actions/workflows/compile.yaml/badge.svg)](https://github.com/EagleoutIce/fancyqr/actions/workflows/compile.yaml)
[<img src="https://github.com/EagleoutIce/fancyqr/blob/gh-pages/preview-1.png?raw=true" width="600"/>](qr-example.tex)
-Simple package to create fancy qr-codes with the help of the [`qrcode`](https://www.ctan.org/pkg/qrcode)-package.
-You may use `\fancyqr` just like the normal `\qrcode` (`\fancyqr[<qr-options>]{<url>}`). See the [documentation](https://media.githubusercontent.com/media/EagleoutIce/fancyqr/blob/gh-pages/build/fancyqr-doc.pdf).
+A simple package to create fancy qr-codes with the help of the [`qrcode`][qrcode]-package.
+You may use `\fancyqr` just like the normal `\qrcode` (`\fancyqr[<qr-options>]{<url>}`). See the [documentation](https://media.githubusercontent.com/media/EagleoutIce/fancyqr/gh-pages/build/fancyqr-doc.pdf).
-*fancyqr* is actively developed by *Florian Sihler* (contact me at: <florian.sihler@uni-ulm.de>) under the [GPLv3 License](LICENSE). I am very happy about every contribution (see [CONTRIBUTING.md](CONTRIBUTING.md)).
+*fancyqr* is actively developed by *Florian Sihler* (contact me at: <florian.sihler@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`.
-At the moment, there are six other styles `flat`, `frame`, `blob`, `glitch`, `swift`, 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 `\FancyLoadDefault`.
+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`.
+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>}`):
| Option | Type | Default | Explanation |
@@ -26,6 +26,9 @@ There are the following extra qr-options (you can set all of them with `\fancyqr
| `r color` | color | `teal` | Set the bottom right gradient color. |
| `right color` | color | | Alias for `r color`. |
| `gradient angle` | angle | `135` | Change the gradient angle. |
+| `random color` | colors | | Allow to set a random color pool to pick from. |
+| `width` | length | | Alias for [`qrcode`'s][qrcode] `height` option. |
+| `size` | length | | Alias for [`qrcode`'s][qrcode] `height` option. |
The defaults are set like this:
@@ -33,4 +36,6 @@ The defaults are set like this:
\fancyqrset{image padding=0,gradient=true,gradient angle=135,r color=teal,l color=purple}
```
-[^1]: The package will automatically calculate the required `\FancyQrDoNotPrintSquare` (you have to make sure the, the qr code still has enough information to be readable). Therefore, the image will not scale with the qr code.
+[^1]: The package will automatically calculate the required `\FancyQrDoNotPrintSquare` (you have to ensure that the qr-code still has enough information to be readable). Therefore, the image will not scale with the qr-code.
+
+[qrcode]: https://www.ctan.org/pkg/qrcode
diff --git a/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.pdf b/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.pdf
index d740e98df36..c96c62abbcd 100644
--- a/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.pdf
+++ b/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.tex b/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.tex
index 4236fdddf9e..1f3b00ba2db 100644
--- a/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.tex
+++ b/Master/texmf-dist/doc/latex/fancyqr/fancyqr-doc.tex
@@ -1,4 +1,4 @@
-% Florian Sihler, 2022
+% Florian Sihler, 2024
% Licensed under GNU General Public License version 3
% https://opensource.org/licenses/gpl-3.0.html
\documentclass[parskip=half,english,numbers=noenddot,footnotes=nomultiple,oneside]{scrartcl}
@@ -21,7 +21,7 @@
\lstdefinelanguage{ltx}{
language={[LaTeX]TeX},
- moretexcs=[1]{fancyqr,qrcode,FancyQrDoNotPrintSquare,FancyQrRoundCut,FancyQrHardCut,FancyQrLoad,FancyLoadDefault,fancyqrset,faGithub}
+ moretexcs=[1]{fancyqr,qrcode,FancyQrDoNotPrintSquare,FancyQrRoundCut,FancyQrHardCut,FancyQrLoad,FancyQrLoadDefault,fancyqrset,faGithub}
}
\lstset{basicstyle=\ttfamily,breaklines,texcsstyle=*\color{purple}\bfseries,language=ltx}
\lstMakeShortInline|
@@ -34,7 +34,7 @@
\texorpdfstring{Florian Sihler\medskip\\*
\fancyqr{https://github.com/EagleoutIce/fancyqr}
}{Florian Sihler}}
-\date{Version v1.1 \textendash{} 2022/08/19}
+\date{Version v2.0 \textendash{} 2024/04/13}
\begin{document}
@@ -45,7 +45,7 @@
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|.
- At the moment, there are six other styles for the qr-code |flat|, |frame|, |blob|, |glitch|, |swift|, 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 |\FancyLoadDefault|.
+ 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}.
The defaults are set like this:
@@ -60,28 +60,31 @@
\parbox[c]{.3\linewidth}{Which produces:}\hfill\parbox[c]{.4\linewidth}{\raggedleft\fancyqr[image=\Huge\faGithub,image padding=1,color=black!90!gray]{https://github.com/EagleoutIce/fancyqr}}\par
- \begin{savenotes}
- \begin{table}
- \centering\begin{tabular}{>{\ttfamily}ll>{\ttfamily}cp{.5\linewidth}}
- \toprule
- \multicolumn{1}{l}{Option} & Type & \multicolumn{1}{c}{Default} & Explanation \\
- \midrule
- image & \LaTeX & & Automatically center an image.\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.} \\
- image padding & number & & Additionally hide blocks (x \& y) around the image. \\
- image x padding & number & 0 & Additionally hide blocks (x) around the image. \\
- image y padding & number & 0 & Additionally hide blocks (y) around the image. \\
- gradient & boolean & true & Toggle the color gradient \\
- color & color & & Disables the |gradient| and sets the color accordingly. \\
- l color & color & purple & Set the top left gradient color. \\
- left color & color & & Alias for |l color|. \\
- r color & color & teal & Set the bottom right gradient color. \\
- right color & color & & Alias for |r color|. \\
- gradient angle & angle & 135 & Change the gradient angle. \\
- \bottomrule
- \end{tabular}
- \caption{Overview of special qr-options.}
- \label{tbl:extra-keys}
- \end{table}
- \end{savenotes}
+\begin{savenotes}
+\begin{table}
+ \centering\begin{tabular}{>{\ttfamily}ll>{\ttfamily}cp{.5\linewidth}}
+ \toprule
+ \multicolumn{1}{l}{Option} & Type & \multicolumn{1}{c}{Default} & Explanation \\
+ \midrule
+ image & \LaTeX & & Automatically center an image.\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.} \\
+ image padding & number & & Additionally hide blocks (x \& y) around the image. \\
+ image x padding & number & 0 & Additionally hide blocks (x) around the image. \\
+ image y padding & number & 0 & Additionally hide blocks (y) around the image. \\
+ gradient & boolean & true & Toggle the color gradient \\
+ color & color & & Disables the |gradient| and sets the color accordingly. \\
+ l color & color & purple & Set the top left gradient color. \\
+ left color & color & & Alias for |l color|. \\
+ r color & color & teal & Set the bottom right gradient color. \\
+ right color & color & & Alias for |r color|. \\
+ gradient angle & angle & 135 & Change the gradient angle. \\
+ random color & colors & & Allow to set a random color pool to pick from. \\
+ width & length & & Alias for |qrcode|'s |height| option. \\
+ size & length & & Alias for |qrcode|'s |height| option. \\
+ \bottomrule
+ \end{tabular}
+ \caption{Overview of special qr-options.}
+ \label{tbl:extra-keys}
+\end{table}
+\end{savenotes}
\end{document}
diff --git a/Master/texmf-dist/doc/latex/fancyqr/qr-example.tex b/Master/texmf-dist/doc/latex/fancyqr/qr-example.tex
index d58e7f835d8..e0518297ebb 100644
--- a/Master/texmf-dist/doc/latex/fancyqr/qr-example.tex
+++ b/Master/texmf-dist/doc/latex/fancyqr/qr-example.tex
@@ -1,25 +1,33 @@
-% Florian Sihler, 2022
+% Florian Sihler, 2024
% Licensed under GNU General Public License version 3
% https://opensource.org/licenses/gpl-3.0.html
\documentclass{article}
\usepackage{fontawesome}
-
\usepackage{fancyqr}
+% for showcase of random colors
+\usepackage{pgfmath}
+\usepackage[prefix=@]{xcolor-material}
+
+% to showcase scalebox
+\usepackage{graphicx}
+
\usepackage[active,tightpage]{preview} % for presentation
\setlength\PreviewBorder{15pt}
-\fancyqrset{height=3.25cm,level=H,padding}
+\fancyqrset{size=3.25cm,level=H,padding}
\begin{document}
\preview
% \FancyQrDoNotPrintSquare{8}{9}
% \FancyQrHardCut
-\mbox{\FancyQrLoad{blobs}
-\fancyqr[image=\scalebox{2.9}{\faGithub\kern1pt},image padding=1,color=black!90!gray]{https://github.com/EagleoutIce/fancyqr}
-\FancyQrLoad{default}
-\fancyqr{https://github.com/EagleoutIce/fancyqr}
-\FancyQrLoad{dots}\fancyqr[image={\tikz\node[align=center,draw]{\huge Ha\\Huhu};},r color=gray,gradient angle=45]{https://github.com/EagleoutIce/fancyqr}}%
+\mbox{\FancyQrLoad{blobs}%
+\fancyqr[image=\scalebox{2.9}{\faGithub},image padding=1,color=black!90!gray]{https://github.com/EagleoutIce/fancyqr}%
+\FancyQrLoad{default}%
+\fancyqr{https://github.com/EagleoutIce/fancyqr}%
+\FancyQrLoad{dots}%
+\fancyqr[image={\textsf{\textbf{\textcolor{gray}{fancy}qr}}}, random color={@Red}{@Pink}{@Purple}{@DeepPurple}{@Indigo}{@Blue}{@Cyan}{@Teal}{@Green}{@Amber}{@Orange}{@DeepOrange}{@Brown}]{https://github.com/EagleoutIce/fancyqr}%
+}%
\endpreview
\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-blobs.code b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-blobs.code
index 9a6400da030..bfc7e776ec8 100644
--- a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-blobs.code
+++ b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-blobs.code
@@ -1,23 +1,36 @@
-\def\@tikz@fancy@qr@blobb{[rounded corners=.08*\qrm] (0,0) +(0:.3*\qrm+.515*\qrm*rnd) foreach \a in {30,60,...,360} {-- +(\a:.3*\qrm+.515*\qrm*rnd)} -- cycle}%
+% with pict2e and polar coordinate translation
+\def\@fancy@qr@blobb{%
+\@tempcnta=\z@
+\roundjoin
+\roundcap
+\moveto(0,0)
+\loop
+\advance\@tempcnta by 30
+\edef\rad{\fpeval{.2*\qr@modulesize+.115*\qr@modulesize*abs(rand())}}% fixed rand for both
+\lineto(\fpeval{cos(\@tempcnta)*\rad},\fpeval{sin(\@tempcnta)*\rad})
+\ifnum\@tempcnta<360\relax
+\repeat
+\fillpath
+}%
% .
-\newpattern0000{\@tikz@fancy@qr@blobb}%
+\newpattern0000{\@fancy@qr@blobb}%
% | | - -
-\newpattern1000{\@tikz@fancy@qr@blobb}%
-\newpattern0001{\@tikz@fancy@qr@blobb}%
-\newpattern0100{\@tikz@fancy@qr@blobb}%
-\newpattern0010{\@tikz@fancy@qr@blobb}%
+\newpattern1000{\@fancy@qr@blobb}%
+\newpattern0001{\@fancy@qr@blobb}%
+\newpattern0100{\@fancy@qr@blobb}%
+\newpattern0010{\@fancy@qr@blobb}%
% corners
-\newpattern1100{\@tikz@fancy@qr@blobb}%
-\newpattern1010{\@tikz@fancy@qr@blobb}%
-\newpattern0101{\@tikz@fancy@qr@blobb}%
-\newpattern0011{\@tikz@fancy@qr@blobb}%
+\newpattern1100{\@fancy@qr@blobb}%
+\newpattern1010{\@fancy@qr@blobb}%
+\newpattern0101{\@fancy@qr@blobb}%
+\newpattern0011{\@fancy@qr@blobb}%
% straights | --
-\newpattern1001{\@tikz@fancy@qr@blobb}%
-\newpattern0110{\@tikz@fancy@qr@blobb}%
+\newpattern1001{\@fancy@qr@blobb}%
+\newpattern0110{\@fancy@qr@blobb}%
% enclosed
-\newpattern1111{\@tikz@fancy@qr@blobb}%
+\newpattern1111{\@fancy@qr@blobb}%
% t's
-\newpattern0111{\@tikz@fancy@qr@blobb}%
-\newpattern1011{\@tikz@fancy@qr@blobb}%
-\newpattern1101{\@tikz@fancy@qr@blobb}%
-\newpattern1110{\@tikz@fancy@qr@blobb}% \ No newline at end of file
+\newpattern0111{\@fancy@qr@blobb}%
+\newpattern1011{\@fancy@qr@blobb}%
+\newpattern1101{\@fancy@qr@blobb}%
+\newpattern1110{\@fancy@qr@blobb}% \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-dots.code b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-dots.code
index faeb92c1a30..f7fd55e1390 100644
--- a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-dots.code
+++ b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-dots.code
@@ -1,22 +1,23 @@
+\def\fancyqr@dots@circle{\put(.5,.5){\circle*{\@ne}}}
% .
-\newpattern0000{(0,0)circle[radius=.475*\qrm]}%
+\newpattern0000{\fancyqr@dots@circle}%
% | | - -
-\newpattern1000{(0,0)circle[radius=.475*\qrm]}%
-\newpattern0001{(0,0)circle[radius=.475*\qrm]}%
-\newpattern0100{(0,0)circle[radius=.475*\qrm]}%
-\newpattern0010{(0,0)circle[radius=.475*\qrm]}%
+\newpattern1000{\fancyqr@dots@circle}%
+\newpattern0001{\fancyqr@dots@circle}%
+\newpattern0100{\fancyqr@dots@circle}%
+\newpattern0010{\fancyqr@dots@circle}%
% corners
-\newpattern1100{(0,0)circle[radius=.475*\qrm]}%
-\newpattern1010{(0,0)circle[radius=.475*\qrm]}%
-\newpattern0101{(0,0)circle[radius=.475*\qrm]}%
-\newpattern0011{(0,0)circle[radius=.475*\qrm]}%
+\newpattern1100{\fancyqr@dots@circle}%
+\newpattern1010{\fancyqr@dots@circle}%
+\newpattern0101{\fancyqr@dots@circle}%
+\newpattern0011{\fancyqr@dots@circle}%
% straights | --
-\newpattern1001{(0,0)circle[radius=.475*\qrm]}%
-\newpattern0110{(0,0)circle[radius=.475*\qrm]}%
+\newpattern1001{\fancyqr@dots@circle}%
+\newpattern0110{\fancyqr@dots@circle}%
% enclosed
-\newpattern1111{(0,0)circle[radius=.475*\qrm]}%
+\newpattern1111{\fancyqr@dots@circle}%
% t's
-\newpattern0111{(0,0)circle[radius=.475*\qrm]}%
-\newpattern1011{(0,0)circle[radius=.475*\qrm]}%
-\newpattern1101{(0,0)circle[radius=.475*\qrm]}%
-\newpattern1110{(0,0)circle[radius=.475*\qrm]}% \ No newline at end of file
+\newpattern0111{\fancyqr@dots@circle}%
+\newpattern1011{\fancyqr@dots@circle}%
+\newpattern1101{\fancyqr@dots@circle}%
+\newpattern1110{\fancyqr@dots@circle}% \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-flat.code b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-flat.code
index e04f18f90ba..023dd3d4a4b 100644
--- a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-flat.code
+++ b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-flat.code
@@ -1,22 +1,23 @@
+\def\fancyqr@flat@rect{\moveto(0,0)\lineto(0,1)\lineto(1,1)\lineto(1,0)\lineto(0,0)\fillpath}
% .
-\newpattern0000{(0,0)rectangle(\qrm,\qrm)}%
+\newpattern0000{\fancyqr@flat@rect}%
% | | - -
-\newpattern1000{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern0001{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern0100{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern0010{(0,0)rectangle(\qrm,\qrm)}%
+\newpattern1000{\fancyqr@flat@rect}%
+\newpattern0001{\fancyqr@flat@rect}%
+\newpattern0100{\fancyqr@flat@rect}%
+\newpattern0010{\fancyqr@flat@rect}%
% corners
-\newpattern1100{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern1010{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern0101{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern0011{(0,0)rectangle(\qrm,\qrm)}%
+\newpattern1100{\fancyqr@flat@rect}%
+\newpattern1010{\fancyqr@flat@rect}%
+\newpattern0101{\fancyqr@flat@rect}%
+\newpattern0011{\fancyqr@flat@rect}%
% straights | --
-\newpattern1001{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern0110{(0,0)rectangle(\qrm,\qrm)}%
+\newpattern1001{\fancyqr@flat@rect}%
+\newpattern0110{\fancyqr@flat@rect}%
% enclosed
-\newpattern1111{(0,0)rectangle(\qrm,\qrm)}%
+\newpattern1111{\fancyqr@flat@rect}%
% t's
-\newpattern0111{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern1011{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern1101{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern1110{(0,0)rectangle(\qrm,\qrm)}% \ No newline at end of file
+\newpattern0111{\fancyqr@flat@rect}%
+\newpattern1011{\fancyqr@flat@rect}%
+\newpattern1101{\fancyqr@flat@rect}%
+\newpattern1110{\fancyqr@flat@rect}% \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-frame.code b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-frame.code
index a82c5296bfe..8d4bbe50323 100644
--- a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-frame.code
+++ b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-frame.code
@@ -1,25 +1,2 @@
-\tikzset{qrrd/.style={draw,line width=1.25pt}}
-\def\qrframesuffix{; \path[fill,qrrc,fill opacity=.995] (-.1pt,-.1pt) rectangle (\qrm+.1pt,\qrm+.1pt)}
-\def\qrfillring{circle[radius=.625pt]}
-% .
-\newpattern0000{[qrrc](0,0)rectangle(\qrm,\qrm); \path[fill,fill opacity=.965] (\qrm/2,\qrm/2) circle[radius=\qrm/3]}
-% | | - -
-\newpattern1000{(0,\qrm)[qrrc] -- (0,0) -- (\qrm,0) -- (\qrm,\qrm)\qrframesuffix}
-\newpattern0001{(0,0)[qrrc] -- (0,\qrm) -- (\qrm,\qrm) -- (\qrm,0)\qrframesuffix}
-\newpattern0100{(0,0)[qrrc] -- (\qrm,0) -- (\qrm,\qrm) -- (0,\qrm)\qrframesuffix}
-\newpattern0010{(\qrm,0)[qrrc] -- (0,0) -- (0,\qrm) -- (\qrm,\qrm)\qrframesuffix}
-% corners; the good injections to cover loose lines
-\newpattern1100{(\qrm,\qrm)[qrrc] -- (\qrm,0) -- (0,0); \path[fill] (0,\qrm) \qrfillring\qrframesuffix}% top left
-\newpattern1010{(0,\qrm)[qrrc] -- (0,0) -- (\qrm,0); \path[fill] (\qrm,\qrm) \qrfillring\qrframesuffix}% top right
-\newpattern0101{(0,\qrm)[qrrc] -- (\qrm,\qrm) -- (\qrm,0); \path[fill] (0,0) \qrfillring\qrframesuffix}% bottom left
-\newpattern0011{(\qrm,\qrm)[qrrc] -- (0,\qrm) -- (0,0) (\qrm,0); \path[fill] (\qrm,0) \qrfillring\qrframesuffix}% bottom right
-% straights | --
-\newpattern1001{(0,0)--(0,\qrm) (\qrm,0)--(\qrm,\qrm)\qrframesuffix}
-\newpattern0110{(0,0)--(\qrm,0) (0,\qrm)--(\qrm,\qrm)\qrframesuffix}
-% enclosed
-\newpattern1111{; \path[fill] (0,0) \qrfillring; \path[fill] (0,\qrm) \qrfillring; \path[fill] (\qrm,0) \qrfillring; \path[fill] (\qrm,\qrm) \qrfillring\qrframesuffix}
-% t's
-\newpattern0111{(0,\qrm)--(\qrm,\qrm); \path[fill] (0,0) \qrfillring; \path[fill] (\qrm,0) \qrfillring\qrframesuffix} % -,-
-\newpattern1011{(0,\qrm)--(0,0); \path[fill] (\qrm,0) \qrfillring; \path[fill] (\qrm,\qrm)\qrfillring\qrframesuffix}
-\newpattern1101{(\qrm,\qrm)--(\qrm,0); \path[fill] (0,0) \qrfillring; \path[fill] (0,\qrm)\qrfillring\qrframesuffix}
-\newpattern1110{(0,0)--(\qrm,0); \path[fill] (0,\qrm) \qrfillring; \path[fill] (\qrm,\qrm) \qrfillring\qrframesuffix} % -'- \ No newline at end of file
+\def\fancyqr@rounded@rect@close{\linethickness{.1\qr@modulesize}\closepath\strokepath}%
+\FancyQrLoadDefault \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-glitch.code b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-glitch.code
index 3d6418ec03d..937b694044f 100644
--- a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-glitch.code
+++ b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-glitch.code
@@ -1,23 +1,35 @@
-\def\@tikz@fancy@qr@blobb{[qrrc] (0,0) +(0:.35*\qrm+.25*\qrm*rnd) foreach \a in {20,40,...,359} {-- +(\a:.35*\qrm+.2*\qrm*rnd)} -- cycle}%
+\def\@fancy@qr@blobb{%
+\@tempcnta=\z@
+\roundjoin
+\roundcap
+\moveto(0,0)
+\loop
+\advance\@tempcnta by 40
+\def\rad{\fpeval{.2*\qr@modulesize+.115*\qr@modulesize*rand()}}% allow to 'glitch'
+\lineto(\fpeval{cos(\@tempcnta)*\rad},\fpeval{sin(\@tempcnta)*\rad})
+\ifnum\@tempcnta<360\relax
+\repeat
+\fillpath
+}%
% .
-\newpattern0000{\@tikz@fancy@qr@blobb}%
+\newpattern0000{\@fancy@qr@blobb}%
% | | - -
-\newpattern1000{\@tikz@fancy@qr@blobb}%
-\newpattern0001{\@tikz@fancy@qr@blobb}%
-\newpattern0100{\@tikz@fancy@qr@blobb}%
-\newpattern0010{\@tikz@fancy@qr@blobb}%
+\newpattern1000{\@fancy@qr@blobb}%
+\newpattern0001{\@fancy@qr@blobb}%
+\newpattern0100{\@fancy@qr@blobb}%
+\newpattern0010{\@fancy@qr@blobb}%
% corners
-\newpattern1100{\@tikz@fancy@qr@blobb}%
-\newpattern1010{\@tikz@fancy@qr@blobb}%
-\newpattern0101{\@tikz@fancy@qr@blobb}%
-\newpattern0011{\@tikz@fancy@qr@blobb}%
+\newpattern1100{\@fancy@qr@blobb}%
+\newpattern1010{\@fancy@qr@blobb}%
+\newpattern0101{\@fancy@qr@blobb}%
+\newpattern0011{\@fancy@qr@blobb}%
% straights | --
-\newpattern1001{\@tikz@fancy@qr@blobb}%
-\newpattern0110{\@tikz@fancy@qr@blobb}%
+\newpattern1001{\@fancy@qr@blobb}%
+\newpattern0110{\@fancy@qr@blobb}%
% enclosed
-\newpattern1111{\@tikz@fancy@qr@blobb}%
+\newpattern1111{\@fancy@qr@blobb}%
% t's
-\newpattern0111{\@tikz@fancy@qr@blobb}%
-\newpattern1011{\@tikz@fancy@qr@blobb}%
-\newpattern1101{\@tikz@fancy@qr@blobb}%
-\newpattern1110{\@tikz@fancy@qr@blobb}% \ No newline at end of file
+\newpattern0111{\@fancy@qr@blobb}%
+\newpattern1011{\@fancy@qr@blobb}%
+\newpattern1101{\@fancy@qr@blobb}%
+\newpattern1110{\@fancy@qr@blobb}% \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-swift.code b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-swift.code
index acee6aee94c..529213f04f8 100644
--- a/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-swift.code
+++ b/Master/texmf-dist/tex/latex/fancyqr/fancyqr-style-swift.code
@@ -1,24 +1,2 @@
-\def\fancy@qrbound{;\pgfresetboundingbox\path(0,0)rectangle(\qrm,\qrm)}%
-% note: the expansion with two seems to be problematic, therefore i use cordinate
-% .
-\newpattern0000{(.5*\qrm,1.1*\qrm)coordinate(@)(1.1*\qrm,.5*\qrm)coordinate(@b)(.5*\qrm,-.1*\qrm)coordinate(@c)(-.1*\qrm,.5*\qrm)coordinate(@d)to[bend right=15](@)to[bend right=15](@b)to[bend right=15](@c)to[bend right=15](@d)\fancy@qrbound}%
-% | | - -
-\newpattern1000{(.5*\qrm,-.1*\qrm)coordinate(@)(0,.2*\qrm)coordinate(@b)|-(\qrm,\qrm)--(\qrm,.2*\qrm)to[out=181,in=65](@)to[out=115,in=1](@b)}%
-\newpattern0001{(.5*\qrm,1.1*\qrm)coordinate(@)(0,.8*\qrm)coordinate(@b)|-(\qrm,0)--(\qrm,.8*\qrm)to[out=179,in=290](@)to[out=250,in=1](@b)}%
-\newpattern0100{(1.1*\qrm,.5*\qrm)coordinate(@)(.8*\qrm,\qrm)coordinate(@b)-|(0,0)--(.8*\qrm,0)to[out=89,in=205](@)to[out=155,in=271](@b)}%
-\newpattern0010{(-.1*\qrm,.5*\qrm)coordinate(@)(.2*\qrm,\qrm)coordinate(@b)-|(\qrm,0)--(.2*\qrm,0)to[out=91,in=335](@)to[out=25,in=269](@b)}%
-% corners
-\newpattern1100{(1.1*\qrm,-.1*\qrm)coordinate(@)(\qrm,\qrm)to[out=271,in=105](@)to[out=155,in=-1](0,0)--(0,\qrm)--(\qrm,\qrm)\fancy@qrbound}%
-\newpattern1010{(-.1*\qrm,-.1*\qrm)coordinate(@)(\qrm,0)coordinate(@b)(0,\qrm)to[out=269,in=75](@)to[out=25,in=181](@b)--(\qrm,\qrm)--(0,\qrm)\fancy@qrbound}%
-\newpattern0101{(\qrm+.1*\qrm,\qrm+.1*\qrm)coordinate(@)(0,\qrm)coordinate(@b)(@b) |- (\qrm,0) to[out=89,in=255](@)to[out=205,in=1](@b)\fancy@qrbound}%
-\newpattern0011{(-.1*\qrm,\qrm+.1*\qrm)coordinate(@)(0,0)coordinate(@b)(@b) -| (\qrm,\qrm) to[out=179,in=335](@)to[out=285,in=91](@b)\fancy@qrbound}%
-% straights | --
-\newpattern1001{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern0110{(0,0)rectangle(\qrm,\qrm)}%
-% enclosed
-\newpattern1111{(0,0)rectangle(\qrm,\qrm)}%
-% t's
-\newpattern0111{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern1011{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern1101{(0,0)rectangle(\qrm,\qrm)}%
-\newpattern1110{(0,0)rectangle(\qrm,\qrm)}% \ No newline at end of file
+\PackageWarning{fancyqr}{Currently, swift is not supported :/}
+\FancyQrLoadDefault \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/fancyqr/fancyqr.sty b/Master/texmf-dist/tex/latex/fancyqr/fancyqr.sty
index 5d199ecccae..bb2b9f3ebb5 100644
--- a/Master/texmf-dist/tex/latex/fancyqr/fancyqr.sty
+++ b/Master/texmf-dist/tex/latex/fancyqr/fancyqr.sty
@@ -1,21 +1,29 @@
-% Florian Sihler, 2022
+% Florian Sihler, 2024
% Licensed under GNU General Public License version 3
% https://opensource.org/licenses/gpl-3.0.html
\def\filename{fancyqr}
-\ProvidesPackage{\filename}[2022/08/19 version v1.1 Fancy QR-Codes]
-\RequirePackage{tikz, qrcode}
+\ProvidesPackage{\filename}[2024/04/13 version v2.0 Fancy QR-Codes]
+\RequirePackage{pict2e, xfp, qrcode}
% element
% x: {\the\j}; y: {\the\i} | \@max@x \@max@y
-\def\FancyQrColor#1{\if@fancyqr@gradient
-\pgfmathsetmacro\angle{Mod(\fancyqr@gradient@angle+225,360)}% rotate to align 0 to the right
-\pgfmathsetmacro\gradient{%
+\def\@@fancyqr@color@gradient#1{\edef\angle{\fpeval{%
+ % approximate mod
+ \fancyqr@gradient@angle+225 - floor((\fancyqr@gradient@angle+225)/360)*360
+}}% rotate to align 0 to the right
+\edef\gradient{\fpeval{%
% we do rotate the x and y points before color drawing by
% Mod(\fancyqr@gradient@angle,360) with the shifted origin
% Old: #3/2 #4/2
- ((\the\j-\@max@x/2)*cos(\angle) - (\the\i-\@max@y/2)*sin(\angle) + \@max@x/2)/\@max@x * 50% rel x [0,1]
- + ((\the\j-\@max@x/2)*sin(\angle) + (\the\i-\@max@y/2)*cos(\angle) + \@max@y/2)/\@max@y * 50% rel y [0,1]
- }\@declaredcolor{qr@fancy@gradient@br!\gradient!qr@fancy@gradient@tl}\else\@declaredcolor{qr@fancy@gradient@tl}\fi{#1}}
+ ((\the\j-\@half@max@x)*cos(\angle) - (\the\i-\@half@max@y)*sin(\angle) + \@half@max@x)/\@max@x * 50% rel x [0,1]
+ + ((\the\j-\@half@max@x)*sin(\angle) + (\the\i-\@half@max@y)*cos(\angle) + \@half@max@y)/\@max@y * 50% rel y [0,1]
+ }}\@declaredcolor{qr@fancy@gradient@br!\gradient!qr@fancy@gradient@tl}{#1}}
+\def\@@fancyqr@color@default#1{\@declaredcolor{qr@fancy@gradient@tl}{#1}}
+\def\@@fancyqr@color@random#1{\pgfmathrandomitem{\@fancyqr@random@c@l@r}{@@fancyqr@@randomcol}\@declaredcolor{\@fancyqr@random@c@l@r}{#1}}
+\let\FancyQrColor\@@fancyqr@color@default
+
+\def\fancyqr@rounding@factor{.5}
+\edef\fancyqr@rounding@other{\fpeval{1-\fancyqr@rounding@factor}}
% O 1 O
% 2 X 3
@@ -26,43 +34,71 @@
\csname qcc\@up\@left\@right\@down\endcsname
\else\rule\qr@modulesize\z@\fi}
-\tikzset{qrrc/.style={rounded corners=.5\qr@modulesize},qrrd/.style={fill}}
+% backwards compatibility
+\def\fancyqr@clap#1{\hb@xt@\z@{\hss#1\hss}}
+\newdimen\fancyqr@edge@compensate
+\fancyqr@edge@compensate=.15\p@
% is larger to be compensated by overlaps
-\def\qrm{\dimexpr\qr@modulesize+.15\p@\relax}
+\def\qrm{\dimexpr\qr@modulesize+\fancyqr@edge@compensate\relax}
\long\def\qr@newpattern#1#2#3#4#5{%
-\expandafter\def\csname qcc#1#2#3#4\endcsname{%
- \parbox[b][\qr@modulesize]\qr@modulesize{\kern-.075\p@\smash{\clap{\tikz[x=\qrm,y=\qrm,inner sep=\z@,outer sep=\z@]{\path[qrrd]#5;}}}}%
+\expandafter\def\csname qcc#1#2#3#4\endcsname{\parbox[b][\qr@modulesize]\qr@modulesize{\kern-\fancyqr@edge@compensate\relax\smash{\fancyqr@clap{\picture(\@ne,\@ne)#5\endpicture}}}%
}}
-\def\FancyLoadDefault{%
+% [#3][#2]
+% [#4][#1]
+\def\fancyqr@rounded@rect#1#2#3#4{%
+ \ifnum#4=\@ne\relax \moveto(\fancyqr@rounding@factor,\z@)\else\moveto(\z@,\z@)\fi
+ \ifnum#1=\@ne
+ \lineto(\fancyqr@rounding@other,\z@)%
+ \circlearc\fancyqr@rounding@other\fancyqr@rounding@factor\fancyqr@rounding@factor{270}{360}
+ \else\lineto(\@ne,\z@)\fi
+ \ifnum#2=\@ne
+ \lineto(\@ne,\fancyqr@rounding@other)%
+ \circlearc\fancyqr@rounding@other\fancyqr@rounding@other\fancyqr@rounding@factor{0}{90}
+ \else\lineto(\@ne,\@ne)\fi
+ \ifnum#3=\@ne
+ \lineto(\fancyqr@rounding@factor,\@ne)%
+ \circlearc\fancyqr@rounding@factor\fancyqr@rounding@other\fancyqr@rounding@factor{90}{180}
+ \else\lineto(\z@,\@ne)\fi
+ \ifnum#4=\@ne
+ \lineto(\z@,\fancyqr@rounding@factor)%
+ \circlearc\fancyqr@rounding@factor\fancyqr@rounding@factor\fancyqr@rounding@factor{180}{270}
+ \else\lineto(\z@,\z@)\fi
+ \fancyqr@rounded@rect@close
+}
+\def\fancyqr@rounded@rect@close{\fillpath}
+
+\def\FancyQrLoadDefault{%
% .
-\qr@newpattern0000{[qrrc](0,0)rectangle(\qrm,\qrm)}%
+\qr@newpattern0000{\fancyqr@rounded@rect1111}%
% | | - -
-\qr@newpattern1000{(0,\qrm)[qrrc]--(0,0)--(\qrm,0)[sharp corners]--(\qrm,\qrm)--cycle}%
-\qr@newpattern0001{(0,0)[qrrc]--(0,\qrm)--(\qrm,\qrm)[sharp corners]--(\qrm,0)--cycle}%
-\qr@newpattern0100{(0,0)[qrrc]--(\qrm,0)--(\qrm,\qrm)[sharp corners]--(0,\qrm)--cycle}%
-\qr@newpattern0010{(\qrm,0)[qrrc]--(0,0)--(0,\qrm)[sharp corners]--(\qrm,\qrm)--cycle}%
+\qr@newpattern1000{\fancyqr@rounded@rect1001}%
+\qr@newpattern0001{\fancyqr@rounded@rect0110}%
+\qr@newpattern0100{\fancyqr@rounded@rect1100}%
+\qr@newpattern0010{\fancyqr@rounded@rect0011}%
% corners
-\qr@newpattern1100{(\qrm,\qrm)[qrrc]--(\qrm,0)[sharp corners]--(0,0)--(0,\qrm)--cycle}% top left
-\qr@newpattern1010{(0,\qrm)[qrrc]--(0,0)[sharp corners]--(\qrm,0)--(\qrm,\qrm)--cycle}% top right
-\qr@newpattern0101{(0,\qrm)[qrrc]--(\qrm,\qrm)[sharp corners]--(\qrm,0)--(0,0)--cycle}% bottom left
-\qr@newpattern0011{(0,0)[qrrc]--(0,\qrm)[sharp corners]--(\qrm,\qrm)--(\qrm,0)--cycle}% bottom right
+\qr@newpattern1100{\fancyqr@rounded@rect1000}% bottom right
+\qr@newpattern1010{\fancyqr@rounded@rect0001}% bottom left
+\qr@newpattern0101{\fancyqr@rounded@rect0100}% top right
+\qr@newpattern0011{\fancyqr@rounded@rect0010}% top left
% straights | --
-\qr@newpattern1001{(0,0)rectangle(\qrm,\qrm)}%
-\qr@newpattern0110{(0,0)rectangle(\qrm,\qrm)}%
+\qr@newpattern1001{\fancyqr@rounded@rect0000}%
+\qr@newpattern0110{\fancyqr@rounded@rect0000}%
% enclosed
-\qr@newpattern1111{(0,0)rectangle(\qrm,\qrm)}%
+\qr@newpattern1111{\fancyqr@rounded@rect0000}%
% t's
-\qr@newpattern0111{(0,0)rectangle(\qrm,\qrm)}%
-\qr@newpattern1011{(0,0)rectangle(\qrm,\qrm)}%
-\qr@newpattern1101{(0,0)rectangle(\qrm,\qrm)}%
-\qr@newpattern1110{(0,0)rectangle(\qrm,\qrm)}%
+\qr@newpattern0111{\fancyqr@rounded@rect0000}%
+\qr@newpattern1011{\fancyqr@rounded@rect0000}%
+\qr@newpattern1101{\fancyqr@rounded@rect0000}%
+\qr@newpattern1110{\fancyqr@rounded@rect0000}%
}
-\FancyLoadDefault % allows to reset the style after other loads
+\FancyQrLoadDefault % allows to reset the style after other loads
\def\@fancy@qr@default@name{default}
-\def\FancyQrLoad#1{\let\@tmp\newpattern\let\newpattern\qr@newpattern\@bsphack\def\@@tmp{#1}\ifx\@@tmp\@fancy@qr@default@name\FancyLoadDefault\else
+\def\FancyQrLoad#1{%
+\def\fancyqr@rounded@rect@close{\fillpath}%
+\let\@tmp\newpattern\let\newpattern\qr@newpattern\@bsphack\def\@@tmp{#1}\ifx\@@tmp\@fancy@qr@default@name\FancyQrLoadDefault\else
\expandafter\edef\csname pingu@lib@#1@atcode\endcsname{\the\catcode`\@}%
\catcode`\@=11\relax
\input{fancyqr-style-#1.code}
@@ -108,6 +144,7 @@
\def\fancy@qr@printmatrix#1{%
\def\qr@white{0}\def\qr@black{1}%
+ \protected@edef\fancyqr@currprint{#1}%
\let\qr@black@fixed\qr@black
\let\qr@white@fixed\qr@white
\let\qr@black@format\qr@black
@@ -115,44 +152,50 @@
%Set module size
\qr@modulesize=\qr@desiredheight
\divide\qr@modulesize by \qr@size\relax
- \qr@minipagewidth=\qr@modulesize
+ \unitlength=\dimexpr\qr@modulesize+\fancyqr@edge@compensate\relax % initialize unitlength once
\if@fancyqr@image@% image is in \fancyqr@imgbox
- \pgfmathsetmacro\@x{int(ceil((.5\wd\fancyqr@imgbox)/\qr@modulesize)+\fancyqr@img@padding@x)}%
- \pgfmathsetmacro\@y{int(ceil((.5\ht\fancyqr@imgbox+.5\dp\fancyqr@imgbox)/\qr@modulesize)+\fancyqr@img@padding@y)}%
+ \edef\@x{\fpeval{ceil((.5\wd\fancyqr@imgbox)/\qr@modulesize)+\fancyqr@img@padding@x}}%
+ \edef\@y{\fpeval{ceil((.5\ht\fancyqr@imgbox+.5\dp\fancyqr@imgbox)/\qr@modulesize)+\fancyqr@img@padding@y}}%
\FancyQrDoNotPrintSquare\@x\@y
\fi
- \multiply\qr@minipagewidth by \qr@size\relax
- \ifqr@tight \else \advance\qr@minipagewidth by 8\qr@modulesize \fi
- \minipage\qr@minipagewidth
+ \qr@minipagewidth=\qr@desiredheight
+ \ifqr@tight \advance\qr@minipagewidth by -\qr@modulesize \else \advance\qr@minipagewidth by 7\qr@modulesize \fi
+ \minipage\qr@minipagewidth%
+ \hfuzz=\qr@modulesize
\baselineskip=\qr@modulesize
+ \lineskiplimit=\z@ \lineskip=\z@ \parskip=\z@
\ifqr@tight\else\rule\z@{4\qr@modulesize}\par\fi% %Blank space at top.
- \edef\@max@x{\qr@numberofrowsinmatrix{#1}}%
- \edef\@max@y{\qr@numberofcolsinmatrix{#1}}%
- \edef\@do@x@min{\the\numexpr\@max@x/2-\fancy@qr@donotprint@center@x-1}%
- \edef\@do@x@max{\the\numexpr\@max@x/2+\fancy@qr@donotprint@center@x+1}%
- \edef\@do@y@min{\the\numexpr\@max@y/2-\fancy@qr@donotprint@center@y-1}%
- \edef\@do@y@max{\the\numexpr\@max@y/2+\fancy@qr@donotprint@center@y+1}%
- \qr@for \i=1 to \@max@y by 1{%
+ \edef\@max@x{\qr@numberofrowsinmatrix\fancyqr@currprint}\edef\@half@max@x{\the\numexpr\@max@x/2}%
+ \edef\@max@y{\qr@numberofcolsinmatrix\fancyqr@currprint}\edef\@half@max@y{\the\numexpr\@max@y/2}%
+ \edef\@do@x@min{\the\numexpr\@half@max@x-\fancy@qr@donotprint@center@x-\@ne}%
+ \edef\@do@x@max{\the\numexpr\@half@max@x+\fancy@qr@donotprint@center@x+\@ne}%
+ \edef\@do@y@min{\the\numexpr\@half@max@y-\fancy@qr@donotprint@center@y-\@ne}%
+ \edef\@do@y@max{\the\numexpr\@half@max@y+\fancy@qr@donotprint@center@y+\@ne}%
+ \qr@for \i=\@ne to \@max@y by \@ne{%
\ifqr@tight\else\rule{4\qr@modulesize}\z@\fi% %Blank space at left.
- \qr@for \j=1 to \@max@x by 1{%
+ \qr@for \j=\@ne to \@max@x by \@ne{%
\qr@fancy@updateif\i\j
\iffancy@qr@do@print@
- \edef\@mid{\qr@matrixentry{#1}{\the\i}{\the\j}}%
+ \edef\@mid{\qr@matrixentry\fancyqr@currprint{\the\i}{\the\j}}%
\ifnum\@mid=\qr@white
\rule\qr@modulesize\z@
\else% if not white, get its pattern
- \iffancy@qr@roundcut@\qr@fancy@clear@surround{#1}{\the\i}{\the\j}\fi
- \edef\@up{\qr@matrixentry{#1}{\the\numexpr\the\i-1}{\the\j}}%
- \edef\@left{\qr@matrixentry{#1}{\the\i}{\the\numexpr\the\j-1}}%
- \edef\@right{\qr@matrixentry{#1}{\the\i}{\the\numexpr\the\j+1}}%
- \edef\@down{\qr@matrixentry{#1}{\the\numexpr\the\i+1}{\the\j}}%
+ \iffancy@qr@roundcut@\qr@fancy@clear@surround\fancyqr@currprint{\the\i}{\the\j}\fi
+ \edef\@up{\qr@matrixentry\fancyqr@currprint{\the\numexpr\the\i-1}{\the\j}}%
+ \edef\@left{\qr@matrixentry\fancyqr@currprint{\the\i}{\the\numexpr\the\j-1}}%
+ \edef\@right{\qr@matrixentry\fancyqr@currprint{\the\i}{\the\numexpr\the\j+1}}%
+ \edef\@down{\qr@matrixentry\fancyqr@currprint{\the\numexpr\the\i+1}{\the\j}}%
\FancyQrColor{\GetPattern}%
\fi\else \rule\qr@modulesize\z@\fi
}\par}%
\ifqr@tight\else\rule\z@{4\qr@modulesize}\par\fi
\endminipage
\if@fancyqr@image@\nobreak
- \llap{\parbox\qr@minipagewidth{\centering\usebox\fancyqr@imgbox}}\fi
+ \llap{\parbox\qr@minipagewidth{\centering\usebox\fancyqr@imgbox}%
+ % if half the width is odd, offset by half a module width, done by centering
+ \edef\@halfcheck{\fpeval{round(\fancy@qr@donotprint@center@x/2)}}%
+ \ifodd\@halfcheck \kern.5\qr@modulesize\fi
+ }\fi
}%
\def\fancy@qr@setup#1{%
@@ -205,17 +248,21 @@
}%
\newsavebox\fancyqr@imgbox
+\newif\if@fancyqr@randomcolor@
\define@key{fancyqr}{image x padding}{\def\fancyqr@img@padding@x{#1}}
\define@key{fancyqr}{image y padding}{\def\fancyqr@img@padding@y{#1}}
\define@key{fancyqr}{image padding}{\def\fancyqr@img@padding@x{#1}\def\fancyqr@img@padding@y{#1}}
\define@key{fancyqr}{image}{\@fancyqr@image@true\savebox\fancyqr@imgbox{#1}}
-\define@key{fancyqr}{color}{\@fancyqr@gradientfalse\colorlet{qr@fancy@gradient@tl}{#1}}
-\define@key{fancyqr}{left color}{\colorlet{qr@fancy@gradient@br}{#1}}
-\define@key{fancyqr}{l color}{\colorlet{qr@fancy@gradient@br}{#1}}
-\define@key{fancyqr}{right color}{\colorlet{qr@fancy@gradient@tl}{#1}}
-\define@key{fancyqr}{r color}{\colorlet{qr@fancy@gradient@tl}{#1}}
-\define@key{fancyqr}{gradient angle}{\def\fancyqr@gradient@angle{#1}}
+\define@key{fancyqr}{color}{\@fancyqr@randomcolor@false\@fancyqr@gradientfalse\colorlet{qr@fancy@gradient@tl}{#1}}
+\define@key{fancyqr}{left color}{\@fancyqr@randomcolor@false\colorlet{qr@fancy@gradient@br}{#1}}
+\define@key{fancyqr}{l color}{\@fancyqr@randomcolor@false\colorlet{qr@fancy@gradient@br}{#1}}
+\define@key{fancyqr}{right color}{\@fancyqr@randomcolor@false\colorlet{qr@fancy@gradient@tl}{#1}}
+\define@key{fancyqr}{r color}{\@fancyqr@randomcolor@false\colorlet{qr@fancy@gradient@tl}{#1}}
+\define@key{fancyqr}{gradient angle}{\@fancyqr@randomcolor@false\def\fancyqr@gradient@angle{#1}}
\define@boolkey{fancyqr}[@fancyqr@]{gradient}[true]{}% if@fancyqr@gradient
+\define@key{fancyqr}{random color}{\@fancyqr@randomcolor@true\def\@fancyqr@random@colors{#1}}
+\define@key{fancyqr}{width}{\setkeys{qr}{height=#1}}
+\define@key{fancyqr}{size}{\setkeys{qr}{height=#1}}
\def\fancyqrset#1{\setkeys{qr,fancyqr}{#1}}
\fancyqrset{image padding=0,gradient=true,gradient angle=135,r color=teal,l color=purple}
@@ -227,8 +274,12 @@
\def\ns@fancyqr{\qr@starinvokedfalse\@@fancyqr}
\newcommand\@@fancyqr[1][]{\begingroup\@fancyqr@init
\ifqr@starinvoked\qr@hyperlinkfalse\fi
-\setkeys{qr,fancyqr}{#1}\bgroup
-\qr@verbatimcatcodes\qr@setescapedspecials\qrcode@in}
+\setkeys{qr,fancyqr}{#1}%
+\if@fancyqr@randomcolor@%
+\ifcsname pgfmathdeclarerandomlist\endcsname\else
+\PackageError{fancyqr}{Random colors requested but pgfmath not loaded}{Please load pgfmath if you want this}\fi
+\pgfmathdeclarerandomlist{@@fancyqr@@randomcol}{\@fancyqr@random@colors}\let\FancyQrColor\@@fancyqr@color@random\else\if@fancyqr@gradient\let\FancyQrColor\@@fancyqr@color@gradient\fi\fi
+\bgroup\qr@verbatimcatcodes\qr@setescapedspecials\qrcode@in}
\endinput
% TODO: NEGATIVE PATTERNS IF MIDDLE IS 0