From 77f3b529af9d47dcf77ad239063f71601eb467e4 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Fri, 12 Jan 2024 22:48:00 +0000 Subject: [PATCH] Add: Support zero-width space {ZWSP} to indicate where strings may break. --- src/gfx_layout.cpp | 2 ++ src/table/strgen_tables.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp index 2f479247ec..c2d3ceca26 100644 --- a/src/gfx_layout.cpp +++ b/src/gfx_layout.cpp @@ -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; diff --git a/src/table/strgen_tables.h b/src/table/strgen_tables.h index 60fcf80060..9fa065b7ff 100644 --- a/src/table/strgen_tables.h +++ b/src/table/strgen_tables.h @@ -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 */