This paper extends our previous work on globally optimizing source shapes for lithography. A key extension is our global optimization against metrics that involve process window through focus. For example, the user can determine the particular source shape which maximizes the area of the ED window (common exposure-defocus window) across all patterns. In nominal terms, integrated process window is a highly nonlinear objective function; for example, ED window is defined in terms of fractional (i.e. percentage or relative) exposure latitude, and dose is proportional to the reciprocal of intensity, which means that when ED window is calculated the source variables appear in both numerator and denominator of a ratio of reciprocals. In addition, exposure and focus latitudes are defined in terms of the common window as bounded by all features, and the determination of which features are gating is a conditional and non-differentiable function of the source variables. Also, the focus integration should only extend to the plane where ED window first closes down to zero; this limit also depends on the variables in a nonlinear way. However, despite these complexities, it proves possible under quite benign approximations to reformulate ED window maximization as a near-linear-programming problem that can be solved globally, in polynomial time. The algorithm can be extended in several ways, e.g. to account for effects like mask linewidth errors (MEF). In some cases MEF-optimized sources can substantially reduce the sensitivity to mask error, and may differ appreciably from sources optimized for individual perturbed masks. Resist effects can be approximated by influence/diffusion kernels operating on the exposing image within the film. The area of an inscribed rectangular process band can be optimized in place of the full ED window. Source pixelation can be structured to account for finite illuminator resolution and constraints on minimum pole size. Multiple exposures can also be handled, and polarization can be selected optimally on a pixel-by-pixel basis.