# vharfbuzz - A user-friendlier way to use Harfbuzz in Python
[uharfbuzz](https://github.com/harfbuzz/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:
```python
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:
```python
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](https://vharfbuzz.readthedocs.io/en/latest/) 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 .
Raw data
{
"_id": null,
"home_page": "https://github.com/simoncozens/vharfbuzz",
"name": "vharfbuzz",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Simon Cozens",
"author_email": "simon@simon-cozens.org",
"download_url": "https://files.pythonhosted.org/packages/d3/aa/ffb3f43724ad29c393544b9200af8a6bb8387df1652c2370b17fe0317c4f/vharfbuzz-0.3.0.tar.gz",
"platform": null,
"description": "# vharfbuzz - A user-friendlier way to use Harfbuzz in Python\n\n[uharfbuzz](https://github.com/harfbuzz/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:\n\n```python\nwith open(sys.argv[1], 'rb') as fontfile:\n fontdata = fontfile.read()\n\ntext = sys.argv[2]\n\nface = hb.Face(fontdata)\nfont = hb.Font(face)\n\nbuf = hb.Buffer()\nbuf.add_str(text)\nbuf.guess_segment_properties()\n\nfeatures = {\"kern\": True, \"liga\": True}\nhb.shape(font, buf, features)\n```\n\nwith `vharfbuzz` you can just say:\n\n```python\nvhb = Vharfbuzz(sys.argv[1])\nbuf = vhb.shape(sys.argv[2], {\"features\": {\"kern\": True, \"liga\": True}})\n```\n\nThe `Vharfbuzz` class also contains a number of other helpful methods to perform common operations on Harfbuzz buffers. See [Read The Docs](https://vharfbuzz.readthedocs.io/en/latest/) for more information.\n\n## Installation\n\nvharfbuzz is available from `pypi`, so can be installed like so:\n\n pip3 install vharfbuzz\n\nIf building from source, you can install it like so:\n\n pip3 install -r requirements.txt\n pip3 install .\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A user-friendlier way to use Harfbuzz in Python",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://github.com/simoncozens/vharfbuzz"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "adbb3b318bc920c189c6aef6f9b42a080c056ce5ca0a56a488ba52bc09de6449",
"md5": "9cfc36a71f5588ee33acbd17b070c7f9",
"sha256": "aa2f406406b0cef15fb3cbd5548d9eb779a05916989088f92fa2d724984086a0"
},
"downloads": -1,
"filename": "vharfbuzz-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9cfc36a71f5588ee33acbd17b070c7f9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6253,
"upload_time": "2024-02-06T12:40:44",
"upload_time_iso_8601": "2024-02-06T12:40:44.073217Z",
"url": "https://files.pythonhosted.org/packages/ad/bb/3b318bc920c189c6aef6f9b42a080c056ce5ca0a56a488ba52bc09de6449/vharfbuzz-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d3aaffb3f43724ad29c393544b9200af8a6bb8387df1652c2370b17fe0317c4f",
"md5": "9b4a40f3c48bc5c5e5ee9f39739d34fd",
"sha256": "6c12a656f2ee73f0ad405f934ab8bc9e08259e3e100a1efb155f891cfcec1402"
},
"downloads": -1,
"filename": "vharfbuzz-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "9b4a40f3c48bc5c5e5ee9f39739d34fd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11544,
"upload_time": "2024-02-06T12:40:45",
"upload_time_iso_8601": "2024-02-06T12:40:45.230507Z",
"url": "https://files.pythonhosted.org/packages/d3/aa/ffb3f43724ad29c393544b9200af8a6bb8387df1652c2370b17fe0317c4f/vharfbuzz-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-06 12:40:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "simoncozens",
"github_project": "vharfbuzz",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "uharfbuzz",
"specs": [
[
">=",
"0.34.0"
]
]
}
],
"lcname": "vharfbuzz"
}