| 1 |
Index: source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
|
| 2 |
===================================================================
|
| 3 |
--- lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx (revision 269609)
|
| 4 |
+++ lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx (working copy)
|
| 5 |
@@ -652,18 +652,36 @@
|
| 6 |
OUString hyphenatedWord;
|
| 7 |
nHyphCount = 0;
|
| 8 |
|
| 9 |
+ INT16 nLastChunk=0;
|
| 10 |
+
|
| 11 |
+ //Our postions are relative to the potentially multi-byte encoded string,
|
| 12 |
+ //not the original string, so we need to work in terms of that encoded
|
| 13 |
+ //string when created the hyphenated word
|
| 14 |
+ OString origEncWord(OU2ENC(aWord,aEnc));
|
| 15 |
+
|
| 16 |
for (i = 0; i < encWord.getLength(); i++)
|
| 17 |
{
|
| 18 |
- hyphenatedWordBuffer.append(aWord[i]);
|
| 19 |
if (hyphens[i]&1)
|
| 20 |
{
|
| 21 |
- pPos[nHyphCount] = i;
|
| 22 |
+ //Take potentially multi-byte pending chunk of text and convert back to an OUString,
|
| 23 |
+ //include the current character in the chunk
|
| 24 |
+ hyphenatedWordBuffer.append(rtl::OStringToOUString(origEncWord.copy(nLastChunk,i-nLastChunk+1), aEnc));
|
| 25 |
+
|
| 26 |
+ //Position of current char at pos i of encWord in unicode equivalent, excluding
|
| 27 |
+ //hyphen characters and excluding the current char
|
| 28 |
+ pPos[nHyphCount] = hyphenatedWordBuffer.getLength() - nHyphCount - 1;
|
| 29 |
hyphenatedWordBuffer.append(sal_Unicode('='));
|
| 30 |
nHyphCount++;
|
| 31 |
+ nLastChunk = i+1;
|
| 32 |
}
|
| 33 |
}
|
| 34 |
|
| 35 |
+ //Append remaining potentially multi-byte pending text and convert back to an OUString
|
| 36 |
+ if (nLastChunk < encWord.getLength())
|
| 37 |
+ hyphenatedWordBuffer.append(rtl::OStringToOUString(origEncWord.copy(nLastChunk), aEnc));
|
| 38 |
+
|
| 39 |
hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear();
|
| 40 |
+
|
| 41 |
//fprintf(stderr,"result is %s\n",OU2A(hyphenatedWord));
|
| 42 |
//fflush(stderr);
|
| 43 |
|