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.6.tar.gz (20.3 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.6-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyparagraph-0.0.6.tar.gz
  • Upload date:
  • Size: 20.3 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.6.tar.gz
Algorithm Hash digest
SHA256 b0f038ba175d37fdc017f4d9bff14bb00dce0e517e8d27a2c85db2c8d86d22d0
MD5 986b9c7bd3c6b2052d38b54fa4619ba5
BLAKE2b-256 d0cec54f6e78864ac3947e6de6f78b3c1dd1f895300b0d5d84c3ca47f545191e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyparagraph-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 16.3 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b00a1a9615c5d36d46559792233d4b46fced56ba3924fade7bb8fa55bb3b163f
MD5 37d70849810bb0fed6b676891d6cada6
BLAKE2b-256 49392871435c5f1bb76dfac526309520f9c00e1ae46d7ba85f69ff70b5161323

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