Nodes/Vevor Mask Union/Generative · Generate Prompt + Glyphs
ComfyUI Node

Generative · Generate Prompt + Glyphs

The Row Format That Stops A Redraw From Turning Your Headline Into Soup

By rexqin·Created about a month ago·Updated 19 days ago· 0
Generative · Generate Prompt + Glyphs
  • blocks
  • generate_prompt
  • glyph_chars
◄font_dirfonts►

Here's the thing nobody warns you about with image-editing models: they are excellent at replacing text and terrible at replacing it in the same place, at the same size, in the same typeface. Ask Qwen-Image-Edit or Flux Klein to "translate the headline into German" and you get a beautiful image with the text in a slightly different spot, one size larger, and a font the model reached for out of habit - which is always the same neo-grotesque, whether or not your original was.

Generative · Generate Bundle is where the pack fights back. It takes your translated blocks and emits a prompt in a rigid row format that pins down position, colour, weight, line count, panel bounds and grouping - plus a second output, the glyph set, for the reference card route.

The row format is the whole point

One row per translatable block, and each one is a stack of bracketed tags followed by a source→replacement pair:

- [centered] [white] [bold] [lines:2] [box:0.31,0.08,0.38,0.09] [panel:0.28,0.06,0.44,0.14] [safe:left/right] [group:g1] "POWERFUL\n62CC ENGINE" -> "STARKE\n62CC MASCHINE"

Positions are percentages of image width and height, the [lines:N] tag is the maximum line count, and \n marks a printed break. Group tags only appear when two or more blocks share a group key - and they matter, because they tell the model that a set of matching labels must stay internally consistent. If one grows, they all grow the same way. Without it you get one panel resized and its twin left alone, which reads as broken design.

The next thing the node does is re-wrap your translation using the actual font metrics. It loads the TTF from font_dir, measures the width of each source line in em units, and re-flows the translation to that same width when the translation is long enough to be worth re-flowing. That's why the pack ships Inter Tight in nine weights: measuring with a real font file is the only way the wrap you describe to the model resembles the wrap on the reference image.

The two outputs

  • generate_prompt - STRING. The full image-editing instruction with your rows embedded, including the pack's long typography section: diagnose the reference's lowercase a and capital C, pick the same typeface, don't restyle, don't recolour, don't shrink to fit, keep panel edges flush to the frame. It's the most carefully written prompt text in the whole pack, and its worst-case warning is explicit - the layout comes out perfect while the face is silently swapped.

  • glyph_chars - STRING. The characters the replacement text needs. This is the other half of the strategy: rather than trusting a diffusion model to invent ü, ß, ç or ° correctly, you render them as a reference card and put that in front of the model. Generative · Glyph Reference Card consumes this string directly.

Inputs are just blocks (JSON, with translations applied) and font_dir (STRING, default fonts, resolved against the pack directory first).

Install

cd ComfyUI/custom_nodes
git clone https://github.com/rexqin/comfyui-vevor-mask-union
# restart ComfyUI

Manager → Vevor Mask Union. No pip installs - but font_dir is a real dependency of the output quality, see below.

Where people get burned

A missing font silently destroys the layout. If font_dir has no InterTight-*.ttf in it, the code falls back to PIL's default bitmap font and every width measurement becomes garbage. You won't get an error. You'll get rows with line counts and wraps that don't match the picture, and you'll spend the afternoon tuning the image model. Leave font_dir at fonts in a normal install and this never happens; it's when you point it at your own folder that it bites.

No groups means no consistency. If your analysis pass returned only one instance of a repeated label, there's nothing to group and each gets handled independently. The image model will size them differently, and it will look like a bug in this node.

Nothing translatable produces a placeholder row. The code emits a "(no translatable rows)" line rather than an empty prompt, so you get a complete-looking prompt that asks for no changes. If your output image is identical to the input, check whether every block came back with translation = None.

This node decides nothing about the image. It's a string builder. If the redraw still comes back with the wrong typeface, the fix is in the reference conditioning - that's what the glyph card is for - or in the model choice, not in another pass of prompt editing.

Categoryvevor/generative

Inputs (2)

NameTypeDefaultDescription
blocksJSON—
font_dirSTRINGfonts—

Outputs (2)

NameTypeDescription
generate_promptSTRING—
glyph_charsSTRING—