fix display bug if no company is set; improve title width vs. logo wodthy
This commit is contained in:
+48
-20
@@ -198,10 +198,15 @@
|
||||
|
||||
% internal boxes and lengths for measuring
|
||||
\newsavebox{\BCQ@namebox}
|
||||
\newsavebox{\BCQ@logobox}
|
||||
\newlength{\BCQ@logoheightdimen}
|
||||
\setlength{\BCQ@logoheightdimen}{0pt}% initialize to prevent errors
|
||||
\newlength{\BCQ@reservedheight}
|
||||
\newlength{\BCQ@heightscale}
|
||||
\newlength{\BCQ@namewidth}
|
||||
\newlength{\BCQ@logosep}
|
||||
\newlength{\BCQ@logosepused}
|
||||
\setlength{\BCQ@logosep}{1em}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% name - assemble full name from the parts, such as Xgivennames and Xfamilynames
|
||||
@@ -212,12 +217,30 @@
|
||||
\ifexists{Xfamilynames}{\Xfamilynames}%
|
||||
\ifexists{Xhonoricsuffix}{\ \Xhonoricsuffix}%
|
||||
}
|
||||
\newcommand\ifhaspersonalname[2]{%
|
||||
\ifcsdef{Xhonoricprefix}{#1}{%
|
||||
\ifcsdef{Xgivennames}{#1}{%
|
||||
\ifcsdef{Xadditionalnames}{#1}{%
|
||||
\ifcsdef{Xfamilynames}{#1}{%
|
||||
\ifcsdef{Xhonoricsuffix}{#1}{#2}%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}
|
||||
\newcommand\ifhasposition[2]{%
|
||||
\ifcsdef{Xcompany}{#1}{%
|
||||
\ifcsdef{Xtitle}{#1}{%
|
||||
\ifcsdef{Xrole}{#1}{#2}%
|
||||
}%
|
||||
}%
|
||||
}
|
||||
|
||||
% 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{personalname}{0em}{2em}+\ifcsdef{Xcompany}{2em}{0em}\relax}%
|
||||
\setlength{\BCQ@reservedheight}{\dimexpr\ifhaspersonalname{2em}{0em}+\ifhasposition{2em}{0em}\relax}%
|
||||
\ifdim\BCQ@logoheightdimen>\BCQ@reservedheight
|
||||
\setlength{\BCQ@heightscale}{\dimexpr\textheight-\BCQ@logoheightdimen-\ifcsdef{Xpgpfingerprint}{2em}{0em}\relax}%
|
||||
\else
|
||||
@@ -227,27 +250,24 @@
|
||||
\newcommand\heightscale{\BCQ@heightscale}
|
||||
|
||||
\newcommand\companyrolestring{%
|
||||
\ifcsdef{Xtitle}{\Xtitle}{}%
|
||||
\ifcsdef{Xrole}{%
|
||||
\ifcsdef{Xtitle}{, }{}%
|
||||
\Xrole
|
||||
}{}%
|
||||
\ifcsdef{Xcompany}{%
|
||||
\ifcsdef{Xtitle}{%
|
||||
\Xtitle%
|
||||
\ifcsdef{Xrole}{, \Xrole}{}%
|
||||
\ \Xcompany%
|
||||
}{%
|
||||
\ifcsdef{Xrole}{%
|
||||
\Xrole\ \Xcompany%
|
||||
}{%
|
||||
\Xcompany%
|
||||
}%
|
||||
\ifcsdef{Xtitle}{\ \Xcompany}{%
|
||||
\ifcsdef{Xrole}{\ \Xcompany}{\Xcompany}%
|
||||
}%
|
||||
}{}%
|
||||
}
|
||||
\newcommand\name{%
|
||||
\personalname
|
||||
\ifcsdef{Xcompany}{%
|
||||
\ifcsempty{personalname}{%
|
||||
\companyrolestring
|
||||
}{%
|
||||
\ifhasposition{%
|
||||
\ifhaspersonalname{%
|
||||
\ (\companyrolestring)%
|
||||
}{%
|
||||
\companyrolestring
|
||||
}%
|
||||
}{}%
|
||||
}
|
||||
@@ -443,6 +463,7 @@ END:VCARD\BCQ@nl}
|
||||
}%
|
||||
% Store logo height as dimension for heightscale calculation
|
||||
\ifcsdef{Xlogo}{%
|
||||
\sbox{\BCQ@logobox}{\includegraphics[height=\BCQ@logoheight@used]{\Xlogo}}%
|
||||
\setlength{\BCQ@logoheightdimen}{\BCQ@logoheight@used}%
|
||||
}{%
|
||||
\setlength{\BCQ@logoheightdimen}{0pt}%
|
||||
@@ -450,13 +471,20 @@ END:VCARD\BCQ@nl}
|
||||
% Compute heightscale after logo height is known
|
||||
\computeheightscale
|
||||
\ifcsdef{Xlogo}{% logo defined
|
||||
% Logo next to name: two-column layout (logo | name)
|
||||
% Logo next to name: dynamic columns (logo natural width, name uses remaining space)
|
||||
\setlength{\BCQ@logosepused}{\BCQ@logosep}%
|
||||
\setlength{\BCQ@namewidth}{\dimexpr\textwidth-\wd\BCQ@logobox-\BCQ@logosepused\relax}%
|
||||
\ifdim\BCQ@namewidth<0pt
|
||||
\setlength{\BCQ@logosepused}{0pt}%
|
||||
\setlength{\BCQ@namewidth}{\dimexpr\textwidth-\wd\BCQ@logobox\relax}%
|
||||
\ifdim\BCQ@namewidth<0pt\setlength{\BCQ@namewidth}{0pt}\fi
|
||||
\fi
|
||||
\begin{minipage}{\textwidth}
|
||||
\begin{minipage}[c]{0.30\textwidth}% logo column
|
||||
\includegraphics[height=\BCQ@logoheight@used]{\Xlogo}%
|
||||
\begin{minipage}[c]{\wd\BCQ@logobox}% logo column
|
||||
\usebox{\BCQ@logobox}%
|
||||
\end{minipage}
|
||||
\hfill
|
||||
\begin{minipage}[c]{0.67\textwidth}% name column
|
||||
\hspace{\BCQ@logosepused}
|
||||
\begin{minipage}[c]{\BCQ@namewidth}% name column
|
||||
\ifBCQ@rightalign\raggedleft\fi% apply alignment
|
||||
{\bfseries\cond{name}}%
|
||||
% Optional company logo below name
|
||||
|
||||
Reference in New Issue
Block a user