What are the 3 parameters of setAutoFit

32 Views Asked by At

I'm using PhpOffice\PhpPresentation to create a PowerPoint with PHP... so far so good. I'have created a shape and a textRun. The length of the text may vary and I try to understand how setAutoFit works. Using RichText::AUTOFIT_NORMAL as 1st parameter I can see the text shrinking but I don't see any difference when the 1st parameter is RichText::AUTOFIT_SHAPE. In both cases I don't understand what effect the 2 last parameters (fontScale and lnSpcReduction) have or supose to have.

here is the code I've tried

        $shape = $currentSlide->createRichTextShape()
            ->setHeight(20)
            ->setWidth(1500)
            ->setOffsetX(120)
            ->setOffsetY(50);

        /* text */
        $text = $shape->createTextRun('text whose length can vary');
        $text->getFont()
            ->setSize(32)
            ->setColor($color);

        $shape->setAutoFit(RichText::AUTOFIT_NORMAL, 40, 20);
  // or $shape->setAutoFit(RichText::AUTOFIT_SHAPE, 40, 20);

0

There are 0 best solutions below