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.1.3.zip
(17.7 kB
view hashes)
Built Distributions
uharfbuzz-0.1.3-cp36-cp36m-win32.whl
(185.6 kB
view hashes)
Close
Hashes for uharfbuzz-0.1.3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6c91f2dc0e916b3927ba3fac23c2071404df5173a1f42168972889e0389de43 |
|
MD5 | c8ca1a3f8051eb40021871e530d6aeb5 |
|
BLAKE2b-256 | 7b41380c7bc316cf1f0214eb970914dba0e57b2171694dce79fade5924575ac5 |
Close
Hashes for uharfbuzz-0.1.3-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d724b745ddae6e16d5a5660786957bdb6ca8c5e7ff536147dcf7548cf88dcc9 |
|
MD5 | 1df600d7a6a2ecb5cff21b3750713268 |
|
BLAKE2b-256 | 46041957baf331963bab71634cc3fdc380dff6b1cf16d29af654ecf7f6f9541f |
Close
Hashes for uharfbuzz-0.1.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 633f1792662c06ef5e0693e732dc57ce3f60fd40732dc55f3ba6b72beb603607 |
|
MD5 | 546af922d0edfbe67721b08bbafc5af4 |
|
BLAKE2b-256 | f99eef68ffce97aefd18867643141cb814611bebe9078d499ff61a114d0bd604 |
Close
Hashes for uharfbuzz-0.1.3-cp36-cp36m-macosx_10_6_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3227560b2f0ff98b52e945245d0f0c92240fdaabb0a9df49be61f1a119440b73 |
|
MD5 | 71323060ca04b1502f0142c152292412 |
|
BLAKE2b-256 | a5f0ec92fc92af09d23211147fc1727ded47c1eaa149e253529783c71cc1fb3c |