Skip to content

About

Gerador de caligrafia de traço único (single-line font) para pen plotter e impressora 3D: exporta SVG e G-code, cartas, grimórios e sigilos de D&D

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Scriptorium: handwriting generator for pen plotters

en pt-br

Free online generator of single-stroke handwriting for pen plotters (or a 3D printer converted into a plotter). Writes letters, books, D&D grimoires and sigils, and exports SVG and G-code. Interface in Brazilian Portuguese.

Use it online: https://augustobosa.github.io/scriptorium/

The app generates handwriting with a procedural, deterministic hand (same seed, same result), lays out the page and exports SVG and G-code.

  • Each character has its own hand: single-line fonts mixed and mutated, with per-occurrence variation, fitting, ligatures, slow drift and pen kinematics.
  • Moods (normal, hurried, angry, tired...) change only the execution; the handwriting stays recognizable.
  • Ornament and arcana: borders, vines, drop caps, filigree, sigils and an arcane alphabet.

Workshops

The site has two paths, and the home page (#inicio) shows both side by side:

  1. Characters (who writes): #personagens. Everything about the handwriting lives in the character: fonts, seed, mutation, size and line spacing (per profile), identity, execution and the gesture of margin notes. A new character starts in three ways: from a D&D character sheet (#ficha), from your own handwriting (#letra) or blank.
  2. Write (what to write): the #carta, #livro, #magias, #bestiario and #simbolos workshops. Each one only picks who writes and the profile ("Escrito por …" above the preview) and handles the material: content, paper, margins, alignment, columns and a letter scale (1 = the profile size).

The Continuar (continue) strip opens the most recent saved materials. Navigation is visible in the header (☰ on mobile).

All workshops share the same panel order: Character, content, Paper, own panel, Table and sheet, Machine. Each type opens with a sample text and its own default scale.

  • Letter (#carta): letter, note or diary. Text markup: {nota: ...}, {~wrong~>right}, {_underline_}, {o:circle}. Notes go to their own layer (margin, strike, underline, loop), with their own pen and character. Without a position, a note goes to the notes margin (note and diary) or to the nearest free spot to the word, linked by an arrow. {nota@direita: ...} fixes the side (esquerda/left, direita/right, acima/above, abaixo/below) and {nota@x,y: ...} fixes the position in mm; the Notes panel lists the notes (side and angle of each), and dragging a note on the preview saves its position. {nota@direita/30: ...} or {nota@/30: ...} fix the angle. The note gesture (arrow curve, irregularity, tip, slant and rotate to fit) belongs to the annotating character, in the "Notas na margem" section of the editor. The Notes panel only holds who annotates and the pen.
  • Spells (#magias): D&D spells. With "one spell per page" on, each spell becomes a loose scroll; off, spells flow like a grimoire, with or without a decorated separator between them (diamond, asterisks or wave). The marked block comes out in the arcane alphabet, with an optional key. Each spell's sigil encodes level, school, concentration, ritual and components.
  • Bestiary (#bestiario): D&D monsters, same workshop as Spells (loose scroll or a running bestiary, separator, arcane alphabet), without a sigil. Filters by challenge rating and type. The stat block is all pt-BR (type, size, alignment, AC, HP, speed in metres, abilities, skills, senses, languages, defenses, CR); in traits and actions only the formulas are translated (attack, to hit, reach/range in metres, damage, saves, recharge) and spell names come from magias.json, the rest of the prose stays in English. Summary = attacks only; full text = traits, actions, bonus actions, reactions, legendary and spellcasting.
  • Book (#livro): columns, running title, page numbers, catchword, rubric, drop cap and border. Uses the same text as Letter and accepts the same markup: loose notes with arrows, corrections, underlines, loops and margin scribbles, without touching pagination, border or drop cap.
  • Symbols (#simbolos): builds the character's symbol system, that is, how each spell's attributes (level, school, damage, area, range, duration, save, concentration, ritual, components) become a sigil. Modes: string necklace, glyph, rings, sides/star and edge marks; 6 presets and a key sheet. The system is saved in the character and the Spells workshop draws the sigils with it. "Free phrases" mode: each phrase becomes a seal, a sigil (kamea, wheel or fusion method) or a circle, with a caption, in a grid (the old #sigilos route redirects here).
  • Image (#imagem): turns an image (drawing or photo) into hatching per pen plus an outline, one layer per pen (one G-code per color). Modes: colors, line drawing (centerline of the ink, separated by color so neighboring lines never merge; uses the image's own resolution; warns when lines are closer than the pen and gives the minimum width) and engraving (Canny outline plus tone in layers). It converts only on the button, in a Web Worker, with a time estimate and progress bar. The file input and the original stay pinned at the top of the sidebar. The Photo view shows the photo on the bed with a transparency slider and on/off switches for the photo and the plot, rotates 90° either way and freely by a handle that shows on hover (snap on/off, every N°). "Restaurar tons" resets the tone settings, which also happens with every new image.
  • My handwriting (#letra, part of the character flow): the machine plots the collection sheets (sample text per language and loose letters, with corner marks and sheet code) for you to write by hand. Reading the photo and generating the font are the next steps.

Interface

  • Basic / Advanced: basic shows the essentials; advanced shows fine tuning and the machine.
  • Live preview: each control shows a sample on hover or focus. What the control changes appears in red; the rest, in ink. Value controls have a ruler and a 10 mm scale, and values have at most 2 decimal places.
  • Characters: gallery with specimen and the full handwriting editor (Handwriting, Size and lines, Identity, Execution, Margin notes); the hand in use applies to all workshops.
  • Create character (#ficha): "Da ficha de D&D" opens a D&D 5e character sheet (race, class, background, abilities, alignment, languages). The sheet suggests the handwriting (3 proposals and a mix) and the writing profiles (diary, grimoire, formal letter, one hand per language…); each profile can have its own hand and size. "Reabrir ficha" in the gallery returns to the wizard.
  • Themes: light (adventurer's handbook) and candle (illuminated grimoire, dark).
  • Saved in the browser: characters (writer.personagens), machine profile (writer.perfil), preferences (writer.ui) and the work in progress of each workshop (trabalho.escrita, trabalho.simbolos, grimorio.estado, bestiario.estado), in localStorage. In IndexedDB (scriptorium): library materials and the imported magias.json and bestiario.json. Nothing goes to a server.
  • Library (#biblioteca): "Salvar na biblioteca" saves the work with a name (workshop, text or spells, settings and character). The tab opens, downloads (.json), renames and deletes; "Baixar cópia de tudo" takes characters and materials to another browser. The home page shows the most recent.
  • Table (Mesa button above the preview): the machine bed seen from above, front at the bottom, with the X0 Y0 origin, how far the pen reaches, the sheet and the text projected where the pen will write. Without imposition, it shows the current page; with imposition, the whole sheet, with the current pass in ink and the others in grey (empty passes are marked and produce no file). "Ampliar" opens the scene full screen.
  • Path: "mostrar trajeto" on the preview shows air travel, start, end and order of each stroke.
  • Zoom (− / % / + buttons above the preview, or Ctrl + mouse wheel at the pointer): magnifies the page, the bed and the Photo view up to 800 %, in a box that scrolls both ways; clicking the % goes back to 100 %.
  • Text: can be typed or imported from a .txt of up to 200 KB.

Machines (src/maquina/perfis.js)

  • megaS: Anycubic i3 Mega S as a plotter, 210 × 210 mm bed. The only profile tested on the hardware.
  • personalizado: editable profile, based on megaS.

The maximum paper size is the profile's usable window. Paper larger than the window is blocked on export, with a message. After the header, the pen rises to zLevantada before the 1st travel; zLevantada must be above zEscrita, otherwise the export refuses. A pen change produces M0 with a warning. Export is per page and per layer (SVG and G-code), or "Todas as páginas" (all pages).

Papers (src/materiais/documento.js)

A3, A4, A5, A6, A7, A8, letter, legal (ofício) and custom, portrait or landscape, with per-side margins. All workshops use the same list; the limit is the machine window.

Structure

  • src/motor/: hand, ductus, writing, kinematics.
  • src/ornamento/: borders, vines, drop caps, filigree.
  • src/arcano/: alphabet, circle, sigil.
  • src/materiais/: letter, book, scroll (spells and monsters), sigils (free phrases), notes, document, examples (default text and look of each type).
  • src/maquina/: profiles, G-code, path optimization, bed imposition.
  • src/letra/: "My handwriting" collection sheets and sample texts per language (linguas/).
  • src/geo.js: shared geometry (dist, comprimento, clamp, ret, VAO, valido, clipping, hatching). Do not copy these helpers into another file.
  • src/ui/: interface (DOM and CSS). Outside src/ui/ the code does not use the DOM. DOM and storage helpers in src/ui/util.js.
  • fontes/: 206 single-stroke fonts (EMS, Hershey, Relief, Mistral, TwinSans, plus 163 Traco* fonts generated from OFL fonts by scripts/tracar-fonte.py). Licenses in fontes/LICENCAS.md.
  • dados/: spell and monster data. Not in git.
  • scripts/gerar-magias.mjs: builds dados/magias.json from 5etools (default: ../../dnd/data/spells). The translation is dados/traducao-ptbr.txt (one id|Name|Summary line per spell).
  • scripts/gerar-bestiario.mjs: builds dados/bestiario.json from the processed bestiary (default: ../../dnd/data/bestiary). Optional pt-BR names in dados/traducao-monstros.txt (one id|Name line); run gerar-magias.mjs first so spellcasting gets the pt-BR spell names.
  • test/: unit tests. e2e/: Playwright tests.

Run

Requirement: Node 24 or newer (CI uses 24 LTS). After npm ci:

  • npm run dev: server at http://localhost:8765/. The port is fixed (--strictPort): if it is busy, the command fails.
  • npm test: unit tests (node --test), with snapshots in test/*.snapshot.
  • npm run e2e: Playwright (Chromium). The claro project runs everything; vela (dark theme) runs only visual.spec.js. Starts npm run dev on its own if it is not running.
  • npm run build: builds dist/ and copies fontes/ and dados/ (if present).
  • npm run golden: rewrites the snapshots. Use only on purpose and review the diff.

Deploy

.github/workflows/pages.yml deploys to GitHub Pages on every push to main: npm ci, npm test, npm run build and upload of dist/. On pull requests it runs the same tests and build, without deploying. One-time GitHub prerequisite: Settings › Pages › Source = "GitHub Actions". dados/ does not go to Pages (it is in .gitignore); without dados/magias.json or dados/bestiario.json, the Spells and Bestiary workshops offer to import the JSON or create blank items.

About

Gerador de caligrafia de traço único (single-line font) para pen plotter e impressora 3D: exporta SVG e G-code, cartas, grimórios e sigilos de D&D

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages