Hello,

Small question concerning FOP-2860 <https://issues.apache.org/jira/browse/FOP-2860>: I don't really understand the simple-line-breaking fix, why still calling the alg.findBreakingPoints() method twice? Is it relevant to do that?

If not, I think it should be better to only call the forced algorithm in the simpleLineBreaking case, something like:

   |// now try something different||
   ||log.debug("Hyphenation possible? " + canHyphenate);||
   ||boolean simpleLineBreaking =
   fobj.getUserAgent().isSimpleLineBreaking();||
   ||
   ||if (!simpleLineBreaking) {||
   ||    // Note: if allowedBreaks is guaranteed to be unchanged by
   alg.findBreakingPoints(),||
   ||    // the below check can be simplified to 'if (canHyphenate) ...'||
   ||    if (canHyphenate && allowedBreaks !=
   BreakingAlgorithm.ONLY_FORCED_BREAKS) {||
   ||      // consider every hyphenation point as a legal break||
   ||      allowedBreaks = BreakingAlgorithm.ALL_BREAKS;||
   ||    } else {||
   ||      // try with a higher threshold||
   ||      maxAdjustment = 5;||
   ||    }||
   ||
   ||    breakingPoints = alg.findBreakingPoints(currPar,
   maxAdjustment, false, allowedBreaks);||
   ||    if (breakingPoints == 0) {||
   ||      // the second try failed too, try with a huge threshold||
   ||      // and force the algorithm to find a set of breaking points||
   ||      if (log.isDebugEnabled()) {||
   ||        log.debug("No set of breaking points found with
   maxAdjustment = "||
   ||            + maxAdjustment + (canHyphenate ? " and hyphenation" :
   ""));||
   ||      }||
   ||      maxAdjustment = 20;||
   ||      alg.findBreakingPoints(currPar, maxAdjustment, true,
   allowedBreaks);||
   ||    }||
   ||} else {||
   ||    alg.findBreakingPoints(currPar, maxAdjustment, true,
   allowedBreaks);||
   ||}|

Regards,
Julien

Reply via email to