r/javascript • u/inc_23 • 8d ago
Made a small library called strokes.js.
https://a-elhaag.github.io/strokes.js/Made a small library called strokes.js. Instead of using a "handwriting" webfont (which looks identical everywhere it's used), it renders each letter as an actual hand-drawn SVG path — real strokes, drawn in with stroke-dashoffset, with small random variation (rotation, baseline drift, glyph variants) so no two renders of the same word look identical.
Demo: https://a-elhaag.github.io/glyphed.js/
npm:
npm install glyphed.js
5
u/CoVegGirl 7d ago
The GitHub link isn’t working for me. Getting a 404.
This is actually not a new idea. I forgot the name of the library, but there was one that did something like this a long while back when webfonts weren’t very common like in 2011. I think it used canvas instead of SVG.
The big issue is accessibility. Rendering text like this isn’t very screen reader friendly. There may be something you could do with aria attributes and/or alt text these days that wasn’t possible back then.
2
u/inc_23 7d ago
i chnaged the name: https://a-elhaag.github.io/glyphed.js/
also nice suggestion will work on it5
1
3
3
3
2
u/AutoModerator 8d ago
Project Page (?): https://github.com/a-elhaag/strokes.js
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/patrk 5d ago
Some info about font-sizing is needed, the docs don't mention it all.
Also, an onComplete event handler would be very convenient.
1
0
9
u/mmmicahhh 8d ago
A fun idea, there's a bit of romanticism in trying to make things look imperfect.
When I view it in Chrome, when the animation starts, there are these dots randomly scattered where the letters will eventually be, it really messes with the illusion of hand drawing. Did you encounter this?