Skip to main content

katsuji

活字, movable type. Variable-width font tooling for a816 SNES projects.

Build a project's fonts and strings

katsuji.toml at the project root:

[fonts.dialog]
png = "fonts/vwf.png"
cell = [8, 16]
table = "text/ff4fr.tbl"
output = "assets/font.dat"
widths = { "0xFF" = 3, "0xA0" = -1 }     # negative trims, positive sets
kerning-candidates = ["Ta", "Te", "va"]  # tested for collision kerning
kerning = { "tt" = 2 }                   # hand-tuned: pixels tighter

[fonts.menu]
png = "fonts/8x8vwf.png"
cell = [8, 8]
table = "text/ff4_menus.tbl"
output = "assets/menu_font.dat"
constants = "assets/menu_font.i"         # a816 constants describing the file

[strings.items]
font = "menu"
file = "text/items.txt"                  # one string per line (or `texts = [...]`)
bpp = 2
ink = 3
paper = 1
blob = "assets/items_vwf.dat"            # tiles, no string across a bank edge
index = "assets/items_vwf.idx"           # 4 bytes per string: offset lo16, bank, tiles

A font the game reads in its own layout instead of katsuji's VWF file takes a format:

[fonts.menu]
format = "tiles"                         # SNES planar tiles of the PNG's colour indices
png = "fonts/menu.png"                   # palettized: index N is colour N
cell = [8, 8]
bpp = 2
output = "build/menu_font.dat"

[fonts.dialog]
format = "rows16"                        # 1bpp rows, 16 pixels wide, little-endian words (FF6)
png = "fonts/dialog.png"
cell = [12, 11]
first = "0x20"                           # codes written: first .. first + count - 1
count = 224
x-offset = 4                             # glyph drawn 4 pixels into the row
spacing = 1                              # width = ink + spacing, then `widths` overrides
size = 0x1400                            # padded to this many bytes
output = "build/dialog_font.dat"
widths-output = "build/dialog_widths.dat"  # one width byte per code
katsuji remap fonts/menu.png --table old.tbl --to new.tbl --cell 8x8 -o fonts/menu_new.png

moves a font's glyphs to the codes another table gives the same texts, keeping a palettized PNG's colours.

katsuji build            # writes every output, paths relative to katsuji.toml
katsuji banner "Tarot" --table text/ff4fr.tbl --font assets/font.dat

Library

  • Atlas: a font drawn as a PNG grid of cells.
  • find_kerning / pair_kerning: pair kerning by collision (one diagonal touch, never side by side).
  • VwfFont: the font file the a816 VWF runtime reads (1bpp rows + width per glyph, kerning pairs, height).
  • render / measure: text set at build time exactly as the runtime sets it.
  • Wrapper: word wrap by pixel width, the game's control codes as data.
  • Window / WindowBuilder: fill text windows; a game's script rules drive them.
  • encode_tiles / colourize: SNES 2bpp / 4bpp planar tiles.
  • text_tiles / pack_runs: static strings pre-rendered to a bank-safe blob.

Grown from ff4's tooling: its five fonts rebuild byte for byte, its wrapping and dialog goldens pass.

uv sync
make check

Metadata

Release files for katsuji 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for katsuji 0.3.0
File Size Uploaded Provenance Actions
katsuji-0.3.0.tar.gz 104.2 kB Without provenance Details for katsuji-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for katsuji 0.3.0
File Interpreter ABI Platform Actions
katsuji-0.3.0-py3-none-any.whl Python 3 none any Details for katsuji-0.3.0-py3-none-any.whl

Total release size: 137.2 kB

Release files / katsuji-0.3.0.tar.gz

Download URL katsuji-0.3.0.tar.gz
Size 104.2 kB
Tags Source
SHA-256 checksum
How to use checksums
81e56a96ffa1845f2301d204064c3785bb8600ef0f4b9006340b97b179ddda55
BLAKE2b-256 checksum
How to use checksums
37ac2a1546035b5a150bfd67dad38770ce6f8748b0f4375e37e163788ca87da2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.15.0"},"installer":{"name":"hatch","version":"1.18.1"},"openssl_version":"OpenSSL 3.5.9 29 Sep 2026","python":"3.15.0","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.14.0

Release files / katsuji-0.3.0-py3-none-any.whl

Download URL katsuji-0.3.0-py3-none-any.whl
Size 33.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b51a6e5f73ce4cf894c448e3506caaa4e4e61d714bf94c7f82f072b098f1e67
BLAKE2b-256 checksum
How to use checksums
757640232e8442ca1d595fa14e2c0999748e138f3ee574ca4fcdbacd161a030e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.1 {"ci":true,"cpu":"x86_64","distro":{"id":"noble","libc":{"lib":"glibc","version":"2.39"},"name":"Ubuntu","version":"24.04"},"implementation":{"name":"CPython","version":"3.15.0"},"installer":{"name":"hatch","version":"1.18.1"},"openssl_version":"OpenSSL 3.5.9 29 Sep 2026","python":"3.15.0","system":{"name":"Linux","release":"6.17.0-1022-azure"}} HTTPX2/2.14.0

Security for katsuji 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page