Class UnicodeUtils

java.lang.Object
edu.cnu.mdi.util.UnicodeUtils

public final class UnicodeUtils extends Object
Utility constants and helpers for rendering mathematical and Greek text using Unicode code points instead of a custom font or markup.

The class exposes three things:

  • A large set of named String constants for individual Unicode characters (Greek letters, sub/superscripts, operators, arrows, ...).
  • specialCharReplace(String), which rewrites a small set of LaTeX-like escapes (e.g. \alpha, \leq) into the matching Unicode characters.
  • getSuperscript(int, boolean), which renders an integer using superscript digit glyphs.

All members are static; the class is not meant to be instantiated.

Implementation notes

The replacement set and the superscript digits are kept in small lookup tables (SPECIAL_CHAR_REPLACEMENTS and SUPERSCRIPT_DIGITS) rather than being hard-coded into the method bodies. The public constants and method signatures are unchanged, so this is a drop-in replacement.