Skip to content

Superscript arabic numerals → Unicode, why not subscript arabic numerals, too? #9

@Moonbase59

Description

@Moonbase59

In

private static String replaceSuperscript(String in) {
Matcher matcher;
while ((matcher = SUPERSCRIPT.matcher(in)).find()) {
String replace = "";
String orig = matcher.group();
for (int i = 5; i < orig.length() - 6; i++)
{
char c = 0;
switch (orig.charAt(i)) {
case '0': c = '\u2070'; break;
case '1': c = '\u00b9'; break;
case '2': c = '\u00b2'; break;
case '3': c = '\u00b3'; break;
case '4': c = '\u2074'; break;
case '5': c = '\u2075'; break;
case '6': c = '\u2076'; break;
case '7': c = '\u2077'; break;
case '8': c = '\u2078'; break;
case '9': c = '\u2079'; break;
}
if (c == 0) throw new RuntimeException();
replace += c;
}
in = matcher.replaceFirst(replace);
}
return in;
}
you replace superscript arabic numerals against their Unicode equivalents, why not subscript numerals, too? (Unicode range U+2080..U+2089)

This might help with line spacing issues (except if it were for footnotes/endnotes only).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions