You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "chunlinyao (JIRA)" <ji...@apache.org> on 2017/07/10 23:38:00 UTC

[jira] [Created] (FOP-2722) Use letter-spacing.maximum and alignment justification with CJK contents throw Exception

chunlinyao created FOP-2722:
-------------------------------

             Summary: Use letter-spacing.maximum and alignment  justification with CJK contents throw Exception
                 Key: FOP-2722
                 URL: https://issues.apache.org/jira/browse/FOP-2722
             Project: FOP
          Issue Type: Bug
          Components: layout/inline
    Affects Versions: 2.2
            Reporter: chunlinyao


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

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

With CJK contents fop throw Exception

{code:java}
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:?]
 
{code}

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>

{code:java}
    int unsuppressibleLetterSpaces = suppressibleLetterSpace
              ? mapping.letterSpaceCount - 1
              : mapping.letterSpaceCount;
{code}

Should we change it to:
    int unsuppressibleLetterSpaces = (suppressibleLetterSpace &&  mapping.letterSpaceCount > 0)
              ? mapping.letterSpaceCount - 1
              : mapping.letterSpaceCount;




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)