Skip to content

Commit

Permalink
bump crengine & fribidi, tweak xtext.makeLine() (#1022)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
poire-z committed Dec 16, 2019
1 parent f94e953 commit 3813bb1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion thirdparty/fribidi/CMakeLists.txt
Expand Up @@ -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}
)

Expand Down
2 changes: 1 addition & 1 deletion thirdparty/kpvcrlib/crengine
15 changes: 15 additions & 0 deletions xtext.cpp
Expand Up @@ -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, &para_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<i; j++)
printf("%x %c %d\n", m_text[j], m_text[j], m_bidi_levels[j]);
*/
if ( this_max_level > max_level )
max_level = this_max_level;
// we set a flag on all chars part of this segment so we can know what
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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");
Expand Down

0 comments on commit 3813bb1

Please sign in to comment.