Skip to content

Commit 9f9c98b

Browse files
committed
Build Unicode Map on demand
1 parent 2888502 commit 9f9c98b

File tree

1 file changed

+6
-3
lines changed
  • mathosphere-core/src/main/java/com/formulasearchengine/mathosphere/mlp/text

1 file changed

+6
-3
lines changed

mathosphere-core/src/main/java/com/formulasearchengine/mathosphere/mlp/text/UnicodeMap.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
public class UnicodeMap {
1515

16-
private static final Map<Integer, String> MAP = buildMap();
16+
private static Map<Integer, String> MAP = null;
1717

18-
private static Map<Integer, String> buildMap() {
18+
private static void buildMap() {
1919
// see table here
2020
// http://unicode-table.com/en/blocks/letterlike-symbols/
2121

@@ -32,7 +32,7 @@ private static Map<Integer, String> buildMap() {
3232
LOGGER.error("unicode2tex-problem");
3333
e.printStackTrace();
3434
}
35-
return unicode2tex.build();
35+
MAP = unicode2tex.build();
3636
}
3737

3838
private static final Logger LOGGER = LoggerFactory.getLogger(UnicodeMap.class);
@@ -54,6 +54,9 @@ public static String string2TeX(String in) {
5454
}
5555

5656
public static String char2TeX(int codePoint) {
57+
if ( MAP == null){
58+
buildMap();
59+
}
5760
if (CharUtils.isAsciiPrintable((char) codePoint)) {
5861
return CharUtils.toString((char) codePoint);
5962
}

0 commit comments

Comments
 (0)