[Tex/LaTex] Vertically centered horizontal rule filling the rest of a line

rulesvertical alignment

I'd like to have a horizontal line extending from the end of the text on a line to the right margin. So far I've found \hrulefill and \leaders\hrule\hfill, but these draw a line that's flush with the baseline of my text — how can I get it to be vertically centered?

Best Answer

\documentclass{article}
\usepackage{xhfill}
\begin{document}
Here is some text\xfill{1pt} \par
Here is some text\xfill{8pt} \par
Here is some text\xhrulefill{blue}{2pt}\par
Here is some text\xhrulefill{cyan}{1ex}\par
Here is some text\xrfill[0ex]{1ex}[red] \par
\end{document}​

enter image description here