pgfplots: Cómo obtener la altura correcta de una etiqueta, si el tamaño de fuente ha cambiado

pgfplots: Cómo obtener la altura correcta de una etiqueta, si el tamaño de fuente ha cambiado

Me puse font=\Hugepara un ylabel.
Con \pgfkeysvalueof{/pgfplots/ylabel}consigo el texto de la etiqueta.
Pero, ¿cómo obtener el valor correcto al medir la altura
\pgfmathsetlengthmacro\yLabelHeight{height("\pgfkeysvalueof{/pgfplots/ylabel}")}?
¿Hay alguna manera de leer eso con pgfkeys?

ingrese la descripción de la imagen aquí

\documentclass[a4paper]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}

\begin{document}
\section{Graph}
\begin{tikzpicture}[]
\begin{axis}[
ylabel={yLabel Huge},
y label style={draw, font=\Huge,   },
xmin=0,
%clip=false
]
\addplot[]{x};
\pgfmathsetlengthmacro\yLabelHeight{height("\pgfkeysvalueof{/pgfplots/ylabel}")}
\node[anchor=south west, fill=yellow, font=\small] at (0,0) {
\pgfkeysvalueof{/pgfplots/ylabel} has a height \yLabelHeight (wrong!)};
\end{axis}
\end{tikzpicture}
\subsection{Normalsize}
\pgfmathsetlengthmacro\yLabelHeight{height("yLabel Huge")} 
"yLabel Huge" has a height \yLabelHeight
\subsection{Huge}
\pgfmathsetlengthmacro\yLabelHeight{height("\Huge yLabel Huge")} 
{\Huge "yLabel Huge"} has a height \yLabelHeight
\end{document}

Respuesta1

Puede guardar el estilo de fuente del nodo ( \tikz@node@textfonty \tikz@textfont).

ingrese la descripción de la imagen aquí

\documentclass[tikz, border=1cm]{standalone}
\makeatletter
\tikzset{
  savefont/.style={
    execute at begin node={%
      \begingroup%
      \toks\z@=\expandafter{\tikz@node@textfont}%
      \toks\@ne=\expandafter{\tikz@textfont}%
      \xdef#1{\the\toks\z@\the\toks\@ne}%
      \endgroup%
    }
  }
}
\makeatother

\begin{document}
\begin{tikzpicture}
\node[font=\Huge, savefont=\myfont] {abd};
\node[font=\myfont] at (0, 2) {abd};
\end{tikzpicture}
\end{document}

información relacionada