v3.0.0: added support for using '**' to highlight, like in markdown

This commit is contained in:
Evan Debenham
2024-11-21 14:03:29 -05:00
parent f93a588781
commit 67a4902d2c
4 changed files with 19 additions and 17 deletions

View File

@@ -286,19 +286,19 @@ public class AndroidPlatformSupport extends PlatformSupport {
return basicFontGenerator;
}
}
//splits on newlines, underscores, and chinese/japaneses characters
//splits on newline (for layout), chinese/japanese (for font choice), and '_'/'**' (for highlighting)
private Pattern regularsplitter = Pattern.compile(
"(?<=\n)|(?=\n)|(?<=_)|(?=_)|" +
"(?<=\n)|(?=\n)|(?<=_)|(?=_)|(?<=\\*\\*)|(?=\\*\\*)|" +
"(?<=\\p{InHiragana})|(?=\\p{InHiragana})|" +
"(?<=\\p{InKatakana})|(?=\\p{InKatakana})|" +
"(?<=\\p{InCJK_Unified_Ideographs})|(?=\\p{InCJK_Unified_Ideographs})|" +
"(?<=\\p{InCJK_Symbols_and_Punctuation})|(?=\\p{InCJK_Symbols_and_Punctuation})|" +
"(?<=\\p{InHalfwidth_and_Fullwidth_Forms})|(?=\\p{InHalfwidth_and_Fullwidth_Forms})");
//additionally splits on words, so that each word can be arranged individually
//additionally splits on spaces, so that each word can be laid out individually
private Pattern regularsplitterMultiline = Pattern.compile(
"(?<= )|(?= )|(?<=\n)|(?=\n)|(?<=_)|(?=_)|" +
"(?<= )|(?= )|(?<=\n)|(?=\n)|(?<=_)|(?=_)|(?<=\\*\\*)|(?=\\*\\*)|" +
"(?<=\\p{InHiragana})|(?=\\p{InHiragana})|" +
"(?<=\\p{InKatakana})|(?=\\p{InKatakana})|" +
"(?<=\\p{InCJK_Unified_Ideographs})|(?=\\p{InCJK_Unified_Ideographs})|" +
@@ -307,7 +307,7 @@ public class AndroidPlatformSupport extends PlatformSupport {
//splits on each non-hangul character. Needed for weird android 6.0 font files
private Pattern android6KRSplitter = Pattern.compile(
"(?<= )|(?= )|(?<=\n)|(?=\n)|(?<=_)|(?=_)|" +
"(?<= )|(?= )|(?<=\n)|(?=\n)|(?<=_)|(?=_)|(?<=\\*\\*)|(?=\\*\\*)|" +
"(?!\\p{InHangul_Syllables})|(?<!\\p{InHangul_Syllables})");
@Override