improved header typography

This commit is contained in:
Marc Wäckerlin
2026-04-30 20:52:37 +02:00
parent 9cebbd80db
commit 1d581d3978
7 changed files with 95 additions and 7 deletions
+4 -1
View File
@@ -171,6 +171,7 @@ Note: direct commands like `\paperwidth{...}` or `\color{...}` would clash with
- `lang=`: wikipedia language prefix, default `de`
- `countryformat=`: `auto` (default), `inline`, or `below`
- `crlf` / `nocrlf`: vCard newline style, default `crlf`
- `vcardversion=`: vCard version string, default `4.0`
### Colors and QR Tuning
@@ -308,7 +309,7 @@ Recognized Commands
- geometry: `\setpaperwidth`, `\setpaperheight`, `\setcontentwidth`, `\setcontentheight`, `\setpadding`, `\setcutdist`, `\setcutlen`
- layout/typography: `\setfontsize`, `\settextwidth`, `\setqrwidth`, `\setqreclevel`, `\setqrlogoscale`, `\setqrlogoborder`, `\setlogoheight`, `\setlayout`, `\setheaderemphasis`
- booleans (`true`/`false`): `\setcrlf`, `\setaddress`, `\sethint`, `\seticon`, `\setrightalign`, `\seticonleft`, `\setfill`, `\setqrfirst`, `\setheader`, `\setqr`, `\sethttps`
- colors/language/format: `\setlang`, `\setcardcolor`, `\setqrcolor`, `\setcountryformat`, `\setbgscale`, `\setbgopacity`, `\setqrbgopacity`
- colors/language/format: `\setlang`, `\setcardcolor`, `\setqrcolor`, `\setcountryformat`, `\setbgscale`, `\setbgopacity`, `\setqrbgopacity`, `\setvcardversion`
- convenience toggles: `\noheader`, `\withheader`, `\noqr`, `\withqr`, `\standardlayout`, `\centeredlayout`
### Document Title Interop
@@ -481,3 +482,5 @@ If you are missing a feature or configuration option, consult [project] and open
[author]: https://marc.wäckerlin.ch "Marc Wäckerlin"
[project]: https://mrw.sh/templates/businesscard-qrcode "the main project page"
[lgpl]: https://www.gnu.org/licenses/lgpl-3.0 "Library GNU Public License"
Fossify Contacts bug report: https://github.com/FossifyOrg/Contacts/issues/548
+91 -6
View File
@@ -51,9 +51,16 @@
\DeclareComplementaryOption{noqr}{qr}
\DeclareBoolOption[true]{https}
\DeclareComplementaryOption{www}{https}
\DeclareBoolOption[true]{vcardaddress}
\DeclareComplementaryOption{novcardaddress}{vcardaddress}
\DeclareBoolOption[false]{vcardcompat}
\DeclareComplementaryOption{novcardcompat}{vcardcompat}
\DeclareBoolOption[false]{vcardminimal}
\DeclareComplementaryOption{novcardminimal}{vcardminimal}
\DeclareStringOption[standard]{layout} % standard, centered
\DeclareStringOption[auto]{countryformat} % auto: <4 chars inline with mdash, >=4 separate line; inline: always inline; below: always separate line
\DeclareStringOption[person]{headeremphasis} % person, company, balanced
\DeclareStringOption[4.0]{vcardversion} % default 4.0 (current behavior), optional 3.0 for compatibility
\DeclareDefaultOption{\@unknownoptionerror}
\ProcessKeyvalOptions*
@@ -140,6 +147,7 @@
\define@key{BCQ@runtime}{countryformat}{\def\BCQ@countryformat{#1}}
\define@key{BCQ@runtime}{layout}{\def\BCQ@layout{#1}}
\define@key{BCQ@runtime}{headeremphasis}{\def\BCQ@headeremphasis{#1}}
\define@key{BCQ@runtime}{vcardversion}{\def\BCQ@vcardversion{#1}}
\define@key{BCQ@runtime}{crlf}[true]{\BCQ@setbool{crlf}{#1}}
\define@key{BCQ@runtime}{nocrlf}[true]{\BCQ@setbool{crlf}{false}}
\define@key{BCQ@runtime}{address}[true]{\BCQ@setbool{address}{#1}\ifBCQ@address\def\printaddress{}\else\csundef{printaddress}\fi}
@@ -162,6 +170,12 @@
\define@key{BCQ@runtime}{noqr}[true]{\BCQ@setbool{qr}{false}}
\define@key{BCQ@runtime}{https}[true]{\BCQ@setbool{https}{#1}}
\define@key{BCQ@runtime}{www}[true]{\BCQ@setbool{https}{false}}
\define@key{BCQ@runtime}{vcardaddress}[true]{\BCQ@setbool{vcardaddress}{#1}}
\define@key{BCQ@runtime}{novcardaddress}[true]{\BCQ@setbool{vcardaddress}{false}}
\define@key{BCQ@runtime}{vcardcompat}[true]{\BCQ@setbool{vcardcompat}{#1}}
\define@key{BCQ@runtime}{novcardcompat}[true]{\BCQ@setbool{vcardcompat}{false}}
\define@key{BCQ@runtime}{vcardminimal}[true]{\BCQ@setbool{vcardminimal}{#1}}
\define@key{BCQ@runtime}{novcardminimal}[true]{\BCQ@setbool{vcardminimal}{false}}
\newcommand\cardsetup[1]{\setkeys{BCQ@runtime}{#1}}
\newcommand\setoption[2]{\setkeys{BCQ@runtime}{#1=#2}}
@@ -190,6 +204,7 @@
\newcommand\setlayout[1]{\setoption{layout}{#1}}
\newcommand\setheaderemphasis[1]{\setoption{headeremphasis}{#1}}
\newcommand\headeremphasis[1]{\setoption{headeremphasis}{#1}}
\newcommand\setvcardversion[1]{\setoption{vcardversion}{#1}}
\newcommand\setcrlf[1]{\setoption{crlf}{#1}}
\newcommand\setaddress[1]{\setoption{address}{#1}}
\newcommand\sethint[1]{\setoption{hint}{#1}}
@@ -201,11 +216,20 @@
\newcommand\setheader[1]{\setoption{header}{#1}}
\newcommand\setqr[1]{\setoption{qr}{#1}}
\newcommand\sethttps[1]{\setoption{https}{#1}}
\newcommand\setvcardaddress[1]{\setoption{vcardaddress}{#1}}
\newcommand\setvcardcompat[1]{\setoption{vcardcompat}{#1}}
\newcommand\setvcardminimal[1]{\setoption{vcardminimal}{#1}}
% convenience toggles
\newcommand\noheader{\cardsetup{noheader}}
\newcommand\withheader{\cardsetup{header}}
\newcommand\noqr{\cardsetup{noqr}}
\newcommand\withqr{\cardsetup{qr}}
\newcommand\novcardaddress{\cardsetup{novcardaddress}}
\newcommand\withvcardaddress{\cardsetup{vcardaddress}}
\newcommand\novcardcompat{\cardsetup{novcardcompat}}
\newcommand\withvcardcompat{\cardsetup{vcardcompat}}
\newcommand\novcardminimal{\cardsetup{novcardminimal}}
\newcommand\withvcardminimal{\cardsetup{vcardminimal}}
\newcommand\standardlayout{\cardsetup{layout=standard}}
\newcommand\centeredlayout{\cardsetup{layout=centered}}
\def\BCQ@registeredfields{}
@@ -643,14 +667,14 @@
}
\newcommand\BCQ@headernameformat[1]{%
\ifdefstring{\BCQ@headeremphasis}{company}{\bfseries #1}{%
\ifdefstring{\BCQ@headeremphasis}{balanced}{{\bfseries #1}}{%
\ifdefstring{\BCQ@headeremphasis}{balanced}{{\large\bfseries #1}}{%
{\large\bfseries #1}%
}%
}%
}
\newcommand\BCQ@headercompanyformat[1]{%
\ifdefstring{\BCQ@headeremphasis}{company}{{\large #1}}{%
\ifdefstring{\BCQ@headeremphasis}{balanced}{#1}{#1}%
\ifdefstring{\BCQ@headeremphasis}{balanced}{{\large #1}}{#1}%
}%
}
\newcommand\BCQ@appendvcardposition{%
@@ -692,6 +716,63 @@
\BCQ@cachedname
\fi
}
\newcommand\BCQ@vcardversionline{%
\ifBCQ@vcardcompat
3.0%
\else
\BCQ@vcardversion%
\fi
}
\def\BCQ@typeprivate{private}
\newcommand\BCQ@vcardtypemapped{%
\ifcsdef{Xtype}{%
\ifBCQ@vcardcompat
\ifx\Xtype\BCQ@typeprivate
home%
\else
\Xtype
\fi
\else
\Xtype
\fi
}{}%
}
\newcommand\BCQ@vcardtypeparam{%
\ifBCQ@vcardminimal
\else
\ifcsdef{Xtype}{;TYPE=\BCQ@vcardtypemapped}{}%
\fi
}
\newcommand\BCQ@vcardteltype{%
\ifcsdef{Xtype}{\BCQ@vcardtypemapped,voice}{voice}%
}
\newcommand\BCQ@vcardtel{%
\ifBCQ@vcardcompat
\ifBCQ@vcardminimal
TEL:\Xphone\BCQ@nl
\else
TEL;TYPE=\BCQ@vcardteltype:\Xphone\BCQ@nl
\fi
\else
TEL;VALUE=uri;TYPE=\BCQ@vcardteltype,text:tel:\Xphone\BCQ@nl
\fi
}
\newcommand\BCQ@vcardaddressfull{%
\ifcsdef{Xpobox}{\Xpobox\ }{}%
\ifcsdef{Xextaddr}{\Xextaddr\ }{}%
\ifcsdef{Xstreet}{\Xstreet\ }{}%
\ifcsdef{Xzip}{\Xzip\ }{}%
\ifcsdef{Xcity}{\Xcity\ }{}%
\ifcsdef{Xregion}{\Xregion\ }{}%
\ifcsdef{Xcountry}{\Xcountry}{}%
}
\newcommand\BCQ@vcardaddressnote{%
\ifcsdef{Xstreet}{\Xstreet\ }{}%
\ifcsdef{Xzip}{\Xzip\ }{}%
\ifcsdef{Xcity}{\Xcity\ }{}%
\ifcsdef{Xregion}{\Xregion\ }{}%
\ifcsdef{Xcountry}{\Xcountry}{}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -706,15 +787,19 @@
\fi
% vcard assembly (version 4.0 retained). CRLF improves iOS import robustness.
\newcommand\vcard{BEGIN:VCARD\BCQ@nl
VERSION:4.0\BCQ@nl
VERSION:\BCQ@vcardversionline\BCQ@nl
\ifhaspersonalnamevcard{N:\cond{Xfamilynames};\cond{Xgivennames};\cond{Xadditionalnames};\cond{Xhonoricprefix};\cond{Xhonoricsuffix}\BCQ@nl}{}
\ifhasfullnamevcard{FN:\name\BCQ@nl}{}
\ifexists{Xcompany}{ORG:\Xcompany\BCQ@nl}
\ifexists{Xtitle}{TITLE:\Xtitle\BCQ@nl}
\ifexists{Xrole}{ROLE:\Xrole\BCQ@nl}
\ifexists{printaddress}{\ifhasaddressvcard{ADR\ifexists{Xtype}{;TYPE=\Xtype}:\cond{Xpobox};\cond{Xextaddr};\cond{Xstreet};\cond{Xcity};\cond{Xregion};\cond{Xzip};\cond{Xcountry}\BCQ@nl}{}}
\ifexists{Xphone}{TEL;VALUE=uri;TYPE=\ifexists{Xtype}{\Xtype,}voice,text:tel:\Xphone\BCQ@nl}
\ifexists{Xemail}{EMAIL\ifexists{Xtype}{;TYPE=\Xtype}:\Xemail\BCQ@nl}
\ifBCQ@vcardaddress
\ifexists{printaddress}{\ifhasaddressvcard{ADR:;;\BCQ@vcardaddressfull;;;;\BCQ@nl}{}}
\else
\ifexists{printaddress}{\ifhasaddressvcard{NOTE:Address\space \BCQ@vcardaddressnote\BCQ@nl}{}}
\fi
\ifexists{Xphone}{\BCQ@vcardtel}
\ifexists{Xemail}{EMAIL\BCQ@vcardtypeparam:\Xemail\BCQ@nl}
\ifexists{Xjabber}{IMPP;TYPE=XMPP:\Xjabber\BCQ@nl}
\ifexists{Xmatrixorg}{IMPP;TYPE=MATRIX:\Xmatrixorg\BCQ@nl}
\ifexists{Xcloud}{URL:https://nextcloud.com/federation/\#\Xcloud\BCQ@nl}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.