How do you tell whether text fits within its bounding shape?

enter image description here

As of January 2021, you can set auto fit setting in Google Slides editor.

When you click inside shape, you can see new Auto-fit setting, set to “Do not autofit” by default:
enter image description here

You can change it to “Shrink text on overflow“:

enter image description here

Or another option: “Resize shape to fit text“:

enter image description here

Update (July 2021): there new autofit properties of Shape element:

autofitType

The autofit type of the shape. If the autofit type is AUTOFIT_TYPE_UNSPECIFIED, the autofit type is inherited from a parent placeholder if it exists. The field is automatically set to NONE if a request is made that might affect text fitting within its bounding text box. In this case the fontScale is applied to the fontSize and the lineSpacingReduction is applied to the lineSpacing. Both properties are also reset to default values.

fontScale – readonly

The font scale applied to the shape. For shapes with autofitType NONE or SHAPE_AUTOFIT, this value is the default value of 1. For TEXT_AUTOFIT, this value multiplied by the fontSize gives the font size that is rendered in the editor.

lineSpacingReduction – readonly

The line spacing reduction applied to the shape. For shapes with autofitType NONE or SHAPE_AUTOFIT, this value is the default value of 0. For TEXT_AUTOFIT, this value subtracted from the lineSpacing gives the line spacing that is rendered in the editor.

P.S. autofitType may be not marked as readonly in documentation, but there seems to be a bug which currently prevents an easy way to set it (to any other value than NONE), see https://issuetracker.google.com/issues/189153562#comment5 and https://developers.google.com/apps-script/reference/slides/autofit (just getAutofitType() available)

Leave a Comment