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

Use letter-spacing.maximum and alignment justification with CJK contents throw Exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.2
    • None
    • layout/inline
    • None

    Description

      I am try to use letter-spacing.maximum to justification CJK contents.

       <fo:block text-align="justify">
              <fo:inline letter-spacing.optimum="0pt" letter-spacing.maximum="2pt">
                   生产年
              </fo:inline>
      </fo:block>
      

      With CJK contents fop throw Exception

      Caused by: java.lang.IllegalArgumentException: factor < 0; was: -1
              at org.apache.fop.traits.MinOptMax.mult(MinOptMax.java:253) ~[fop-2.2.jar:?]
              at org.apache.fop.layoutmgr.inline.TextLayoutManager.addElementsForAWordFragment(TextLayoutManager.java:1331) ~[fop-2.2.jar:?]
              at org.apache.fop.layoutmgr.inline.TextLayoutManager.processWord(TextLayoutManager.java:947) ~[fop-2.2.jar:?]
              at org.apache.fop.layoutmgr.inline.TextLayoutManager.getNextKnuthElements(TextLayoutManager.java:805) ~[fop-2.2.jar:?]
       
      

      After some debug I found on TextLayoutManager.java:1325 it set factor to -1.
      <https://github.com/apache/fop/blob/ddeba2b442/fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java#L1325>

          int unsuppressibleLetterSpaces = suppressibleLetterSpace
                    ? mapping.letterSpaceCount - 1
                    : mapping.letterSpaceCount;
      

      Should we change it to:

          int unsuppressibleLetterSpaces = (suppressibleLetterSpace &&  mapping.letterSpaceCount > 0)
                    ? mapping.letterSpaceCount - 1
                    : mapping.letterSpaceCount;
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            chunlinyao chunlinyao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: