We extend our previous work [Yang et al., Opt. Express29, 3621 (2021)10.1364/OE.415649] and propose an iterative algorithm to design a freeform surface for far-field light shaping. The algorithm alternately performs a wavefront phase design step and a freeform surface construction step. The smooth wavefront phase is designed by the mapping-type Fourier pair synthesis method, and the freeform surface is constructed by using the obtained wavefront phase. The algorithm provides a solid approach that ensures the introduction of the required wavefront phase manipulation for light shaping. Moreover, the related physical effects such as the Fresnel effect and polarization effect are included in the algorithm. We demonstrate the flexibility of the algorithm by examples.