To improve accuracy in detecting the position of a beam waist all over the scanning range.
The width of the aperture of a light beam diaphragm plate is enlarged (108), the numerical aperture of an optical system is increased. Thus, a depth of focus at focusing becomes smaller than that at exposing an image. In this state, a beam diameter R on a surface to be scanned is detected (110), it is decided whether or not the beam diameter R is within a reference range (112). In the case that the beam diameter R is not within the reference range, by moving a collimator lens in a direction parallel to an optical axis thereafter until the beam diameter R reaches within the reference range (114), the focal position of the light beam is adjusted. The focal position is adjusted in a state where the depth of focus is made smaller than that at exposing the image in such a way.