Skip to main content

A library to do Knuth-Plass (aka TeX/LaTeX) text-wrapping, rendering the result as lines of text or in a specified font/size on a PIL image. PIL rendering optionally supports limited rich text (bold and/or italic) via <b> and <i> tags.

Project description

PyParagraph

Knuth Plass line-breaking for Python, with PIL rendering

This package is an attempt to make it easy to render paragraphs to a PIL Image in Python, with excellent line-breaking via the Knuth-Plass algorithm. This algorithm is used by TeX and LaTeX, and is commonly called the TeX line-breaking algorithm or the LaTeX line-breaking algorithm). A simple greedy wrapping algorithm is available as a fallback. Console/text output is supported as well as PIL output.

Installation

pip install pyparagraph

Note that a relatively recent (as of December 2022) version of setuptools is required: pip install --upgrade setuptools if you get errors during the install, then try again.

Usage & References

See the gitlab home page for documentation.

License

This software is licensed under the MIT License. Copyright (c) 2022, G. Sumner Hayes.

See the LICENSE.txt for full details.

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

pyparagraph-0.0.4.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

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

pyparagraph-0.0.4-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file pyparagraph-0.0.4.tar.gz.

File metadata

  • Download URL: pyparagraph-0.0.4.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pyparagraph-0.0.4.tar.gz
Algorithm Hash digest
SHA256 defd1bf520150941a264cfd4a5522fbb36188658ffe88ed6ea455efea7c54985
MD5 aa8862f37ff04c5838106c243649ad4c
BLAKE2b-256 d2aac190243bf6d238306f5bc9e3690326b526aa1efa53634d10089704023c86

See more details on using hashes here.

File details

Details for the file pyparagraph-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pyparagraph-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for pyparagraph-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7d33de71569a2f5d124b78f5ddeecbeff073b91e8b0531203dd8cd26cd12fc43
MD5 5b1a22093902255e64694b899b42a4ec
BLAKE2b-256 e808657ae0c54cdb0f883435956cdb892f4cb4c5e3332bcf77479c1f17b66a90

See more details on using hashes here.

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