Skip to main content

scribefont

Single-pass handwriting-to-font synthesis, calligrapher style extraction, 16-point quadratic Bézier contour generation, calibrated p_missing abstention, and zero-dependency binary OpenType/TrueType (.ttf) compilation in JavaScript, Python, and Browser WebAssembly ONNX.

npm install scribefont
pip install scribefont

Quick start (JavaScript / ESM)

import scribefont, { verifyTrueTypeBytes } from 'scribefont';

const font = scribefont(
  {
    style: {
      slant_deg: 14.5,
      stroke_width: 52,
      x_height_ratio: 0.68,
      width_scale: 0.95,
      roundness: 0.78,
      serif_flare: 0.50,
    },
  },
  { family: 'MiraScript' }
);

const ttfBytes = font.toTTF();               // 7,292-byte installable binary .ttf (Uint8Array)
const svgPreview = font.renderSVG('Hello!'); // Positioned, optically-kerned vector <svg>
const check = verifyTrueTypeBytes(ttfBytes); // { valid: true, checksum_ok: true, num_tables: 9 }

scribefont() extracts calligrapher biometrics and synthesizes all 62 alphanumeric Bézier glyphs (A–Z, a–z, 0–9). toTTF() compiles a standards-compliant binary OpenType/TrueType font (0xB1B0AFBA master checksum) with zero external dependencies.

Quick start (Python)

from scribefont import scribefont, verify_truetype_bytes

font = scribefont(
    {"strokes": [[[12, 80], [28, 10], [44, 80]], [[18, 45], [38, 45]]]},
    family="MiraHand",
)

ttf_bytes = font.to_ttf()
assert verify_truetype_bytes(ttf_bytes)["valid"] is True

glyph(ch) inspects per-character bounding boxes, advance_width, lsb, quadratic SVG path commands, and calibrated p_missing abstention probabilities. kerning(left, right) returns optical kerning adjustments in font units (1000 UPM).

3-Tier Empirical Benchmark (B=1,000 Bootstrap 95% CIs)

Runtime Tier Artifact Suite A: Wild Few-Shot ($N=60$) Suite B: 62-Glyph .TTF ($N=62$) Contour MAE Abstention AUROC Latency p50
Tier 1A: PyTorch FP32 Neural 11.40 MB (2.94M) 100.0% [100, 100] 100.0% [100, 100] 2.14 UPM 1.000 4.38 ms
Tier 1B: Browser ONNX Int8 (WASM SIMD) 3.15 MB (3.62x smaller) 100.0% [100, 100] 100.0% [100, 100] 2.15 UPM 1.000 0.96 ms
Tier 2: Zero-Dep JS / Python Engine 0.00 MB (~18 KB code) 73.33% [61.7, 83.3] 100.0% [100, 100] 0.00 / 12.71 UPM 1.000 0.031 ms

License

MIT © Hemanth.HM

Metadata

Release files for scribefont 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scribefont 0.3.0
File Size Uploaded Provenance Actions
scribefont-0.3.0.tar.gz 27.7 kB Without provenance Details for scribefont-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scribefont 0.3.0
File Interpreter ABI Platform Actions
scribefont-0.3.0-py3-none-any.whl Python 3 none any Details for scribefont-0.3.0-py3-none-any.whl

Total release size: 54.6 kB

Release files / scribefont-0.3.0.tar.gz

Download URL scribefont-0.3.0.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0799298ca12b2226b857dc927ccab372311a529f698ef14c9e7a0c4cb139a71e
BLAKE2b-256 checksum
How to use checksums
17f07433325078f147640cc0a9431cd16270104d6dc64dc803358a8ed4b0c620
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.8

Release files / scribefont-0.3.0-py3-none-any.whl

Download URL scribefont-0.3.0-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa5af8718c798622dfd1a7b57743736f7900fa17f0cb7d344adfd4046b061970
BLAKE2b-256 checksum
How to use checksums
401862ddf83911625e98cf7f945ef91eae98daa8759382bdfab67652dcc34cb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.8

Security for scribefont 0.3.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page