Skip to content

Instantly share code, notes, and snippets.

View samhenrigold's full-sized avatar
📱
out with rach, cell’s hot if u r

samhenrigold

📱
out with rach, cell’s hot if u r
View GitHub Profile

Wrapping Algorithm for Multiline Canvas Text (+types and max line count support!)

A simple text wrapping algorithm for multiline canvas text. Does not support hyphenation but will break words that don’t fit on a line by themselves.

If the next word will exceed maxLines, the text will be truncated with an ellipsis. maxLines is uncapped by default.