Nodes/ComfyUI_Element_easy/Text Line Break
ComfyUI Node

Text Line Break

Wrap your prompt text into lines so you can stamp it on your image

By supElement·Created 9 months ago·Updated about 11 hours ago· 10
Text Line Break
    • formatted_text
    text
    max_chars_per_line50
    punctuation_squeezetrue
    hanging_punctuationtrue
    pad_odd_halfwidthtrue

    Text Line Break wraps a string of text into lines of a maximum length. That's the whole node, and it's easy to dismiss until you've tried to render a prompt onto the image itself - paste a paragraph of prompt text into a text-drawing node and it comes out as one giant run-on line running off the canvas. This node fixes that by inserting line breaks at sensible character counts, and it's smart about it in ways that matter if you work with Chinese, English, or anything in between.

    How it works

    You feed text (multiline input) and set max_chars_per_line (default 50). The node breaks the text into lines no longer than that, and outputs the result as formatted_text. Nothing else to configure, which is the point.

    The intelligence is in where it breaks. It handles Chinese, English, and mixed Chinese-English text, and it avoids leaving punctuation at the start or end of a line - the kind of detail that looks like nothing until you see a line that starts with a comma. For CJK text this matters more than you'd think: character-based wrapping that ignores punctuation rules produces visually broken results, and this node was clearly written by someone who actually runs Chinese-language workflows (the whole pack's README is in Chinese).

    Why you'd want it

    The intended use, straight from the README, is pairing a prompt with the image it generated: wrap the prompt text, then hand it to a text-drawing node - the author points to KJNode's Add Label node - to render the prompt onto or alongside the image. It's a "make your output look intentional" move: generate an image, stamp the prompt under it, and you have a shareable result that carries its own context. The same trick works for any text you want on an image - captions, watermarks, notes in a contact sheet.

    Installing it

    It's part of supElement/ComfyUI_Element_easy:

    cd ComfyUI/custom_nodes
    git clone https://github.com/supElement/ComfyUI_Element_easy.git
    

    Restart ComfyUI, or install via ComfyUI Manager by searching ComfyUI_Element_easy. No dependencies beyond the pack itself.

    Gotchas

    The one real caveat: max_chars_per_line counts characters, not display width. For monospaced Latin text the two are close, but for CJK (which is roughly double-width per character) a line of 50 Chinese characters is twice as wide as 50 Latin ones, and for emoji and dingbats it's even less predictable. If your rendered lines overflow the canvas, lower the max rather than fighting the text node. And remember the output is a plain string - if your label node expects a specific format (like a list of lines), you may need to split formatted_text yourself, since this node only does the wrapping, not the drawing.

    CategoryElement_easy/Text

    Inputs (5)

    NameTypeDefaultDescription
    textSTRING
    max_chars_per_lineINT501–10000
    punctuation_squeezeoptBOOLEANtrue
    hanging_punctuationoptBOOLEANtrue
    pad_odd_halfwidthoptBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    formatted_textSTRING