You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by kl...@apache.org on 2001/03/04 22:39:54 UTC

cvs commit: xml-fop/src/org/apache/fop/layout BlockArea.java LineArea.java

klease      01/03/04 13:39:54

  Modified:    src/org/apache/fop/layout BlockArea.java LineArea.java
  Log:
  Use new HyphenationProps class
  
  Revision  Changes    Path
  1.27      +8 -25     xml-fop/src/org/apache/fop/layout/BlockArea.java
  
  Index: BlockArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/BlockArea.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- BlockArea.java	2001/02/07 02:02:38	1.26
  +++ BlockArea.java	2001/03/04 21:39:54	1.27
  @@ -1,4 +1,4 @@
  -/*-- $Id: BlockArea.java,v 1.26 2001/02/07 02:02:38 keiron Exp $ --
  +/*-- $Id: BlockArea.java,v 1.27 2001/03/04 21:39:54 klease Exp $ --
   
    ============================================================================
   									 The Apache Software License, Version 1.1
  @@ -99,12 +99,7 @@
       protected boolean hasLines = false;
   
       /*hyphenation*/
  -    protected int hyphenate;
  -    protected char hyphenationChar;
  -    protected int hyphenationPushCharacterCount;
  -    protected int hyphenationRemainCharacterCount;
  -    protected String language;
  -    protected String country;
  +    protected HyphenationProps hyphProps;
   
       protected Vector pendingFootnotes = null;
   
  @@ -174,9 +169,7 @@
           if (currentHeight + this.currentLineArea.getHeight() > maxHeight) {
               return null;
           }
  -        this.currentLineArea.changeHyphenation(language, country,
  -                                               hyphenate, hyphenationChar, hyphenationPushCharacterCount,
  -                                               hyphenationRemainCharacterCount);
  +        this.currentLineArea.changeHyphenation(hyphProps);
           this.hasLines = true;
           return this.currentLineArea;
       }
  @@ -199,9 +192,7 @@
           this.currentLineArea =
             new LineArea(fontState, lineHeight, halfLeading,
                          allocationWidth, startIndent, endIndent, currentLineArea);
  -        this.currentLineArea.changeHyphenation(language, country,
  -                                               hyphenate, hyphenationChar, hyphenationPushCharacterCount,
  -                                               hyphenationRemainCharacterCount);
  +        this.currentLineArea.changeHyphenation(hyphProps);
           if (currentHeight + lineHeight > maxHeight) {
               return null;
           }
  @@ -239,7 +230,8 @@
   
       // KL: I think we should just return startIndent here!
       public int getStartIndent() {
  -        return startIndent + paddingLeft + borderWidthLeft;
  +      //return startIndent + paddingLeft + borderWidthLeft;
  +      return startIndent ;
       }
   
       public void setIndents(int startIndent, int endIndent) {
  @@ -257,17 +249,8 @@
           return halfLeading;
       }
   
  -    public void setHyphenation(String language, String country,
  -                               int hyphenate, char hyphenationChar,
  -                               int hyphenationPushCharacterCount,
  -                               int hyphenationRemainCharacterCount) {
  -        this.language = language;
  -        this.country = country;
  -        this.hyphenate = hyphenate;
  -        this.hyphenationChar = hyphenationChar;
  -        this.hyphenationPushCharacterCount = hyphenationPushCharacterCount;
  -        this.hyphenationRemainCharacterCount =
  -          hyphenationRemainCharacterCount;
  +    public void setHyphenation(HyphenationProps hyphProps) {
  +        this.hyphProps = hyphProps;
       }
   
       public void addFootnote(FootnoteBody fb) {
  
  
  
  1.38      +11 -25    xml-fop/src/org/apache/fop/layout/LineArea.java
  
  Index: LineArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/LineArea.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- LineArea.java	2001/02/27 20:21:48	1.37
  +++ LineArea.java	2001/03/04 21:39:54	1.38
  @@ -1,4 +1,4 @@
  -/*-- $Id: LineArea.java,v 1.37 2001/02/27 20:21:48 fotis Exp $ --
  +/*-- $Id: LineArea.java,v 1.38 2001/03/04 21:39:54 klease Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -96,12 +96,7 @@
       int vAlign;
   
       /*hyphenation*/
  -    protected int hyphenate;
  -    protected char hyphenationChar;
  -    protected int hyphenationPushCharacterCount;
  -    protected int hyphenationRemainCharacterCount;
  -    protected String language;
  -    protected String country;
  +    HyphenationProps hyphProps;
   
       /* the width of text that has definitely made it into the line
          area */
  @@ -421,7 +416,7 @@
                               return wordStart;
                           }
                       } else if (this.wrapOption == WrapOption.WRAP) {
  -                      if (this.hyphenate == Hyphenate.TRUE) {
  +                      if (this.hyphProps.hyphenate == Hyphenate.TRUE) {
                           return this.doHyphenation(data,i,wordStart,this.getContentWidth() - (finalWidth + spaceWidth + pendingWidth));
                         } else {
                           return wordStart;
  @@ -781,18 +776,8 @@
         * and minimum number of character to remain one the previous line and to be on the
         * next line.
         */
  -    public void changeHyphenation(String language, String country,
  -                                  int hyphenate, char hyphenationChar,
  -                                  int hyphenationPushCharacterCount,
  -                                  int hyphenationRemainCharacterCount) {
  -        this.language = language;
  -        this.country = country;
  -        this.hyphenate = hyphenate;
  -        this.hyphenationChar = hyphenationChar;
  -        this.hyphenationPushCharacterCount = hyphenationPushCharacterCount;
  -        this.hyphenationRemainCharacterCount =
  -          hyphenationRemainCharacterCount;
  -
  +    public void changeHyphenation(HyphenationProps hyphProps) {
  +        this.hyphProps = hyphProps;
       }
   
   
  @@ -875,7 +860,7 @@
        */
       public int doHyphenation (char [] characters, int position, int wordStart, int remainingWidth) {
           //check whether the language property has been set
  -        if (this.language.equalsIgnoreCase("none")) {
  +        if (this.hyphProps.language.equalsIgnoreCase("none")) {
             MessageHandler.errorln("if property 'hyphenate' is used, a language must be specified");
             return wordStart;
           }
  @@ -896,7 +881,7 @@
           String wordToHyphenate;
   
           //width of hyphenation character
  -        int hyphCharWidth = this.currentFontState.width(currentFontState.mapChar(this.hyphenationChar));
  +        int hyphCharWidth = this.currentFontState.width(currentFontState.mapChar(this.hyphProps.hyphenationChar));
           remainingWidth -= hyphCharWidth;
   
           //handles ' or " at the beginning of the word
  @@ -924,7 +909,8 @@
           }
   
           //are there any hyphenation points
  -        Hyphenation hyph = Hyphenator.hyphenate(language,country,wordToHyphenate,hyphenationRemainCharacterCount,hyphenationPushCharacterCount);
  +        Hyphenation hyph = Hyphenator.hyphenate(hyphProps.language,
  +						hyphProps.country, wordToHyphenate,hyphProps.hyphenationRemainCharacterCount,hyphProps.hyphenationPushCharacterCount);
           //no hyphenation points and no inword non letter character
           if (hyph == null && preString == null) {
               if (remainingString.length() > 0) {
  @@ -943,7 +929,7 @@
               int index = getFinalHyphenationPoint(hyph,remainingWidth);
               if (index != -1) {
                   remainingString.append(hyph.getPreHyphenText(index));
  -                remainingString.append(this.hyphenationChar);
  +                remainingString.append(this.hyphProps.hyphenationChar);
                   this.addWord(startChar,remainingString);
                   return wordStart + remainingString.length()-1;
               }
  @@ -952,7 +938,7 @@
               int index = getFinalHyphenationPoint(hyph,remainingWidth);
               if (index != -1) {
                 remainingString.append(preString.append(hyph.getPreHyphenText(index)));
  -              remainingString.append(this.hyphenationChar);
  +              remainingString.append(this.hyphProps.hyphenationChar);
                 this.addWord(startChar,remainingString);
                 return wordStart + remainingString.length()-1;
               } else {