public function adjustFontSize($text, Drawer $drawer, $width)
    {
        if (! ($this->resource instanceof ImageWritableInterface)) {
            throw new UnsupportedMethodException("This method is not supported by the ImageResource in use.");
        }

        $fontSize = 0;
        $metrics['width'] = 0;

        while ($metrics['width'] <= $width) {
            $drawer->setFontSize($fontSize);
            $metrics = $this->resource->getTextGeometry($text, $drawer);
            $fontSize++;
        }

        return $drawer;
    }