vharfbuzz - A user-friendlier way to use Harfbuzz in Python
uharfbuzz is an awesome tool for shaping text in Python. But it wraps the Harfbuzz C interface quite closely, so still requires you to perform a bunch of boilerplate operations before you can get on with the shaping. This module allows you a slightly more high-level interface to the text shaping process. For example, rather than:
with open(sys.argv[1], 'rb') as fontfile:
fontdata = fontfile.read()
text = sys.argv[2]
face = hb.Face(fontdata)
font = hb.Font(face)
buf = hb.Buffer()
buf.add_str(text)
buf.guess_segment_properties()
features = {"kern": True, "liga": True}
hb.shape(font, buf, features)
with vharfbuzz you can just say:
vhb = Vharfbuzz(sys.argv[1])
buf = vhb.shape(sys.argv[2], {"features": {"kern": True, "liga": True}})
The Vharfbuzz class also contains a number of other helpful methods to perform common operations on Harfbuzz buffers. See Read The Docs for more information.
Installation
vharfbuzz is available from pypi, so can be installed like so:
pip3 install vharfbuzz
If building from source, you can install it like so:
pip3 install -r requirements.txt
pip3 install .
Metadata
Release files for vharfbuzz 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vharfbuzz-0.3.1.tar.gz | 12.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| vharfbuzz-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.7 kB
Release files / vharfbuzz-0.3.1.tar.gz
| Download URL | vharfbuzz-0.3.1.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc5570f0dc61edc449364fd2ec3dee88819284132267f25eb92757e2137de247
|
|
BLAKE2b-256 checksum How to use checksums |
b256bc4b0ba473618e5824f7d21a8151e0bc267bb33df33474b2eb1e3beda943
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.5
|
Release files / vharfbuzz-0.3.1-py3-none-any.whl
| Download URL | vharfbuzz-0.3.1-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
410bdc2d4bc6da5d022eb3c50f77f772222ef1fbcbe0c5da8b91280b3030ae6b
|
|
BLAKE2b-256 checksum How to use checksums |
9ce8210a1e06825bd743b963d85d705a09913a458516aa2a626bda1e7125925e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.5
|