In optical lithography for microchip manufacturing, it is important that the focal ranges of all patterns in the layout be closely aligned in order to maximize a common process window. In practice, large pattern-dependent variations in the position of the best focus are observed, which have been traced back to phase errors induced on the image-forming beams by scattering from mask topography. We show that this degradation mechanism can be exploited as a source of corrective phase shift, allowing pattern-dependent focus shifts to be controlled purely by changing the details of the mask layout, without requiring a significant change in the mask-making process. Phase distortions in the imaging beams are corrected by the optimized insertion of orthogonally oriented subresolution jogs into existing edges in the layout, thereby introducing a tailored scatter contribution whose quadrature component has the opposite sign from that of the primary edge.