Most current methods for the engineering of photonic crystal (PhC) cavities rely on cumbersome, computationally demanding trial-and-error procedures. In the present work, we take a different approach to the problem of cavity design, by seeking to establish a direct, semianalytic relationship between the target electromagnetic field distribution and the dielectric constant of the PhC structure supporting it. We find that such a relationship can be derived by expanding the modes of L-N-type cavities as a linear combination of the one-dimensional (1D) Bloch eigenmodes of a PhC W1 waveguide. Thanks to this expansion, we can also ascertain the presence of a well-defined 1D character in the modes of relatively short cavities (e.g., L9-15), thus confirming recent theoretical predictions and experimental findings. Finally, we test our method through the successful design of a cavity supporting a mode with Gaussian envelope function and ultralow radiative losses (quality factor of 17.5 x 10(6)).