Skip to main content
Skip table of contents

Text autosizing

In the standard flow, the text is rendered with the exact requested font size. Dimensions of the text personalization area are treated as guidelines, however, the rendered text may overrun the defined boundary:

  • Width-wise, if there are too many characters per line

  • Height-wise, if there are too many lines

The default behavior can be overridden using smin parameter value of fnt command, which will enable text autosizing mode. When enabled, the rendering server will automatically determine the correct font size to fit the text into the allowed text area.

The sizing algorithm:

  • The personalization area must be defined and must have non-zero dimensions.

  • The text font size starts with the size defined by the s parameter. This is both the initial and maximum font size.

  • The text font size is reduced so all text fits into the allowed area.

Please see Text rendering layouts about how text layout modes affect autosizing.

For example:

The text autosizing is disabled and the text is rendered using the exact setting:

https://fx.images.drivecommerce.com/api/v1/drive/image/?layer&src=BOX1000X500CF0F0F0FF&layer&fnt=f:NotoSans-Bold.ttf;s:300;a:c;va:c&txt=Hello\sWorld&sz=1000,500

image-20250103-211140.png

The text autosizing is enabled:

https://fx.images.drivecommerce.com/api/v1/drive/image/?layer&src=BOX1000X500CF0F0F0FF&layer&fnt=f:NotoSans-Bold.ttf;s:300;smin:1;a:c;va:c&txt=Hello\sWorld&sz=1000,500

image-20250103-211319.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.