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 to...@apache.org on 2001/08/02 21:38:08 UTC

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

tore        01/08/02 12:38:08

  Modified:    src/org/apache/fop/layout LineArea.java
  Log:
  Submitted by:	Struan Judd (struan@sjudd.com)
  Fixes bug that causes character - glyph mapping to occur twice in getWordWidth
  method causing overlapping areas.
  
  Revision  Changes    Path
  1.49      +5 -20     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.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- LineArea.java	2001/08/01 09:52:43	1.48
  +++ LineArea.java	2001/08/02 19:38:08	1.49
  @@ -1,5 +1,5 @@
   /*
  - * $Id: LineArea.java,v 1.48 2001/08/01 09:52:43 tore Exp $
  + * $Id: LineArea.java,v 1.49 2001/08/02 19:38:08 tore Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -989,35 +989,20 @@
           return wordStart;
       }
   
  -    /**
  -     * Calculates the wordwidth of a string by first mapping the
  -     * characteers in the string to glyphs in the current fontstate.
  -     */
  -    private int getWordWidth(String word) {
  -        return getWordWidth(word, true);
  -    }
   
       /**
  -     * calculates the wordWidth using the actual fontstate
  -     * @param doMap if true, map the charaters in the string to glyphs in
  -     * the current fontstate before calculating width. If false,
  -     * assume that it's already done.
  +     * Calculates the wordWidth using the actual fontstate
        */
  -    private int getWordWidth(String word, boolean doMap) {
  +    private int getWordWidth(String word) {
           if (word == null)
               return 0;
           int wordLength = word.length();
           int width = 0;
           char[] characters = new char[wordLength];
           word.getChars(0, wordLength, characters, 0);
  -        char currentChar;
  -        for (int i = 0; i < wordLength; i++) {
  -            if (doMap)
  -                currentChar = currentFontState.mapChar(characters[i]);
  -            else
  -                currentChar = characters[i];
   
  -            width += getCharWidth(currentChar);
  +        for (int i = 0; i < wordLength; i++) {
  +            width += getCharWidth(characters[i]);
           }
           return width;
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org