Project
DWriteShapePy is a Python extension built using Cython. It provides streamlined bindings for the DirectWrite shaping engine. The model is similar to the model provided by uHarfBuzz but some differences because of differences in the API models between DirectWrite and HarfBuzz.
DWriteShapePy was initially developed to support a Python based font testing environment where similar tests are executed using both DirectWrite and HarfBuzz.
Example
import sys
import dwriteshapepy as dw
from pathlib import Path
with open(sys.argv[1], 'rb') as fontfile:
fontdata = fontfile.read()
text = sys.argv[2]
face = dw.Face(fontdata)
font = dw.Font(face)
upm = font.upem
print(upm)
buf = dw.Buffer()
buf.add_str(text)
features = {"kern": True, "liga": True}
dw.shape(font, buf, features)
glyph_names = [font.glyph_to_string(g.codepoint) for g in buf.glyph_infos]
infos = [(g.codepoint, g.cluster) for g in buf.glyph_infos]
print(glyph_names)
print(infos)
advance = [(adv.x_advance, adv.y_advance, adv.x_offset, adv.y_offset) for adv in buf.glyph_positions]
print(advance)
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}")
Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
Metadata
Release files for dwriteshapepy 1.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dwriteshapepy-1.0.12.tar.gz | 115.0 kB | With provenance | Details for dwriteshapepy-1.0.12.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| dwriteshapepy-1.0.12-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details for dwriteshapepy-1.0.12-cp313-cp313-win_amd64.whl |
| dwriteshapepy-1.0.12-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details for dwriteshapepy-1.0.12-cp312-cp312-win_amd64.whl |
| dwriteshapepy-1.0.12-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details for dwriteshapepy-1.0.12-cp311-cp311-win_amd64.whl |
| dwriteshapepy-1.0.12-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details for dwriteshapepy-1.0.12-cp310-cp310-win_amd64.whl |
| dwriteshapepy-1.0.12-cp39-cp39-win_amd64.whl | CPython 3.9 | CPython 3.9 | Windows x86-64 | Details for dwriteshapepy-1.0.12-cp39-cp39-win_amd64.whl |
Total release size: 633.8 kB
Release files / dwriteshapepy-1.0.12.tar.gz
| Download URL | dwriteshapepy-1.0.12.tar.gz |
|---|---|
| Size | 115.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05b44b1caa0d519e2bbb858a306fd9a8d0b65c5a1fd2af3d6ec6818cb743ba25
|
|
BLAKE2b-256 checksum How to use checksums |
fad65858f57a1a9756262ddc37b9d99643a15048973fdd00cc26a7ecb94f6f31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 16, 2025.
Transparency logRelease files / dwriteshapepy-1.0.12-cp313-cp313-win_amd64.whl
| Download URL | dwriteshapepy-1.0.12-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 103.7 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5df7aebe98c6d777e65acbc44a3adfafda5ca8cf487322f21dfab1201b83a459
|
|
BLAKE2b-256 checksum How to use checksums |
e17ca5e417c4a8af467f03910a0b2106e0dd2637c47bdb079670d30b0ae84734
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 16, 2025.
Transparency logRelease files / dwriteshapepy-1.0.12-cp312-cp312-win_amd64.whl
| Download URL | dwriteshapepy-1.0.12-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 104.0 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
03f6eea96bdbfea14dcf53759076edf3323e25841bf552a5b8b158eebef71418
|
|
BLAKE2b-256 checksum How to use checksums |
b266d4dede609a7a53b238a88ad73cbce323c250d5c89895f00e12f0d1be72a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 16, 2025.
Transparency logRelease files / dwriteshapepy-1.0.12-cp311-cp311-win_amd64.whl
| Download URL | dwriteshapepy-1.0.12-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 103.5 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e88c266d4401e22ca1febac9c8ff8a2d1613dd9b220e74c3582f0a36949fbb73
|
|
BLAKE2b-256 checksum How to use checksums |
35f8922ccdff382c4132835488d38c387960be021700d6dc8daa01578204a55c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 16, 2025.
Transparency logRelease files / dwriteshapepy-1.0.12-cp310-cp310-win_amd64.whl
| Download URL | dwriteshapepy-1.0.12-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 103.5 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4880c85a807209744fa2c73306e7d8092b5eec499732ffe507b35f04b7d06b7b
|
|
BLAKE2b-256 checksum How to use checksums |
3cb38ae56bacb421efcfef3910406c72ae25342661006383e89ddd17e889d3c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 16, 2025.
Transparency logRelease files / dwriteshapepy-1.0.12-cp39-cp39-win_amd64.whl
| Download URL | dwriteshapepy-1.0.12-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 104.0 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
196e19bc68e179c58239b4085d0f18f19491c3c1b2e07c8defae4dc70bd48c31
|
|
BLAKE2b-256 checksum How to use checksums |
777cba94b7d4186cfda169de410c4067b9566e0476cb7bb3597372d30efa8d82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 16, 2025.
Transparency logSecurity for dwriteshapepy 1.0.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for dwriteshapepy-1.0.12.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 16, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.