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.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.1.0
File Size Uploaded Provenance Actions
scribefont-0.1.0.tar.gz 11.3 kB Without provenance Details for scribefont-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 22.3 kB

Release files / scribefont-0.1.0.tar.gz

Download URL scribefont-0.1.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
82d827c59ba090334798133928d2d8fd3c4459dbc62b5f300211bd18aee94c37
BLAKE2b-256 checksum
How to use checksums
1a75fbbadc17ca9b2988aaccbe3f30317440d2129252d41e132d02fdf5074ccb
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.0-py3-none-any.whl

Download URL scribefont-0.1.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0abe2bc26b47b73cfaf69c4d067fdc44eeeeac7bd54898945367063a097cddea
BLAKE2b-256 checksum
How to use checksums
cc605e970af9bb20d4610989428b9bd5175e31ec808d0973acf403897e82ab25
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.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