Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
\documentclass{article}
\newlength{\mylen}
\AtBeginDocument{\setlength{\mylen}{\fontcharht\font`T\fontcharht\font`X}} %% height of TX
\begin{document}
T\ruleX\rule{5cm}{\mylen}
\end{document}
Thanks to egreg and Barbara.
\documentclass{article}
\newlength{\mylen}
\setlength{\mylen}{\fontcharht\font`T} %% height of T
\begin{document}
T\rule{5cm}{\mylen}
\end{document}
\documentclass{article}
\newlength{\mylen}
\AtBeginDocument{\setlength{\mylen}{\fontcharht\font`X}} %% height of X
\begin{document}
X\rule{5cm}{\mylen}
\end{document}