# dotfill for length of text

I am trying to make some small dotted lines for the signature of different persons, with their printed names just below. I thought it would look great if the width and horizontal placement of the dotted line matched the names of the persons. I have looked for a solution, and found one which here, and is included in my example.

However, this does not alter the spacing, so that it doesn't really match the length perfectly. Is there a good way to accomplish this?

\documentclass{letter}
\usepackage{lipsum}

\newlength\mylen
\newcommand\mdotfill[2][-0em]{%
\settowidth\mylen{$#2$}

\begin{document}
\begin{letter}{Company name \\ Street\\ City\\ Country}
\lipsum[1-2]
\vfill
\closing{Signed,}

\mdotfill{John Doe}\hfill\mdotfill{Jane Doe} \hfill \mdotfill{Joe W. Long Name} \hfill \mdotfill{Lisa Simpson}\\
John Doe\hfill Jane Doe\hfill Joe W. Long Name\hfill Lisa Simpson

\end{letter}
\end{document}


Here is a macro that prints the dots and the name underneath, based on the small package makebox:

\documentclass{letter}
\usepackage{lipsum}
\usepackage{makebox}

\begin{document}

\begin{letter}{Company name \\ Street\\ City\\ Country}