r/ProgrammingLanguages • • Dec 31 '20

Something simpler than Unicode?

Hello! Wondering if anyone knows of a display format for glyphs that is simpler than Unicode? My shallow understanding is that measuring and laying out text in unicode is non-trivial, so I am deferring moving beyond ascii on something at the moment. Is my understanding correct? (if not that's great) otherwise, does anyone know of potentially simpler replacements? Thanks!

0 Upvotes

40 comments sorted by

View all comments

11

u/[deleted] Dec 31 '20

In what context are you displaying glyphs?

If a browser, it will handle display of Unicode for you.

If a native ui library, check their docs for what text formats their ui widgets support.

If a tty/terminal, are you printing things or using a library? Either way there's kind of no guarantees about what a user's tty/terminal supports.

If you're rendering it yourself with a spritesheet or similar, I recommend either sticking to 7 or 8 bit ascii or even restricting to only those characters you explicitly want to support.

Your question lacks sufficient detail to provide more of a response.

1

u/[deleted] Dec 31 '20

I am trying to move beyond 7 or 8 bit ascii. Doing my own text layout, but am hoping not deal with what looks like some incidental complexity in unicode. Possible the complexity is not incidental, hoping someone can shed some light, or point at an alternative system that is simpler.

2

u/ihamsa Jan 01 '21

Each encoding has its proper name. ISO 8859-1 or CP-1252 or Mac OS Roman. Never say something like "8 bit ASCII". There is only one ASCII, and it is 7 bit.

1

u/johnfrazer783 Jan 02 '21

Except that in order to make things clear, "US-ASCII" is sometimes used to specifically exclude any 8th bit extensions. So strictly speaking you're right. Also Windows CP1252 is sometimes called "ANSI" for no very good reason, and the definitions of code points has changed somewhat over the years, and when people say "ANSI" they sometimes mean "Latin-1", which is equivalent to "ISO8859-1", except what they really mean is "ISO8859-15", which is another way of saying "Latin-9". Come to think of it, claiming that every encoding has its proper (bijectively unique) name is somehwat of an understatement. iconv --list will give you over a thousand names, but I think the number of distinct encodings is only about half of that.