Streamlined Cython bindings for the harfbuzz shaping engine
Project description
uharfbuzz
Streamlined Cython bindings for the HarfBuzz shaping engine.
Example
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}")
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.3.1.zip
(18.3 kB
view hashes)
Built Distributions
uharfbuzz-0.3.1-cp37-cp37m-win32.whl
(226.6 kB
view hashes)
uharfbuzz-0.3.1-cp36-cp36m-win32.whl
(226.8 kB
view hashes)
Close
Hashes for uharfbuzz-0.3.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ff39f66c8e5e8929201be7fec17f33dc46eab7e15e1afe55cec5f50b133db6f |
|
MD5 | cf84245b8c99728788d54618e1f65549 |
|
BLAKE2b-256 | 247a99e5ca4bcaf45f5d18c4f2c5590c7238a27653fa20dc5683bd899e246daf |
Close
Hashes for uharfbuzz-0.3.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25d446ce836d8b4bd78d7d3263de860d58151ed584e3c9c7abd75b06fee9fcbe |
|
MD5 | d8c6ef4f138db7a7e86ba399e5d0ed97 |
|
BLAKE2b-256 | c9ce9360e84d1eae4060f7cf7d49eac5345b3e821437eab1cc5af90f22a1032b |
Close
Hashes for uharfbuzz-0.3.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac1f910454402bd623bef962b64c85c01cc0a95036f4c8f5e72561ed45c7737d |
|
MD5 | 338d8d10b045145b767a555d645690d6 |
|
BLAKE2b-256 | baeacc81357d15b377ede50c53bd0f0d0fbb694ade0f4a2843de0be73fa42469 |
Close
Hashes for uharfbuzz-0.3.1-cp37-cp37m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c254ceff9e259be2bd0230bdd92040d97fbd864c6642ae72c8db6cfbd72be882 |
|
MD5 | 27afe616e734325526e1a9f1460ac773 |
|
BLAKE2b-256 | 0f1c768a10991215a3fc49a3dc9474d036fce1673a8a7d25e12ed342410f0484 |
Close
Hashes for uharfbuzz-0.3.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 785026b365a1bfa3e6237b05f0deae15c8f91d4e2f9efdbf127813e607396870 |
|
MD5 | e51e88de08d28baf46aa202353baa05f |
|
BLAKE2b-256 | 456c38fb902625a34006fb0712c8b377de3f4dce3fdab1e07fd53c05d67d8ba8 |
Close
Hashes for uharfbuzz-0.3.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e76b78a3c7e9394a86394f7e03b9f623d1c101c0d986a3e682509fb2f3dd073a |
|
MD5 | d9b33369b5854f828cc9f8033b5672c4 |
|
BLAKE2b-256 | 2d7968b85b2b704fc8fa10345bfa629f1c4f0426de17147f92e2fbb4d673e04c |
Close
Hashes for uharfbuzz-0.3.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a06f16e0758e7e9e7a5657993c8a5c15f7d41727f13b62be61a8559b8a85ac2 |
|
MD5 | 74617db3152d14a25deede504162aaa0 |
|
BLAKE2b-256 | 061deb8593ac5fe2ccbe99c70f0b0fb7fa97fb194ada5c6fa62cf648a6245f31 |
Close
Hashes for uharfbuzz-0.3.1-cp36-cp36m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce863c1e0ae7c5610d899cf3d9dee624bdd6f14dcf3a7b1794712965419b9b98 |
|
MD5 | 41bbf9761555a924ca2ab5fec9993918 |
|
BLAKE2b-256 | 5d87211d410a26d24f3febe7cd79acafeacbf2ee3d2a08f2377056dcde73b1f7 |