How to make a unicode emoji table in typst?

I want to see how many unicode emoji work fine with Typst and Firefox, but Rust main thread panicked at somewhere (2000, 3000):

#let unicode_printer(start, end) = {
  for i in range(start, end) [
    #str.from-unicode(i)]}

//#unicode_printer(0, 1999)  //fine
#unicode_printer(2000, 2999)  //not fine?  
//#unicode_printer(3000, 4999)  //fine

And the stack trace:

$ RUST_BACKTRACE=full typst c unicodeprinter.typ 
thread 'main' panicked at crates/typst-layout/src/inline/shaping.rs:896:51:
begin <= end (4 <= 0) when slicing ` ࣣ ࣤ`
stack backtrace:
   0:     0x7fb2888dd3aa - <unknown>
   1:     0x7fb288567b13 - <unknown>
   2:     0x7fb2888d8bd3 - <unknown>
...
  33:     0x7fb288b3de05 - <unknown>

That’s a bug that should be reported. (Edit: no need, it’s mentioned by mattf it’s fixed in development version of typst, which I also confirmed.)

If you draw them in boxes it seems to avoid the crash, in case you want to continue: for i in range(start, end) {box(stroke: 0.1pt, inset: 0.1em)[#str.from-unicode(i)]}

You can also loop over dictionary(emoji) to list all the top level emojis. Unfortunately I don’t think it’s possible to inspect which variant/subemojis each symbol has, so I can’t list them all (like emoji.airplane.landing etc).

1 Like

For all code points, except those that raise error:

#for i in range(0xD800) + range(0xE000, 0x110000) {
  str.from-unicode(i)
  sym.zws
}

This took me 11.2 minutes.

Or what @bluss said:

#for ch in dictionary(emoji).values() {
  ch
  sym.zws
}