From d2dc7334af18d611a301fd4fe96237a68ff3e8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20N=C3=A9meth?= Date: Thu, 13 Sep 2012 07:50:50 +0000 Subject: [PATCH] fdo#43931 (hard hyphen hyphenation) + fdo#54843 (rhmin fix) --- ChangeLog | 11 ++++++++++- NEWS | 5 +++++ hyphen.c | 12 ++++++------ tests/rhmin.hyph | 1 + tests/rhmin.pat | 1 + tests/rhmin.word | 1 + 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e7d3738..057d91a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,13 @@ -2010-07-18 Caolán McNamara : +2012-09-13 László Németh : + * hyphen.c: fdo#43931: removing hard hyphen hyphenation for LibreOffice + + * tests/rhmin.*: add Telugu test example for rhmin fix + +2012-09-11 Steven Dickson : + * hyphen.c: fdo#54843: rhmin fix for words with 3-byte or more UTF-8 + multibyte characters + +2012-07-18 Caolán McNamara : * coverity warnings 2011-10-10 László Németh : diff --git a/NEWS b/NEWS index 2d7e4ec..aa7f46b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +2012-09-13 Hyphen 2.8.6: + - righthyphenmin fix for 3-byte or more UTF-8 + multibyte characters by Steven Dickson + - fix for fdo#43931 (removing hard hyphen hyphenation for LibreOffice) + 2012-07-12 Hyphen 2.8.5: - fix short alloc diff --git a/hyphen.c b/hyphen.c index e4cc3b5..6b1d826 100644 --- a/hyphen.c +++ b/hyphen.c @@ -436,9 +436,9 @@ for (k = 0; k < 2; k++) { } } else if (k == 1) { /* default first level: hyphen and ASCII apostrophe */ - if (!dict[0]->utf8) hnj_hyphen_load_line("NOHYPHEN '\n", dict[k], hashtab); - else hnj_hyphen_load_line("NOHYPHEN ',\xe2\x80\x93,\xe2\x80\x99\n", dict[k], hashtab); - strncpy(buf, "1-1/=,1,1\n", MAX_CHARS-1); // buf rewritten by hnj_hyphen_load here + if (!dict[0]->utf8) hnj_hyphen_load_line("NOHYPHEN ',-\n", dict[k], hashtab); + else hnj_hyphen_load_line("NOHYPHEN ',\xe2\x80\x93,\xe2\x80\x99,-\n", dict[k], hashtab); + strncpy(buf, "1-1\n", MAX_CHARS-1); // buf rewritten by hnj_hyphen_load here buf[MAX_CHARS-1] = '\0'; hnj_hyphen_load_line(buf, dict[k], hashtab); /* remove hyphen */ hnj_hyphen_load_line("1'1\n", dict[k], hashtab); /* ASCII apostrophe */ @@ -734,13 +734,13 @@ int hnj_hyphen_lhmin(int utf8, const char *word, int word_size, char * hyphens, int hnj_hyphen_rhmin(int utf8, const char *word, int word_size, char * hyphens, char *** rep, int ** pos, int ** cut, int rhmin) { - int i = 1; + int i = 0; int j; // ignore numbers for (j = word_size - 1; j > 0 && word[j] <= '9' && word[j] >= '0'; j--) i--; - for (j = word_size - 2; i < rhmin && j > 0; j--) { + for (j = word_size - 1; i < rhmin && j > 0; j--) { // check length of the non-standard part if (*rep && *pos && *cut && (*rep)[j]) { char * rh = strchr((*rep)[j], '='); @@ -753,7 +753,7 @@ int hnj_hyphen_rhmin(int utf8, const char *word, int word_size, char * hyphens, } else { hyphens[j] = '0'; } - if (!utf8 || (word[j] & 0xc0) != 0xc0) i++; + if (!utf8 || (word[j] & 0xc0) == 0xc0 || (word[j] & 0x80) != 0x80) i++; } return 0; } diff --git a/tests/rhmin.hyph b/tests/rhmin.hyph index 2fe18d3..637dd64 100644 --- a/tests/rhmin.hyph +++ b/tests/rhmin.hyph @@ -1 +1,2 @@ övéit +అం=గ=డిధర diff --git a/tests/rhmin.pat b/tests/rhmin.pat index 862c488..108163f 100644 --- a/tests/rhmin.pat +++ b/tests/rhmin.pat @@ -2,3 +2,4 @@ UTF-8 RIGHTHYPHENMIN 3 % test patterns for righthyphenmin fix for UTF-8 patterns övé1it +అం1గ1డి1ధర diff --git a/tests/rhmin.word b/tests/rhmin.word index 2fe18d3..1dd8273 100644 --- a/tests/rhmin.word +++ b/tests/rhmin.word @@ -1 +1,2 @@ övéit +అంగడిధర