News for hackers. Stuff that matters.
Re:Show HN: Repaint – a WebGL based website builder by wg0 on Tuesday September 03, 2024 @05:56PM (#41439708)
If you look at the text rendering alone, this is a massive feat. People take text rendering for granted. No sir, it is not. Even for Latin script, it is not. Let alone exotic languages such as Urdu/Persian that are highly cursive and ascend upwards depending upon the length of the word.

This seems to be built out of pure love for technology but I am wondering how much time and effort has gone into that.

Re:Show HN: Repaint – a WebGL based website builder by peppertree on Tuesday September 03, 2024 @06:42PM (#41440055)
Text and css are both endless pits of undefined behavior. But this would make a great ad builder.
Re:Show HN: Repaint – a WebGL based website builder by benshumaker0 on Tuesday September 03, 2024 @07:00PM (#41440183)
Thanks! Yeah, text rendering nearly killed me. And all I did was latin script. I even punted on ligatures for now. I'm insanely impressed by the people who made full text support.

And maybe it sounds silly, but we don't personally feel pure love for technology. We're obsessed with a vision. And we've decided to conquer any technical challenge to make it real.

Re:Show HN: Repaint – a WebGL based website builder by rikroots on Wednesday September 04, 2024 @04:18AM (#41443143)
> but I am wondering how much time and effort has gone into that

For me, it was the best part of 4 months of mornings, evenings and weekends - and roughly 40% of my sanity (quaternions took the other 60% a few years ago). And the work is nowhere near finished. Knowing that I still need to find a proper fix for CJK punctuation brings me out in hives. I've also developed a special hatred of Thai fonts.

As for styling a single Arabic glyph within a word ... has anyone in the world managed to do that? It's when I failed to achieve that idea I decided to throw in the towel and release the work as Good Enough because I've Had Enough!

Still - it was an adventure[1].

[1] - https://scrawl-v8.rikweb.org.uk/demo/canvas-206.html

Re:Show HN: Repaint – a WebGL based website builder by spuzvabob on Wednesday September 04, 2024 @10:46AM (#41446426)
For a very similar use case I've developed custom text rendering in browser with support for CJK, Thai, Arabic (including bidirectional text with Arabic text within Latin or vice versa) and bitmap emojis.

Tbh all the complex part is handled by: https://github.com/harfbuzz/harfbuzzjs which handles the entire text shaping part (which glyphs to draw and the offset from previous glyph), then all that remains is text layout (linebreaking, kerning, line height, font size etc.) and the actual rendering ofc. Still took about 4 months of full-time work.

Re:Show HN: Repaint – a WebGL based website builder by rikroots on Wednesday September 04, 2024 @12:59PM (#41447992)
I looked at harfbuzzjs at one point when the work was making me cry. It looks very useful, but in the end I decided against using it. Partly because I'm keen to keep my library free of direct dependencies. But also because I know both Chromium and Firefox use Harfbuzz internally (I wonder what Safari uses instead?) and it annoys me that even with access to that tool, browsers still manage to make a mess of the Canvas Text Metrics interface[1].

People who develop canvas libraries soon learn that they don't get to play with Nice Things like consistency across browser implementations for the standards they've (allegedly) agreed to respect.

[1] - https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics

Re:Show HN: Repaint – a WebGL based website builder by wg0 on Wednesday September 04, 2024 @02:19PM (#41448797)
Massive respect for the craft. Knowing the details of the text rendering myself, goosebumps. :)
Re:Show HN: Repaint – a WebGL based website builder by red_trumpet on Wednesday September 04, 2024 @09:25AM (#41445519)
> Let alone exotic languages such as Urdu/Persian that are highly cursive and ascend upwards depending upon the length of the word

I've never heard about this. Where can I read more about it?

Re:Show HN: Repaint – a WebGL based website builder by izakfr on Wednesday September 04, 2024 @10:01AM (#41445957)
This has been linked in the comments already, but check this out: https://faultlore.com/blah/text-hates-you/
Re:Show HN: Repaint – a WebGL based website builder by red_trumpet on Wednesday September 04, 2024 @12:06PM (#41447376)
That's an interesting read, but I didn't find anything relating to

> ascend upwards depending upon the length of the word

Did I just miss it?

Re:Show HN: Repaint – a WebGL based website builder by wg0 on Wednesday September 04, 2024 @02:15PM (#41448761)
You can check the Pango's script gallery (GNOME project) [0] as showcase of their prowess to be able to render Persian/Urdu that is the most complex form of Arabic script.

Complexity comes from the fact that in Arabic, a single character can have at max 4 contextual shapes generally speaking. In Nastaleeq variation, a single character can have up 100s of contextual shapes depending upon where it appears in the word.

[0]. https://pango.gnome.org/ScriptGallery