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.1.1

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.1.1
File Size Uploaded Provenance Actions
scribefont-0.1.1.tar.gz 13.9 kB Without provenance Details for scribefont-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 27.5 kB

Release files / scribefont-0.1.1.tar.gz

Download URL scribefont-0.1.1.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8d82d33499027c48a870f27cc2ca9e1ec9ac5b8a181a0d1e8528b33232ad247d
BLAKE2b-256 checksum
How to use checksums
b289b0a62de29a0f0829ed974609585496c6abc025bafdd795b458deb0018c36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

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

Download URL scribefont-0.1.1-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c64127163612cdbd2d6b5987c2ec01d7985128216e1cdb128c61880cb4c8fc3a
BLAKE2b-256 checksum
How to use checksums
94dac5628df52610739554d071ed654271c320bc3f798e50688ec3593f9c12dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for scribefont 0.1.1

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