A Rudin–de Leeuw type theorem for functions with spectral gaps