High-performance UFO/GLIF parser for Python written in Rust
Project description
ufo-gleaner
High-performance UFO/GLIF parser for Python written in Rust
Usage
Install
Install with pip:
python -m pip install ufo-gleaner
Quickstart
Parse all .glif files in one go as a dictionary mapping glyph names to their attributes:
from ufo_gleaner import UfoGleaner, FileProvider
provider = FileProvider("/path/to/myfont.ufo")
gleaner = UfoGleaner(provider)
glyphs = gleaner.glean()
print(glyphs["A"]["advance"]["width"])
Custom Providers
UfoGleaner 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 UfoGleaner
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 = UfoGleaner(provider)
glyphs = gleaner.glean()
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 Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ufo_gleaner-0.1.2-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: ufo_gleaner-0.1.2-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 328.3 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e08f4028c4882e3eaec5dbfefe6a1e2b4ac9b6a0949d5e8a0d364862ebdcf0c
|
|
| MD5 |
f40033dceec16a928e14fd7cc05993d5
|
|
| BLAKE2b-256 |
eaa54b91e836194021003f99295f91c735cc9e9b27bcff3e6be06490759960da
|