DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27773>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27773

[PATCH] Hyphenation





------- Additional Comments From [EMAIL PROTECTED]  2004-04-05 09:22 -------
Hi all

I apologize for having posted some proposed changes without a line explaining 
what I was changing and why.
Really sorry, I'm going to try and do it now.

First of all, the condition now tested in the 
LineLayoutManager.getNextBreakPoss() to decide whether or not to try 
hyphenation is:
  if (bTextAlignment == TextAlign.JUSTIFY || prevBP == null) {
      ...
  }
So hyphenation is tried for *every* justified block of text; only if 
the "language" attribute is not set the getHyphenContext() method returns null 
and hyphenation is not actually done.
My suggestion is to change it so that the fo property hyphenate (7.9.4 in the 
recommendation, and already implemented in the CommonHyphenation class) is 
tested instead:
  if (hyphProps.hyphenate == Constants.TRUE) {
      ...
  }
In the TextInfo class there is a boolean attribute called "bCanHyphenate", but 
it is given a default value of true, and it is no more modified. It seems to 
me that it is quite useless.
Is is used in the TextLayoutManager.getHyphenIPD() method:
  if (textArray.length < iStopIndex || foText.textInfo.bCanHyphenate == false) 
{
      ...
  }
but this method is called only if context.tryHyphenate() is true; with my 
suggested change, context.tryHyphenate() returns true only if the fo property 
hyphenate is true, and so it is no more necessary to test 
foText.textInfo.bCanHyphenate.

The second problem is that the hyphenation character is not shown: to fix this 
I added in the AreaInfo class (which stores information about the area that 
will be generated) a boolean attribute "bHyphenated".
Is is set according to the value of the flags of the corresponding BreakPoss, 
and it is tested in the TextLayoutManager.addAreas() method to decide whether 
to add the hyphen.

Last (and least): I tried to implement the fo property hyphenation-character 
(7.9.5 in the recommendation).
As it applies to blocks, I thought to store it as a character variable in the 
TextInfo class, with initial value "-".
It is set in the PropertyManager.getTextLayoutProps() method, together with 
the other TextInfo attribute.
Is is used to calculate the hyphIPD in the TextLayoutManager constructor, and 
in the addAreas method.

Bye
    Luca

Reply via email to