From 3813bb1b950abdd75a11b96e237ca9932f3dc1a5 Mon Sep 17 00:00:00 2001 From: poire-z Date: Mon, 16 Dec 2019 18:24:53 +0100 Subject: [PATCH] bump crengine & fribidi, tweak xtext.makeLine() (#1022) - bump crengine: (Upstream) DocX: fix paragraphs with single hyperlink - bump fribidi to 1.0.8 (for nested isolates fix) - xtext.makeLine(): return no_allowed_break_met=true when that happens, so we know the line breaks inside a word. --- thirdparty/fribidi/CMakeLists.txt | 2 +- thirdparty/kpvcrlib/crengine | 2 +- xtext.cpp | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/thirdparty/fribidi/CMakeLists.txt b/thirdparty/fribidi/CMakeLists.txt index 2831dc368..72da7e5fa 100644 --- a/thirdparty/fribidi/CMakeLists.txt +++ b/thirdparty/fribidi/CMakeLists.txt @@ -36,7 +36,7 @@ endif() ko_write_gitclone_script( GIT_CLONE_SCRIPT_FILENAME https://github.com/fribidi/fribidi.git - tags/v1.0.7 + tags/v1.0.8 ${SOURCE_DIR} ) diff --git a/thirdparty/kpvcrlib/crengine b/thirdparty/kpvcrlib/crengine index f75865f28..4239c45c0 160000 --- a/thirdparty/kpvcrlib/crengine +++ b/thirdparty/kpvcrlib/crengine @@ -1 +1 @@ -Subproject commit f75865f28c2b0554827fd52a9ff55deebba6589d +Subproject commit 4239c45c0916371c090a1f1fc573edbfb2eeba20 diff --git a/xtext.cpp b/xtext.cpp index 8076ae2f7..ffcb203f6 100644 --- a/xtext.cpp +++ b/xtext.cpp @@ -482,6 +482,11 @@ class XText { FriBidiLevel * bidi_levels = (FriBidiLevel *) (m_bidi_levels + s_start); int this_max_level = fribidi_get_par_embedding_levels_ex(bidi_ctypes, bidi_btypes, s_length, ¶_bidi_type, bidi_levels); + /* To see resulting bidi levels: + printf("par_type %d , max_level %d\n", para_bidi_type, this_max_level); + for (int j=s_start; j max_level ) max_level = this_max_level; // we set a flag on all chars part of this segment so we can know what @@ -1087,6 +1092,7 @@ class XText { // printf("%d < %d && %d <= %d ?\n", i, m_length, line_width, targeted_width); } bool can_be_justified = true; + bool no_allowed_break_met = false; if ( forced_break ) { can_be_justified = false; if ( i==start ) { // \n at start: empty line with no glyph @@ -1102,6 +1108,9 @@ class XText { if ( i == m_length ) { can_be_justified = false; // no justification on last line } + else { + no_allowed_break_met = true; + } } // We could have used some indirection to make that more // generic, but let's push a table suitable to be added @@ -1128,6 +1137,12 @@ class XText { lua_pushinteger(m_L, targeted_width); lua_settable(m_L, -3); + if ( no_allowed_break_met ) { + lua_pushstring(m_L, "no_allowed_break_met"); + lua_pushboolean(m_L, true); + lua_settable(m_L, -3); + } + if ( next_line_start_offset >= 0 && next_line_start_offset < m_length ) { // next_start_offset is to be nil if end of text lua_pushstring(m_L, "next_start_offset");