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

"Joao Goncalves (Jira)" <[email protected]> Wed, 8 Jul 2026 16:39:00 +0000 (UTC)
Newsgroups gmane.text.xml.fop.devel
Message-ID <[email protected]>
     [ https://issues.apache.org/jira/browse/FOP-2722?page=3Dcom.atlassian.=
jira.plugin.system.issuetabpanels:all-tabpanel ]

Joao Goncalves reassigned FOP-2722:
-----------------------------------

    Assignee: Joao Goncalves

> 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
>            Assignee: Joao Goncalves
>            Priority: Major
>
> I am try to use letter-spacing.maximum to justification CJK contents.
> {code:xml}
>  <fo:block text-align=3D"justify">
>         <fo:inline letter-spacing.optimum=3D"0pt" letter-spacing.maximum=
=3D"2pt">
>              =E7=94=9F=E4=BA=A7=E5=B9=B4
>         </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.addElementsF=
orAWordFragment(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.getNextKnuth=
Elements(TextLayoutManager.java:805) ~[fop-2.2.jar:?]
> =20
> {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 =3D suppressibleLetterSpace
>               ? mapping.letterSpaceCount - 1
>               : mapping.letterSpaceCount;
> {code}
> Should we change it to:
> {code:java}
>     int unsuppressibleLetterSpaces =3D (suppressibleLetterSpace &&  mappi=
ng.letterSpaceCount > 0)
>               ? mapping.letterSpaceCount - 1
>               : mapping.letterSpaceCount;
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)