r22165 by jghali -
scribus-commit
scribus-commit at lists.scribus.net
Sat Sep 23 21:57:56 UTC 2017
Author: jghali
Date: Sat Sep 23 21:57:56 2017
New Revision: 22165
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22165
Log:
small refactoring of Hyphenator slotHyphenateWord()
Modified:
trunk/Scribus/scribus/hyphenator.cpp
Modified: trunk/Scribus/scribus/hyphenator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22165&path=/trunk/Scribus/scribus/hyphenator.cpp
==============================================================================
--- trunk/Scribus/scribus/hyphenator.cpp (original)
+++ trunk/Scribus/scribus/hyphenator.cpp Sat Sep 23 21:57:56 2017
@@ -100,35 +100,35 @@
return;
const CharStyle& style = it->itemText.charStyle(firstC);
- if (text.length() >= style.hyphenWordMin())
- {
- bool ok = loadDict(style.language());
- if (!ok)
- return;
-
- QByteArray te = m_codec->fromUnicode(text);
- char *buffer = static_cast<char*>(malloc(te.length() + 5));
- if (buffer == NULL)
- return;
- char **rep = NULL;
- int *pos = NULL;
- int *cut = NULL;
- // TODO: support non-standard hyphenation, see hnj_hyphen_hyphenate2 docs
- if (!hnj_hyphen_hyphenate2(m_hdict, te.data(), te.length(), buffer, NULL, &rep, &pos, &cut))
- {
- buffer[te.length()] = '\0';
- it->itemText.hyphenateWord(firstC, text.length(), buffer);
- }
- free(buffer);
- if (rep)
- {
- for (int i = 0; i < te.length() - 1; ++i)
- free(rep[i]);
- }
- free(rep);
- free(pos);
- free(cut);
- }
+ if (text.length() < style.hyphenWordMin())
+ return;
+
+ bool ok = loadDict(style.language());
+ if (!ok)
+ return;
+
+ QByteArray te = m_codec->fromUnicode(text);
+ char *buffer = static_cast<char*>(malloc(te.length() + 5));
+ if (buffer == NULL)
+ return;
+ char **rep = NULL;
+ int *pos = NULL;
+ int *cut = NULL;
+ // TODO: support non-standard hyphenation, see hnj_hyphen_hyphenate2 docs
+ if (!hnj_hyphen_hyphenate2(m_hdict, te.data(), te.length(), buffer, NULL, &rep, &pos, &cut))
+ {
+ buffer[te.length()] = '\0';
+ it->itemText.hyphenateWord(firstC, text.length(), buffer);
+ }
+ free(buffer);
+ if (rep)
+ {
+ for (int i = 0; i < te.length() - 1; ++i)
+ free(rep[i]);
+ }
+ free(rep);
+ free(pos);
+ free(cut);
}
void Hyphenator::slotHyphenate(PageItem* it)
More information about the scribus-commit
mailing list