Nodes/ComfyUI S4Tool Text/๐Ÿ’€Text Basic
ComfyUI Node

๐Ÿ’€Text Basic

The ComfyUI text node that can finally typeset CJK vertically

By S4MUEL-404ยทCreated about a year agoยทUpdated about a year agoยท 4
๐Ÿ’€Text Basic
  • font
  • image
  • style
  • mask
โ—„textโ–บ
โ—„font_size32โ–บ
โ—„color#000000โ–บ
โ—„text_directionhorizontalโ–บ
โ—„alignleftโ–บ
โ—„char_spacing0โ–บ
โ—„line_spacing1.0โ–บ

ComfyUI doesn't draw text. Out of the box it can generate images until the GPU begs for mercy, but there's no built-in node that puts words on a canvas - the "Text" nodes you'll find are just string pass-throughs. If you've ever wanted subtitles, memes, posters, or watermarks on an image, you've been bodysurfing around WAS Node Suite's text overlay or exporting text from Photoshop. S4Tools Text Basic is the core node of the small S4Tool Text pack, and it exists to fix exactly that gap.

What makes it worth a look over the other options is what it does besides rendering: it typesets vertically (real CJK vertical, columns flowing left-to-right, not just rotated text), exposes fine spacing controls, and - the part that actually matters in a graph - it hands you a clean mask and the raw RGBA as a separate "style" output, so you can composite the result onto any background without clipping artifacts. For a Chinese/Japanese poster workflow that vertical mode alone is the reason to install this pack.

How it works

Text Basic takes a FONT_DATA blob (bytes of a .ttf/.otf, produced by one of the pack's three font loaders), loads it with PIL's ImageFont.truetype, and renders the text onto a grayscale mask at 2ร— resolution, then downsamples it back down with LANCZOS. That's the classic crisp-edge trick - you get anti-aliased glyphs without the blurry look of rendering at final size. The canvas is auto-sized to fit your text plus a small padding (max(8, font_size * 0.25)), and your color is applied to the RGB channels with the mask as alpha.

Inputs that matter

  • font - the only non-obvious one. It's required, and it must come from a font loader node (Text Font file, Text Font Base64, or Text Font URL). Leave it dangling and the node raises "Invalid FONT_DATA: expected bytes."
  • text - multiline, so newlines work.
  • font_size (1โ€“512, default 32) and color (hex, default #000000).
  • text_direction - horizontal or vertical. In vertical mode each line becomes a column.
  • char_spacing (-50โ€“200 px) and line_spacing (-10โ€“10, default 1.0). line_spacing is a multiple of font size: 1.0 means zero extra gap between lines, 2.0 adds one full font-size of space. In vertical mode it controls the gap between columns instead. That trips people up, so remember: default 1.0 is not "normal" if you were picturing pixels.
  • align - left/center/right.

Outputs

  • image - the RGBA IMAGE tensor. Wire this into a composite/save node.
  • style - STYLE_DATA: the same RGBA image, meant to feed the Text Style node. That's a custom type, so only nodes in this pack speak it.
  • mask - grayscale MASK tensor of the glyphs, for Inpaint-style or mask-based compositing.

Install

Easiest via ComfyUI Manager: search "ComfyUI S4Tool Text" and hit install. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/S4MUEL-404/ComfyUI-S4Tool-Text

Restart ComfyUI; the nodes appear under ๐Ÿ’€S4Tool. Dependencies are just pillow, numpy, requests - all already present in any working ComfyUI - and PyTorch comes from ComfyUI itself. Note there's no requirements.txt in the repo, so Manager has nothing extra to pip-install. That's fine here, because you don't need anything. opencv-python is optional and only affects the Style node, not this one. No model files, no downloads.

Gotchas

  • The canvas auto-sizes to the text. Change "hello" to "hello world" and the output dimensions change. Plan for it when you composite - resize the text canvas to your background, don't assume a fixed size.
  • The image output is RGBA. If your composite node expects RGB + a separate mask, use the mask output, or convert.
  • It's a young pack. v1.0.0, effectively no community footprint yet, so treat it as new: it works, but there's no battle-tested track record. Check the repo before pinning a workflow to it.
  • Negative line_spacing is legal and will overlap lines - occasionally useful, usually a mistake.

The workflow is simple: pick a font โ†’ connect to Basic โ†’ tweak โ†’ optionally run the result through Style โ†’ composite. For crisp, maskable, vertical-CJK-friendly text, this is now the node I reach for.

Category๐Ÿ’€S4Tool

Inputs (8)

NameTypeDefaultDescription
fontFONT_DATAโ€”
textSTRINGโ€”
font_sizeINT321โ€“512โ€”
colorSTRING#000000โ€”
text_directionCOMBOhorizontal2 options: horizontal, vertical
alignCOMBOleft3 options: left, center, right
char_spacingINT0-50โ€“200โ€”
line_spacingFLOAT1.0-10โ€“10โ€”

Outputs (3)

NameTypeDescription
imageIMAGEโ€”
styleSTYLE_DATAโ€”
maskMASKโ€”