Skip to content

v0.3.0 — Automatic text wrapping, overflow protection, and a full CLI manual

Latest

Choose a tag to compare

@sogeisetsu sogeisetsu released this 03 Nov 13:02
· 2 commits to main since this release

What's new

Text now adapts itself instead of being silently clipped, mixed CJK/Latin lines no longer collapse into a row of boxes, and the project finally has a reference manual.

Automatic line wrapping

Subtitle, footnote (-d) and eyebrow (-e) lines wrap to the text area when they are too wide, so long copy no longer runs off the canvas and gets cut.

  • CJK characters and full-width punctuation break per character, so Chinese wraps without spaces.
  • Latin text breaks on spaces; a single word wider than the text area (long URL, hash) is hard-split by character as a last resort.
  • Wrapping happens inside each line you pass: -s repeated still means separate paragraphs.
  • On by default. --no-wrap (CLI) or "layout": {"wrap": false} (JSONC) restores the old single-line behaviour.

Overflow protection

When the wrapped block is still taller than the available height, the subtitle and footnote font sizes step down proportionally, re-wrapping as they go, with a floor of 9px. Only if it still does not fit does pixellogo print a warning and continue:

pixellogo: warning: content is 810px tall but only 656px is available; font size is already at 9px, the rest will be clipped

The exit code stays 0, so batch runs are not interrupted. Measured ceilings on a clean canvas (title 3–4 characters, subtitle only):

Canvas Lines that still fit
poster ~30
square ~20
card ~16
slide ~13
banner ~8

--badge is a solid box, so it is not wrapped; it shrinks its font size instead when it would exceed the content width.

Missing glyphs no longer take the whole line down

The bundled ArkPixel-zh-hans.ttf covers 18,648 of the 20,902 basic CJK ideographs (89.2%), and a few common characters are genuinely absent (「即」U+5373, 「然」U+7136, 「餐」U+9910). The old font picker gave up on the entire line when no single font covered it and fell back to the Latin font, which turned every CJK character on that line into a tofu box.

Now the line keeps the font that covers the most characters, and the characters that no font can draw are named on stderr:

pixellogo: warning: font ArkPixel-zh-hans.ttf has no glyph for 即; those characters will render as boxes

Both the warning and the font choice are also reported by --dry-run, so you can check before rendering. Pass --font-title / --font-sub / --font-body with any pixel TTF to cover a missing glyph.

Documentation

  • docs/architecture.md — annotated three-level file tree, layer-by-layer module responsibilities, render data flow, and the constraints the architecture imposes (in Chinese).
  • docs/cli-guide.md — a full command-line manual: guided quick start, every flag, JSONC configs and batch mode, scripting and exit codes, plus a dedicated chapter on limits (characters per line, line ceilings, glyph coverage) and a troubleshooting table (in Chinese).

Both are linked from the table of contents and the new "Documentation" section of the English and Chinese READMEs.

Packaging fix

v0.2.0 wheels accidentally shipped a retired font (ArkPixel12pxProportional.ttf), because setuptools packaged from a stale build/lib snapshot. Release builds now start from a clean build/, so the wheel contains exactly the four fonts listed in the docs.

Upgrade notes

  • Output changes only where text used to be clipped. All 40 gallery samples produce byte-identical geometry; no images were regenerated.
  • Wrapping is on by default: if you depend on a single overflowing line, add --no-wrap.
  • layout.wrap is a new config key; the JSON Schema has been updated to match.
  • "uppercase": "false" (a string) is now correctly treated as off instead of on.

Install

pipx install git+https://github.com/sogeisetsu/pixel-logo-toolkit.git
# or
pip install git+https://github.com/sogeisetsu/pixel-logo-toolkit.git

Or grab an asset below: pip install pixellogo-0.3.0-py3-none-any.whl, or unpack the portable zip and run pixellogo.cmd / ./pixellogo.sh with no install at all. Python 3.9+, Pillow for rendering.

Tests

160 unit tests pass on Python 3.12 locally, and CI covers 3.9 / 3.10 / 3.11 / 3.12.

Full changelog: v0.2.0...v0.3.0