Streamlined Cython bindings for the harfbuzz shaping engine
Project description
[![Travis Build status](https://travis-ci.org/trufont/uharfbuzz.svg)](https://travis-ci.org/trufont/uharfbuzz)
[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/ujynqhnvd7qbh1vh/branch/master?svg=true)](https://ci.appveyor.com/project/trufont/uharfbuzz/branch/master)
## uharfbuzz
Streamlined Cython bindings for the [HarfBuzz][hb] shaping engine.
### Example
```python
import uharfbuzz as hb
import sys
with open(sys.argv[1], 'rb') as fontfile:
fontdata = fontfile.read()
text = sys.argv[2]
face = hb.Face.create(fontdata)
font = hb.Font.create(face)
upem = face.upem
font.scale = (upem, upem)
hb.ot_font_set_funcs(font)
buf = hb.Buffer.create()
buf.add_str(text)
buf.guess_segment_properties()
features = {"kern": True, "liga": True}
hb.shape(font, buf, features)
infos = buf.glyph_infos
positions = buf.glyph_positions
for info, pos in zip(infos, positions):
gid = info.codepoint
cluster = info.cluster
x_advance = pos.x_advance
x_offset = pos.x_offset
y_offset = pos.y_offset
print(f"gid{gid}={cluster}@{x_advance},{x_offset}+{y_offset}")
```
[hb]: https://github.com/harfbuzz/harfbuzz
[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/ujynqhnvd7qbh1vh/branch/master?svg=true)](https://ci.appveyor.com/project/trufont/uharfbuzz/branch/master)
## uharfbuzz
Streamlined Cython bindings for the [HarfBuzz][hb] shaping engine.
### Example
```python
import uharfbuzz as hb
import sys
with open(sys.argv[1], 'rb') as fontfile:
fontdata = fontfile.read()
text = sys.argv[2]
face = hb.Face.create(fontdata)
font = hb.Font.create(face)
upem = face.upem
font.scale = (upem, upem)
hb.ot_font_set_funcs(font)
buf = hb.Buffer.create()
buf.add_str(text)
buf.guess_segment_properties()
features = {"kern": True, "liga": True}
hb.shape(font, buf, features)
infos = buf.glyph_infos
positions = buf.glyph_positions
for info, pos in zip(infos, positions):
gid = info.codepoint
cluster = info.cluster
x_advance = pos.x_advance
x_offset = pos.x_offset
y_offset = pos.y_offset
print(f"gid{gid}={cluster}@{x_advance},{x_offset}+{y_offset}")
```
[hb]: https://github.com/harfbuzz/harfbuzz
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
uharfbuzz-0.1.2.zip
(17.5 kB
view hashes)
Built Distributions
uharfbuzz-0.1.2-cp36-cp36m-win32.whl
(185.6 kB
view hashes)
Close
Hashes for uharfbuzz-0.1.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f23b04d7b5634eb4904a5aee1035a43a649494dfddb322a9a5fc48786ef9ed3 |
|
MD5 | fced290263d75c66df0b18344c72f1b7 |
|
BLAKE2b-256 | ed78e454f35038971e97b533977e7ca636147d3ac7ef48659113cbf13184123f |
Close
Hashes for uharfbuzz-0.1.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffcb63d1d4f5d4a1a699e478350886f5be79277c54352e663310b04b4e8632d9 |
|
MD5 | a5b10d8f707b74af966952c4a76e90dc |
|
BLAKE2b-256 | 9d2ec241442e743443fffa842165d49c55c066fc3d238d89b2cf91e88c9c1ff4 |
Close
Hashes for uharfbuzz-0.1.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1503812198553b8c708e9f29b85c70c51666fc6415bb40a4a38b6d8e0a6c8b3 |
|
MD5 | ec8dd5414c356f597766db70b212f9ff |
|
BLAKE2b-256 | 144d443fbd5cb8f4f75db71f5cbb60f3c10a4cd945e2128ced0366580bd0d439 |
Close
Hashes for uharfbuzz-0.1.2-cp36-cp36m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb010004dab05370f76000f9da1cbf879a6582e26544f53c49ca5a9761c5531b |
|
MD5 | cd724ea453094c84e2c10ccc336d97fe |
|
BLAKE2b-256 | 861ebdca22336be795e85f91c437743435bd564381f5c5ac3f1a0f54652f1c2d |