|
|
|
|
|
by javierbyte
263 days ago
|
|
Author here! I'm so happy to see Brutalita randomly popping up on Hacker News! I had fun building this small project, there are a few fun things I did to make this work: - The editor is a textarea with a monospace font, but the text is transparent, the font is rendered on top of it using SVG of the same size and line height as the monospace font behind it. This way I didn't have to recreate a whole editor and got the real-time preview I wanted. - The way the SVG preview and the 'real font' are constructed is different. I talk about this a bit more on my blog [1] but in short in SVG I can use "thick lines" with rounded corners, and for the font I have to render polygons and I found a great library "mfogel/polygon-clipping" that makes the process of combining them a breeze. Thank you all for the interest! I might work on an update or two ;) [1] https://javier.xyz/blog/brutalita-learning-opentypejs |
|
But well, it is an addictive game! :)