adapt logo height to number of lines

This commit is contained in:
Marc Wäckerlin
2025-11-09 12:08:18 +01:00
parent 7de41206fd
commit eaa40a3901
8 changed files with 12 additions and 9 deletions
+8 -5
View File
@@ -23,7 +23,7 @@
\DeclareStringOption[Q]{qreclevel} % QR code error correction level (L,M,Q,H) default Q
\DeclareStringOption[0.25]{qrlogoscale} % logo size in QR code as fraction of QR width (1.0 = 100%), default 0.25
\DeclareStringOption[0.02]{qrlogoborder} % white padding around logo in QR as fraction of QR width (1.0 = 100%), default 0.02
\DeclareStringOption[1.0]{logoscale} % scale factor for logo next to name (1.0 = 100% name height), default 1.0
\DeclareStringOption{logoheight} % logo height next to name (with unit, e.g., 4em), default: 4em if company set, 2em otherwise
\DeclareStringOption[1.0]{bgscale} % background image scale (1.0 = 100% card height), default 1.0
\DeclareStringOption[1.0]{bgopacity} % background image opacity (1.0 = 100% visible, 0.0 = invisible), default 1.0
\DeclareStringOption[1.0]{qrbgopacity} % QR code background opacity (1.0 = white solid, 0.0 = transparent), default 1.0
@@ -328,6 +328,10 @@ END:VCARD\BCQ@nl}
\newcommand\insertname{
% typeset name into box for measurement
\sbox{\BCQ@namebox}{\bfseries\cond{name}\ifexists{Xcompany}{\ifcsempty{name}{} { }\Xcompany}}%
% Set default logoheight if not specified: 4em with company, 2em without
\ifx\BCQ@logoheight\@empty
\ifcsdef{Xcompany}{\def\BCQ@logoheight{4em}}{\def\BCQ@logoheight{2em}}%
\fi
\ifcsdef{Xlogo}{% logo defined
\ifBCQ@logoinqr
% Logo in QR code: show name only
@@ -335,13 +339,12 @@ END:VCARD\BCQ@nl}
\ifexists{Xcompany}{\\\Xcompany}%
\else
% Logo next to name: two-column layout (logo | name)
% logoscale: 1.0 = 100% name height (default), 2.0 = 200%, etc.
\begin{minipage}{\textwidth}
\begin{minipage}[c]{0.30\textwidth}% logo column (increased from 0.22)
\includegraphics[height=\fpeval{\BCQ@logoscale}\dimexpr\ht\BCQ@namebox+\dp\BCQ@namebox\relax]{\Xlogo}% scaled to logoscale * name height
\begin{minipage}[c]{0.30\textwidth}% logo column
\includegraphics[height=\BCQ@logoheight]{\Xlogo}%
\end{minipage}
\hfill
\begin{minipage}[c]{0.67\textwidth}% name column (adjusted from 0.75)
\begin{minipage}[c]{0.67\textwidth}% name column
\ifBCQ@rightalign\raggedleft\fi% apply alignment
{\bfseries\cond{name}}%
\ifexists{Xcompany}{\\\Xcompany}%