Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CJK line Breaking #162

Merged
merged 1 commit into from Apr 25, 2016
Merged

Conversation

Fahad-Alsaidi
Copy link
Contributor

This mimic the old stlye in line breaking though we should find a better solution for line breaking in general.

if((itemText.text(currentIndex -1) != SpecialChars::CJK_NOBREAK_AFTER) &&
(itemText.text(currentIndex) != SpecialChars::CJK_NOBREAK_BEFORE))
current.rememberBreak(i-1, breakPos, style.rightMargin());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentIndex is the glyph cluster index not story text index, you should use current.glyphs[currentIndex - 1].lastChar() and current.glyphs[currentIndex].firstChar(). and make sure i is not zero.

@Fahad-Alsaidi
Copy link
Contributor Author

updated!

@@ -2178,6 +2178,12 @@ void PageItem_TextFrame::layout()
// remember possible break
if (i + 1 < glyphRuns.count() && glyphRuns[i + 1].hasFlag(ScLayout_LineBoundry))
{

if( current.glyphs.length() > 1 && (current.glyphs[currentIndex -1].lastChar() != SpecialChars::CJK_NOBREAK_AFTER) &&

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The space should be before the opening bracket, also there should be spaces around both sides of the minus operator.

This mimic the old stlye in line breaking though we should find a better solution for line breaking in general.
@Fahad-Alsaidi
Copy link
Contributor Author

updated!

@khaledhosny khaledhosny merged commit 7bf5e8c into HOST-Oman:ctl Apr 25, 2016
@khaledhosny khaledhosny mentioned this pull request Apr 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants