diff --git a/source/blender/blenfont/intern/blf_font.cc b/source/blender/blenfont/intern/blf_font.cc index ef46935fcf7..47507115624 100644 --- a/source/blender/blenfont/intern/blf_font.cc +++ b/source/blender/blenfont/intern/blf_font.cc @@ -1336,10 +1336,19 @@ static void blf_font_wrap_apply(FontBLF *font, wrap.last[1] = i_curr; clip_bytes = 1; } - else if (UNLIKELY((int(mode) & int(BLFWrapMode::Path)) && ELEM(codepoint, SEP, ' ', '_'))) { - wrap.last[0] = i; - wrap.last[1] = i; - clip_bytes = 0; + else if (UNLIKELY(int(mode) & int(BLFWrapMode::Path))) { + if (ELEM(codepoint, SEP, ' ', '?', '&', '=')) { + /* Break and leave at the end of line. */ + wrap.last[0] = i; + wrap.last[1] = i; + clip_bytes = 0; + } + else if (ELEM(codepoint, '-', '_', '.', '%')) { + /* Break and move to the next line. */ + wrap.last[0] = i_curr; + wrap.last[1] = i_curr; + clip_bytes = 0; + } } else if (UNLIKELY((int(mode) & int(BLFWrapMode::Typographical)) && !BLI_str_utf32_char_is_breaking_space(codepoint) && diff --git a/source/blender/blenfont/tests/BLF_tests.cc b/source/blender/blenfont/tests/BLF_tests.cc index 2ec492cd54d..fdf1e8c8397 100644 --- a/source/blender/blenfont/tests/BLF_tests.cc +++ b/source/blender/blenfont/tests/BLF_tests.cc @@ -262,8 +262,8 @@ TEST(blf_wrapping_path, wrap_path_overflow_ascii) { /* Do not break, even though over the wrap limit. */ const char sample[] = - "xxxxxxxxxxxxxxxxxxx!\"#$%&\'()*+,-." - "0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^`abcdefghijklmnopqrstuvwxyz{|}~"; + "xxxxxxxxxxxxxxxxxxx!\"#$\'()*+," + "0123456789:;<>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^`abcdefghijklmnopqrstuvwxyz{|}~"; /* Ahem does not contain all the characters included in above string. */ int id = open_font("Roboto.ttf"); BLF_size(id, 10.0f);