Skip to content

Commit

Permalink
Text: dont adjust space after consecutive initial marks/dashes
Browse files Browse the repository at this point in the history
Extend 2504a40 to keep doing it when multiple such
initial quotation marks/dashes separated by spaces.
  • Loading branch information
poire-z committed Mar 22, 2021
1 parent d1b8ab3 commit a4bda6d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crengine/src/lvtextfm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,7 @@ class LVFormatter {
// remove, from the measured cumulative width, what we just, and previously, removed
widths[k] -= cumulative_width_removed;
if ( first_word_len >= 0 ) { // This is the space (or nbsp) after first word
bool keep_checking = false;
if ( first_word_len == 1 ) { // Previous word is a single char
if ( k > 0 && isLeftPunctuation(m_text[k-1]) ) {
// This space follows one of the common opening quotation marks or
Expand All @@ -1926,14 +1927,21 @@ class LVFormatter {
// Also prevent that quotation mark or dash from getting
// additional letter spacing for justification
flags[k-1] |= LCHAR_LOCKED_SPACING;
// If what's coming next is also such a char, continue doing that
if ( k+1 < len && isLeftPunctuation(m_text[k+1]) ) {
keep_checking = true;
}
//
// Note: we do this check here, with the text still in logical
// order, so we get that working with RTL text too (where, in
// visual order, we'll have lost track of which word is the
// first word - untested though).
}
}
first_word_len = -1; // We don't need to deal with this anymore
if ( keep_checking )
first_word_len = 0;
else
first_word_len = -1; // We don't need to deal with this anymore
}
}
else {
Expand Down

0 comments on commit a4bda6d

Please sign in to comment.