Bug 9930 - Error in hyphenation algorithm
Summary: Error in hyphenation algorithm
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: page-master/layout (show other bugs)
Version: all
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-17 19:18 UTC by Marcelo Jaccoud Amaral
Modified: 2012-04-01 07:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcelo Jaccoud Amaral 2002-06-17 19:18:50 UTC
In class HyphenationTree, method 
    public Hyphenation hyphenate(char[] w, int offset, int 
len,
                                 int remainCharCount, int pushCharCount)
the value for pushCharCount, i.e., the 
minimum number of characters after the last hyphen, is not used properly. The test for the 
hyphenation points is
                if (((il[i + 1] & 1) == 1) && i >= remainCharCount
                        && i < (len - 
pushCharCount)) {...}
but it should be
                if (((il[i + 1] & 1) == 1) && i >= remainCharCount
                        && i 
<= (len - pushCharCount)) {...}
                            ^^^^
This bug makes the program assume the right limit is 1 unit 
higher than specified, preventing hyphens to appear where they can. I developed a Portuguese 
hyphenation table and this bug did not allow it to work correctly. I had to write <hyphen-min 
before="2" after="1"/> instead of <hyphen-min before="2" after="2"/> to get around the bug. I 
will gladly submit the table but it will only work properly if this bug is fixed. (Well, the other 
tables are not working properly too.)
To observe the error, simply try to hyphenate "banana". 
In English you get "ba-nana" instead of the correct (?) "ba-nan-a" (jeez, hyphenation in English is a 
complete madness...) even with after="1". In Spanish (and in the original Portuguese, from a 
obscure origin) you get the same "ba-nana" instead of the correct (!) "ba-na-na", unless you 
deviously use after="1".
Comment 1 Glenn Adams 2012-04-01 07:05:00 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed