compute stroke lengths