Skip to main content

YAFF bitmap font support for Pillow, without modifying Pillow

Project description

pillow-yaff

YAFF bitmap font support for Pillow, as a standalone package that requires no changes to Pillow itself.

YAFF is a human-readable bitmap font format supporting proportional glyph widths and per-glyph kerning.

pillow-yaff provides a font object that implements the same duck-typed interface Pillow's own font classes do (getbbox, getlength, getmask, getmask2), so it can be passed directly as the font= argument to PIL.ImageDraw or PIL.ImageText on an unmodified, pip-installed Pillow.

Usage

import pillow_yaff
from PIL import Image, ImageDraw

font = pillow_yaff.load("my_font.yaff")

im = Image.new("RGB", (100, 30), "white")
draw = ImageDraw.Draw(im)
draw.text((5, 5), "Hello", fill="black", font=font)
im.save("out.png")

pillow_yaff.load() accepts a path (str, bytes, or os.PathLike) or an open binary file object.

Requirements

  • Pillow >= 12.0.0 (needs PIL.ImageText)
  • Python >= 3.10

Development

pip install -e .[test]
pytest

CI (.github/workflows/test.yml) runs the test suite on Python 3.10-3.14 across Linux/macOS/Windows on every push and pull request, and builds the sdist/wheel to catch packaging errors early.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pillow_yaff-0.1.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pillow_yaff-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file pillow_yaff-0.1.0.tar.gz.

File metadata

  • Download URL: pillow_yaff-0.1.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pillow_yaff-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e16732f81d4780542645e64fc1dcb154923cf028c1c1a0c6ffd13ba6016ff0b0
MD5 2dbf6e6ca4d54ac32e1a0149f8d773c2
BLAKE2b-256 3ebc80ef5e462d4d8627a37676da85534b765e600423b26ac5561ac856468234

See more details on using hashes here.

Provenance

The following attestation bundles were made for pillow_yaff-0.1.0.tar.gz:

Publisher: publish.yml on endreszabo/pillow-yaff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pillow_yaff-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pillow_yaff-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pillow_yaff-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71f6537aac7c2e1af3785726bc7d87dbbf651fe263157bd63ec16cf0692aa262
MD5 33de5f7cb45429cf2f48d932327f20a1
BLAKE2b-256 34b2582ca379210444b95006f32463346d104b6ee1919595df685732a006d47f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pillow_yaff-0.1.0-py3-none-any.whl:

Publisher: publish.yml on endreszabo/pillow-yaff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page