ufo-gleaner
High-performance UFO/GLIF parser for Python written in Rust
Usage
Install
Install with pip:
python -m pip install ufo-gleaner
Eager Gleaner
Parse all .glif files in one go as a dictionary mapping glyph names to their attributes:
from ufo_gleaner import Gleaner, FileProvider
provider = FileProvider("/path/to/myfont.ufo")
gleaner = Gleaner(provider)
glyphs = gleaner.glean()
print(glyphs["A"]["advance"]["width"])
Lazy Font Object Model
To minimize load time and memory footprint, ufo-gleaner provides a dictionary-like font
object with lazy parsing and on-demand access to GLIF files and their attributes:
from ufo_gleaner import Font, FileProvider
provider = FileProvider("/path/to/myfont.ufo")
font = Font(provider)
# Access a single glyph by name
glyph = font["A"]
# Access glyph attributes lazily
anchors = glyph.anchors
Custom Providers
Gleaner can be used with any Python object that implements a read(path: str) -> bytes method,
where path is relative to the UFO root. This lets you read from both .ufo directories and .ufoz
ZIP archives, for example:
import zipfile
from ufo_gleaner import Gleaner
class UfozProvider:
def __init__(self, root):
self.zipfile = zipfile.ZipFile(root, "r")
def read(self, path: str) -> bytes:
return self.zipfile.read(path)
provider = UfozProvider("/path/to/myfont.ufoz")
gleaner = Gleaner(provider)
glyphs = gleaner.glean()
Metadata
Release files for ufo-gleaner 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ufo_gleaner-0.2.2-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for ufo_gleaner-0.2.2-cp310-abi3-macosx_11_0_arm64.whl |
Release files / ufo_gleaner-0.2.2-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | ufo_gleaner-0.2.2-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 365.9 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
831a0aa38130835cfabca567e32d968b752b528f820788ea9dd4ef2216d3e0d5
|
|
BLAKE2b-256 checksum How to use checksums |
cb9afb2af08906fc33bcf7eec8dc6e700cc0049c3545780707cb547eab4b1485
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.3
|
Security for ufo-gleaner 0.2.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.