something that I don't see discussed too much in the push to get off of election/web technologies is the impact that has on displaying non-latin text. if you are writing your own text renderer you are almost guaranteed to get it wrong when it comes to languages you are not familiar with. arabic is particularly badly served in this regard and I collect the many fuck ups on notarabic.com

for all of its faults (and there are many!) the web stack is still one of the best ways to not mess up text...

like, have you ever written a text renderer that looks like this:

def render(string, x, y):
foreach c in string:
draw(c, x, y)
x += width(c)

i know i have! it looks innocent enough and works for english, but it literally hardcodes the assumptions that text is left-to-right and not-cursive. faced with arabic it will fail silently and give you what you see on notarabic.com/. the full solution requires something like en.wikipedia.org/wiki/HarfBuzz

@nasser this hits me in the heart, because I've been doing exactly this recently: github.com/akkartik/mu/blob/ma My ideology of "simple stack" and "collaborators not users" and "your computer shouldn't run code you don't need" runs into the hard reality that text rendering requires specialization.

Comments appreciated. Does anyone know of a tiny core API for text rendering that is agnostic to text direction? If my project seems not worth doing if it can't support non-Latin, I'd like to hear that too.

Follow

@akkartik @nasser neatroff is a from scratch troff implementation with support for right-to-left scripts, maybe there is something useful there: litcave.rudi.ir

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.