Text this: High-purity single-photon generation based on cavity QED