Scribble.js was an old project with the goal of drawing scribbly looking things, such as randomized handwriting, to create more convincing results than a static handwriting font, even one that provides glyph subsitutions to add variation.
- Rough.js for drawing scribbly shapes (lines, circles, rectangles, arbitrary polygons)
- A neural network based technique for rendering handwriting in different styles - this is impressive, and obviously much more dynamic in its generation of handwriting, but still it would be interesting to compare results to much simpler techniques for randomizing handwriting, like adding noise to the derivitive of recorded paths (/to the relative points that make up the path)
- MultiMedium - a later project of mine where the idea is to record handwriting inline in a page, so you record unique data per word instead of using a font and randomizing it
If scribble.js existed and used modules and was a thing, it might look something like this:
Modules for contexts, pens, and fonts.
A context is an interface to something like a canvas
or an svg
.
A pen is the bridge between the context and a drawing action. It can have properties such as color, size, radius, shape, width, height, slant etc.
A font consists of a map of characters to glyph path data, and a function to iterate over it.
A sample font is given for testing, convinience, or whatever. Maybe you can find some other use for some, uh, typographic data.
Font data has this structure:
var pseudoFont = {
name: "Hello World",
// Glyphs is a map of glyphs (characters) to Paths.
// Paths are arrays of PathNodes.
// PathNodes are objects with position (x, y) and pressure (p).
glyphs: {
"A":[{x,y,p},{x,y,p},{x,y,p},{x,y,p},{x,y,p},{x,y,p},{x,y,p}...],
"B":[{x,y,p},{x,y,p},{x,y,p},{x,y,p},{x,y,p},{x,y,p},{x,y,p},{x,y,p}...],
"C":[{x,y,p},{x,y,p},{x,y,p},{x,y,p},{x,y,p},{x,y,p}...],
...
},
// (Optional metadata can be tacked on:)
metaData: "This stuff Is Optional",
otherMetaData: "whatever"
};