pbwest      2004/05/27 08:38:15

  Modified:    src/java/org/apache/fop/fo/flow Tag: FOP_0-20-0_Alt-Design
                        FoPcdata.java
  Log:
  Get fontData object from foTree.
  Construct attriute map for font, getFopFont based on
  atribute map, add text decorations to
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.12  +28 -6     xml-fop/src/java/org/apache/fop/fo/flow/Attic/FoPcdata.java
  
  Index: FoPcdata.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Attic/FoPcdata.java,v
  retrieving revision 1.1.2.11
  retrieving revision 1.1.2.12
  diff -u -r1.1.2.11 -r1.1.2.12
  --- FoPcdata.java     25 May 2004 15:24:10 -0000      1.1.2.11
  +++ FoPcdata.java     27 May 2004 15:38:15 -0000      1.1.2.12
  @@ -20,8 +20,12 @@
   package org.apache.fop.fo.flow;
   
   // FOP
  +import java.awt.Font;
  +import java.awt.font.TextAttribute;
  +import java.text.AttributedString;
   import java.util.Arrays;
   import java.util.BitSet;
  +import java.util.Map;
   
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.datastructs.TreeException;
  @@ -31,6 +35,8 @@
   import org.apache.fop.fo.FObjectNames;
   import org.apache.fop.fo.PropNames;
   import org.apache.fop.fo.PropertySets;
  +import org.apache.fop.fo.expr.PropertyException;
  +import org.apache.fop.fonts.FontException;
   import org.apache.fop.render.FontData;
   import org.apache.fop.xml.XmlEvent;
   
  @@ -134,7 +140,7 @@
           super(foTree, FObjectNames.PCDATA, pageSequence, parent, event,
                             stateFlags, sparsePropsMap, sparseIndices);
           characters = event.getChars();
  -        fontData = foTree.getFontData();
  +
           makeSparsePropsSet();
       }
   
  @@ -153,9 +159,25 @@
        * Generates a TextMeasurer from the PCDATA text.  The font and text
        * attributes of the text are applied.
        */
  -    private void processText() {
  -        // Get the font
  -        
  +    private void processText() throws PropertyException, FontException {
  +        // Get the font, size, style and weight attributes
  +        Map attributes = getFontAttributes();
  +        Font font = getFopFont(attributes);
  +        // Add the text decorations
  +        // TODO separate color support for text decorations
  +        if (decorations.underlined()) {
  +            attributes.put(TextAttribute.UNDERLINE,
  +                    TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
  +        }
  +        if (decorations.overlined()) {
  +            // Not supported yet
  +        }
  +        if (decorations.struckthrough()) {
  +            attributes.put(TextAttribute.STRIKETHROUGH,
  +                    TextAttribute.STRIKETHROUGH_ON);
  +        }
  +        AttributedString attText =
  +            new AttributedString(characters, attributes);
       }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to