Universe

This package ports part of the Unicode Character Database to Typst. Notably, it includes information from UnicodeData.txt and Blocks.txt.

Usage

This package defines a single function: codepoint. It lets you get the information related to a specific codepoint. The codepoint can be specified as a string containing a single character, or with its value.

#codepoint("√").name \
#codepoint(sym.times).block.name \
#codepoint(0x00C9).general-category \
#codepoint(sym.eq).math-class \
#codepoint("⧖").info.aliases

Result of the code example: SQUARE ROOT // Latin-1 Supplement // Lu // relation // ("vertical bowtie", "white framus")

You can display a codepoint in the style of Template:Unichar using the show entry:

#codepoint(sym.aleph).show \
#codepoint(sym.angzarr).show \
#codepoint(0x1249).show \
#codepoint(0x100000).show

Result of the code example: Each codepoint is displayed using the "U+" syntax followed by a representative glyph and the symbol name in small capitals, or relevant information inside chevrons if the codepoint does not have a name.

Changelog

Version 0.4.0

  • Properly isolate text in codepoint show rule.
  • Provide informative aliases from NamesList.txt under codepoint(..).info.aliases.
  • Math classes now use their Typst names.
  • Use a Wasm plugin.

Version 0.3.2

  • Fix a bug where some information would not be retrieved properly.

Version 0.3.1

  • Improve codepoint show rule.
  • Fix a panic occurring when using a codepoint that does not belong to a block.
  • Update to Unicode 17.0.0.

Version 0.3.0

  • Add math-class attribute to codepoints.
    • Some codepoints have their math class overridden by Typst. This is the Unicode math class, not the one used by Typst.
  • The id of codepoints now returns a string without the "U+" prefix.

Version 0.2.0

  • Codepoints now have an id attribute which is its corresponding “U+xxxx” string.
  • The block attribute of a codepoint now contains a name, a start, and a size.
  • Fix an issue that made some codepoints cause a panic.
  • Include data from NameAlias.txt.

Version 0.1.0

  • Add the codepoint function.