Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-1772

Hyphenation results don't always equal OpenOffice result even with the same patterns

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Resolution: Unresolved
    • 0.95
    • None
    • unqualified
    • None
    • Operating System: Windows XP
      Platform: PC
    • 48745

    Description

      As already known, the hyphenation library has some problems with patterns who contain numbers like 7 or 8. I realized that HyphenationTree.unpackValues(int) extracts the characters ( and ' for these values. They differ by exactly 16 character positions in ASCII table. Following code changes transforms these characters into the right ones:

      protected String unpackValues(int k) {
      StringBuilder buf = new StringBuilder();
      byte v = this.vspace.get(k++);
      while (v != 0) {
      char c = (char)((v >>> 4) - 1 + '0');
      if (!Character.isDigit(c))

      { /* #21219: Bug fixed which sometimes occurs. Just * shift the ASCII position by a correction offset. */ c += 16; }

      buf.append(c);
      c = (char)(v & 0x0f);
      if (c == 0)

      { break; }

      c = (char)(c - 1 + '0');
      if (!Character.isDigit(c))

      { /* #21219: Bug fixed which sometimes occurs. Just * shift the ASCII position by a correction offset. */ c += 16; }

      buf.append(c);
      v = this.vspace.get(k++);
      }
      return buf.toString();
      }

      But there's another problem which could be experienced in languages with common occurences of these two digits in patterns. Please compare the hyphenation result of the German word, "Flickenteppich", (Pattern: .fli7ck8en7tep7pic8h) with OpenOffice's result. OpenOffice doesn't generate a hyphenation like "Flick-enteppich". But FOP does it, even with the cheap bug fix above. There's an explicit prohibition at this word's position by the concerning pattern. Other implementations of Liang's algorithm do notice this rule (see http://www.davidashen.net/texhyphj.html or LibHnj used by OpenOffice).

      My question is: Is this issue known? If yes, are there any existing trackers concerning this bug? When will this be fixed?

      Best regards

      PAX

      Attachments

        1. hyph.patch
          1 kB
          Carlos Villegas
        2. hyph_de_DE.fop
          57 kB
          Andreas 'PAX' Lück

        Activity

          People

            Unassigned Unassigned
            onkelpax-fop@yahoo.de Andreas 'PAX' Lück
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: