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.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.3.1
File Size Uploaded Provenance Actions
scribefont-0.3.1.tar.gz 28.6 kB Without provenance Details for scribefont-0.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 56.4 kB

Release files / scribefont-0.3.1.tar.gz

Download URL scribefont-0.3.1.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0b3acdae88d591e7806a46ceba644b7cc3882e258ee38aeaf67f5539cf96f72b
BLAKE2b-256 checksum
How to use checksums
270040ccf9faf4a3c4f33f4875c0cebbc956279280d05a2db2ba09f1f9edccc0
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.1-py3-none-any.whl

Download URL scribefont-0.3.1-py3-none-any.whl
Size 27.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff48477dd9f6f1080f985588292585298bb1d4d1f72498a5b119af05152a19b2
BLAKE2b-256 checksum
How to use checksums
188730423e223a5aef88d9e6f7c54289b2f14047572e3eb9e8001d0ea2c04370
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.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