The X-ray telescope on board the Swift satellite for gamma-ray burst astronomy has been exposed to the radiation of the space environment since launch in November 2004. Radiation causes damage to the detector, with the generation of dark current and charge trapping sites that result in the degradation of the spectral resolution and an increase of the instrumental background. The Swift team has a dedicated calibration program with the goal of recovering a significant proportion of the lost spectroscopic performance. Calibration observations of supernova remnants with strong emission lines are analysed to map the detector charge traps and to derive position-dependent corrections to the measured photon energies. We have achieved a substantial recovery in the XRT resolution by implementing these corrections in an updated version of the Swift XRT gain file and in corresponding improvements to the Swift XRT HEAsoft software. We provide illustrations of the impact of the enhanced energy resolution, and show that we have recovered most of the spectral resolution lost since launch.