Add: Support zero-width space {ZWSP} to indicate where strings may break.

This commit is contained in:
Peter Nelson 2024-01-12 22:48:00 +00:00
parent b3f31a6523
commit 77f3b529af
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
2 changed files with 3 additions and 0 deletions

View File

@ -93,6 +93,8 @@ static inline void GetLayouter(Layouter::LineCacheItem &line, std::string_view s
state.PopColour();
} else if (c >= SCC_FIRST_FONT && c <= SCC_LAST_FONT) {
state.SetFontSize((FontSize)(c - SCC_FIRST_FONT));
} else if (c == 0x200B) {
/* Zero-width space. */
} else {
/* Filter out non printable characters */
if (!IsPrintable(c)) continue;

View File

@ -140,6 +140,7 @@ static const CmdStruct _cmd_structs[] = {
{"RIGHT_ARROW", EmitSingleChar, SCC_RIGHT_ARROW, 0, -1, C_DONTCOUNT},
{"SMALL_LEFT_ARROW", EmitSingleChar, SCC_LESS_THAN, 0, -1, C_DONTCOUNT},
{"SMALL_RIGHT_ARROW", EmitSingleChar, SCC_GREATER_THAN, 0, -1, C_DONTCOUNT},
{"ZWSP", EmitSingleChar, 0x200B, 0, -1, C_DONTCOUNT},
/* The following are directional formatting codes used to get the RTL strings right:
* http://www.unicode.org/unicode/reports/tr9/#Directional_Formatting_Codes */