Measuring the temperatures of stars