logo has good default and is freely stylable

This commit is contained in:
Marc Wäckerlin
2025-11-09 12:51:22 +01:00
parent eaa40a3901
commit b11a347034
6 changed files with 31 additions and 5 deletions
+28 -4
View File
@@ -153,15 +153,31 @@
\newcommand\ifboth[3]{\ifcsdef{#1}{\ifcsdef{#2}{#3}{}}{}}
\newcommand\ifany[3]{\ifcsdef{#1}{#3}{\ifcsdef{#2}{#3}{}}}
\newcommand\cond[1]{\ifcsdef{#1}{\exec{#1}}{}}
\newcommand\heightscale{\dimexpr\textheight-\ifcsempty{name}{0em}{2em}-\ifcsdef{Xpgpfingerprint}{2em}{0em}-\ifcsdef{Xcompany}{2em}{0em}\relax}
% internal boxes and lengths for measuring
\newsavebox{\BCQ@namebox}
\newlength{\BCQ@logoheightdimen}
\setlength{\BCQ@logoheightdimen}{0pt}% initialize to prevent errors
\newlength{\BCQ@reservedheight}
\newlength{\BCQ@heightscale}
% heightscale - calculate available height for text/QR
% Uses actual logo height if logo is taller than default reserved space
% This is computed as a length and stored, not a macro
\newcommand\computeheightscale{%
\setlength{\BCQ@reservedheight}{\dimexpr\ifcsempty{name}{0em}{2em}+\ifcsdef{Xcompany}{2em}{0em}\relax}%
\ifdim\BCQ@logoheightdimen>\BCQ@reservedheight
\setlength{\BCQ@heightscale}{\dimexpr\textheight-\BCQ@logoheightdimen-\ifcsdef{Xpgpfingerprint}{2em}{0em}\relax}%
\else
\setlength{\BCQ@heightscale}{\dimexpr\textheight-\BCQ@reservedheight-\ifcsdef{Xpgpfingerprint}{2em}{0em}\relax}%
\fi
}
\newcommand\heightscale{\BCQ@heightscale}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% name - assemble full name from the parts, such as Xgivennames and Xfamilynames
\newcommand\name{\ifexists{Xhonoricprefix}{\Xhonoricprefix\ }\ifexists{Xgivennames}{\Xgivennames\ }\ifexists{Xfamilynames}{\Xfamilynames}\ifexists{Xhonoricsuffix}{\ \Xhonoricsuffix}}
% internal box for measuring name height when logo is present
\newsavebox{\BCQ@namebox}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% vcard - the content of the vcard
@@ -332,6 +348,14 @@ END:VCARD\BCQ@nl}
\ifx\BCQ@logoheight\@empty
\ifcsdef{Xcompany}{\def\BCQ@logoheight{4em}}{\def\BCQ@logoheight{2em}}%
\fi
% Store logo height as dimension for heightscale calculation
\ifcsdef{Xlogo}{%
\setlength{\BCQ@logoheightdimen}{\BCQ@logoheight}%
}{%
\setlength{\BCQ@logoheightdimen}{0pt}%
}%
% Compute heightscale after logo height is known
\computeheightscale
\ifcsdef{Xlogo}{% logo defined
\ifBCQ@logoinqr
% Logo in QR code: show name only
Binary file not shown.
+1 -1
View File
@@ -1,5 +1,5 @@
% !TeX program = xelatex
\documentclass[bgscale=1.2,bgopacity=0.6,qrbgopacity=0.8]{businesscard-qrcode}
\documentclass[bgscale=1.2,bgopacity=0.6,qrbgopacity=0.8,logoheight=6em]{businesscard-qrcode}
\type{home}
\givennames{Petra}
+2
View File
@@ -0,0 +1,2 @@
%PDF-1.7
%הנםר
Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 24 KiB