Du kannst dem \node Texthöhe und -tiefe mitgeben
Code:
\documentclass{article}
\usepackage{tikz}
\usepackage{fontspec}
\usetikzlibrary{math}
\usepackage{geometry}
\setlength\parindent{0pt}
\geometry{a4paper, top=10mm, left=12.5mm, right=5mm, bottom=5mm}
\newcommand\zwc[1][]{
\pgfkeys{
/zwc/zw/.initial=0,
/zwc/fs/.initial=0.5,
/zwc/lb/.initial=5
}%\
\pgfkeys{/zwc/.cd,#1}
\pgfkeysgetvalue{/zwc/zw}{\zw}
\pgfkeysgetvalue{/zwc/fs}{\fs}
\pgfkeysgetvalue{/zwc/lb}{\lb}
\tikzmath{
\lbc=\lb/2;
\fsc=\fs/3;
\fsh=\fs/6;
\linbot = -\fsh-\fsc;
\lintop = \fsh+\fsc;
}
\node[align=left,text width =\lb cm, text height=2ex, text depth=0.3ex] {\fontsize{\fs cm}{0}\selectfont \zw};
\draw(-\lbc,\linbot)--(\lbc,\linbot)--(\lbc,\lintop)--(-\lbc,\lintop)--cycle;
\draw(-\lbc,-\fsh)--(\lbc,-\fsh);
\draw(-\lbc,\fsh)--(\lbc,\fsh);
\lb
}%\
\begin{document}
\begin{tikzpicture}
\zwc[zw = Zwölf]
\end{tikzpicture} Hier ist der Text zu tief
\vspace{1cm}
\begin{tikzpicture}
\zwc[zw = Neunzig]
\end{tikzpicture} Hier ist der Text richtig
\vspace{1cm}
\begin{tikzpicture}
\zwc[zw = eng]
\end{tikzpicture} Hier ist der Text zu hoch
\end{document}
siehe dazu auch Ilkas Beispiel im pgf/tikz-Manual (Stichwort "dance around")
VG
Lesezeichen