100,35 → 100,35 |
return; |
|
const CharStyle& style = it->itemText.charStyle(firstC); |
if (text.length() >= style.hyphenWordMin()) |
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)) |
{ |
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); |
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) |