I was asked about the moving window but my plan for it would be to place the visible word in the calculated location – the problem with your method (which is programmatically far easier) is kerning. As the window moves the dashes to the right will move as well. However, it might still be a better option.