Skip to content

New Truncation Behaviors

Choose a tag to compare

@JosephCatrambone JosephCatrambone released this 12 May 04:46
· 19 commits to main since this release

Experimentation has shown the need for more granular behavior when text is too long to fit on an image. Before this release, a user could only choose between having an exception raised and returning an empty string. This release adds two new behaviors, long_text_behavior="truncate_then_shrink" and long_text_behavior="shrink_then_truncate", in addition to the existing long_text_behavior="exception" and long_text_behavior="empty". Like the name suggests, truncate_then_shrink will attempt to reduce the length of a string by dropping characters until it fits in an image. This can be useful if you're using the default font-size-choice-behavior (random). The other option, shrink_then_truncate, has proven to be slower for sentences that don't have line-breaks.

Additionally, the new default behavior of text overflow is exception, since silent failures were causing difficult-to-debug downstream errors.