keiron      2002/07/23 04:06:51

  Modified:    src/org/apache/fop/apps LayoutHandler.java
               src/org/apache/fop/area Trait.java
               src/org/apache/fop/fo PropertyManager.java Title.java
               src/org/apache/fop/layout FontInfo.java FontState.java
               src/org/apache/fop/layoutmgr TextBPLayoutManager.java
                        TextLayoutManager.java
               src/org/apache/fop/render/awt FontSetup.java
               src/org/apache/fop/render/pdf FontSetup.java
                        PDFRenderer.java PDFXMLHandler.java
               src/org/apache/fop/tools AreaTreeBuilder.java
  Log:
  cleaned up the font state a bit
  exception only thrown after setup as exception indicates invalid setup
  only font name key and size are set on the area tree
  FontState used as handler to get metric info
  
  Revision  Changes    Path
  1.3       +4 -0      xml-fop/src/org/apache/fop/apps/LayoutHandler.java
  
  Index: LayoutHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/LayoutHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LayoutHandler.java        18 Jul 2002 09:43:20 -0000      1.2
  +++ LayoutHandler.java        23 Jul 2002 11:06:50 -0000      1.3
  @@ -100,6 +100,10 @@
   
           try {
               renderer.setupFontInfo(fontInfo);
  +            // check that the "any,normal,400" font exists
  +            if(!fontInfo.isSetupValid()) {
  +                throw new SAXException(new FOPException("no default font defined by 
OutputConverter"));
  +            }
               renderer.startRenderer(outputStream);
           } catch (IOException e) {
               throw new SAXException(e);
  
  
  
  1.3       +3 -14     xml-fop/src/org/apache/fop/area/Trait.java
  
  Index: Trait.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Trait.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Trait.java        26 May 2002 15:02:42 -0000      1.2
  +++ Trait.java        23 Jul 2002 11:06:50 -0000      1.3
  @@ -21,10 +21,8 @@
       public static final Integer ID_LINK = new Integer(0);
       public static final Integer INTERNAL_LINK =  new Integer(1); //resolved
       public static final Integer EXTERNAL_LINK =  new Integer(2);
  -    public static final Integer FONT_FAMILY =  new Integer(3);
  +    public static final Integer FONT_NAME =  new Integer(3);
       public static final Integer FONT_SIZE =  new Integer(4);
  -    public static final Integer FONT_WEIGHT =  new Integer(5);
  -    public static final Integer FONT_STYLE =  new Integer(6);
       public static final Integer COLOR =  new Integer(7);
       public static final Integer ID_AREA =  new Integer(8);
       public static final Integer BACKGROUND =  new Integer(9);
  @@ -42,8 +40,6 @@
       public static final Integer PADDING_BEFORE =  new Integer(21);
       public static final Integer PADDING_AFTER =  new Integer(22);
   
  -    public static final Integer FONT_STATE =  new Integer(100);
  -
       static HashMap s_hmTraitInfo;
   
       private static class TraitInfo {
  @@ -64,14 +60,10 @@
                           new TraitInfo("internal-link", String.class));
        s_hmTraitInfo.put(EXTERNAL_LINK,
                           new TraitInfo("external-link", String.class));
  -     s_hmTraitInfo.put(FONT_FAMILY,
  +     s_hmTraitInfo.put(FONT_NAME,
                           new TraitInfo("font-family", String.class));
        s_hmTraitInfo.put(FONT_SIZE,
                           new TraitInfo("font-size", Integer.class));
  -     s_hmTraitInfo.put(FONT_WEIGHT,
  -                        new TraitInfo("font-weight", Integer.class));
  -     s_hmTraitInfo.put(FONT_STYLE,
  -                        new TraitInfo("font-style", String.class));
        s_hmTraitInfo.put(COLOR,
                           new TraitInfo("color", String.class));
        s_hmTraitInfo.put(ID_AREA,
  @@ -104,9 +96,6 @@
                           new TraitInfo("padding-before", Integer.class));
        s_hmTraitInfo.put(PADDING_AFTER,
                           new TraitInfo("padding-after", Integer.class));
  -
  -     s_hmTraitInfo.put(FONT_STATE,
  -                        new TraitInfo("font-state", FontState.class));
       }
   
       public static String getTraitName(Object traitCode) {
  
  
  
  1.13      +26 -12    xml-fop/src/org/apache/fop/fo/PropertyManager.java
  
  Index: PropertyManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/PropertyManager.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PropertyManager.java      20 Jun 2002 09:14:12 -0000      1.12
  +++ PropertyManager.java      23 Jul 2002 11:06:50 -0000      1.13
  @@ -14,6 +14,7 @@
   import org.apache.fop.fo.TextInfo; // should be somewhere else probably...
   import org.apache.fop.layout.FontState;
   import org.apache.fop.layout.FontInfo;
  +import org.apache.fop.layout.FontMetric;
   import org.apache.fop.layout.BorderAndPadding;
   import org.apache.fop.layout.MarginProps;
   import org.apache.fop.layout.MarginInlineProps;
  @@ -68,7 +69,7 @@
       }
   
   
  -    public FontState getFontState(FontInfo fontInfo) throws FOPException {
  +    public FontState getFontState(FontInfo fontInfo) {
           if (fontState == null) {
            if (fontInfo == null) {
                fontInfo = m_fontInfo;
  @@ -78,14 +79,33 @@
            }
               String fontFamily = properties.get("font-family").getString();
               String fontStyle = properties.get("font-style").getString();
  -            String fontWeight = properties.get("font-weight").getString();
  +            String fw = properties.get("font-weight").getString();
  +            int fontWeight = 400;
  +            if(fw.equals("bolder")) {
  +                // +100 from inherited
  +            } else if(fw.equals("lighter")) {
  +                // -100 from inherited
  +            } else {
  +                try {
  +                    fontWeight = Integer.parseInt(fw);
  +                } catch(NumberFormatException nfe) {
  +                }
  +            }
  +            fontWeight = ((int)fontWeight / 100) * 100;
  +            if(fontWeight < 100) {
  +                fontWeight = 100;
  +            } else if(fontWeight > 900) {
  +                fontWeight = 900;
  +            }
  +
               // NOTE: this is incomplete. font-size may be specified with
               // various kinds of keywords too
               int fontSize = properties.get("font-size").getLength().mvalue();
               int fontVariant = properties.get("font-variant").getEnum();
  -            // fontInfo is same for the whole FOP run but set in all FontState
  -            fontState = new FontState(fontInfo, fontFamily, fontStyle,
  -                                      fontWeight, fontSize, fontVariant);
  +            String fname = fontInfo.fontLookup(fontFamily, fontStyle,
  +                                               fontWeight);
  +            FontMetric metrics = fontInfo.getMetricsFor(fname);
  +            fontState = new FontState(fname, metrics, fontSize);
           }
           return fontState;
       }
  @@ -299,13 +319,7 @@
       public TextInfo getTextLayoutProps(FontInfo fontInfo) {
        if (textInfo == null) {
            textInfo = new TextInfo();
  -         try {
                textInfo.fs = getFontState(fontInfo);
  -         } catch (FOPException fopex) {
  -             /* log.error("Error setting FontState for characters: " +
  -                fopex.getMessage());*/
  -             // Now what should we do ???
  -         }
            textInfo.color = properties.get("color").getColorType();
   
            textInfo.verticalAlign =
  
  
  
  1.9       +2 -2      xml-fop/src/org/apache/fop/fo/Title.java
  
  Index: Title.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Title.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Title.java        18 Jul 2002 09:43:20 -0000      1.8
  +++ Title.java        23 Jul 2002 11:06:50 -0000      1.9
  @@ -44,7 +44,7 @@
           BackgroundProps bProps = propMgr.getBackgroundProps();
   
           // Common Font Properties
  -        //FontState fontState = propMgr.getFontState(structHandler.getFontInfo());
  +        FontState fontState = propMgr.getFontState(structHandler.getFontInfo());
   
           // Common Margin Properties-Inline
           MarginInlineProps mProps = propMgr.getMarginInlineProps();
  
  
  
  1.17      +95 -40    xml-fop/src/org/apache/fop/layout/FontInfo.java
  
  Index: FontInfo.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/FontInfo.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- FontInfo.java     8 Jan 2002 09:52:17 -0000       1.16
  +++ FontInfo.java     23 Jul 2002 11:06:50 -0000      1.17
  @@ -9,9 +9,19 @@
   
   import java.util.HashMap;
   
  -import org.apache.fop.apps.FOPException;
  -
  +/**
  + * The fontinfo for the layout and rendering of a fo document.
  + * This stores the list of available fonts that are setup by
  + * the renderer. The font name can be retrieved for the
  + * family style and weight.
  + * Currently font supported font-variant small-caps is not
  + * implemented.
  + */
   public class FontInfo {
  +    public static final String DEFAULT_FONT = "any,normal,400";
  +    public static final int NORMAL = 400;
  +    public static final int BOLD = 700;
  +
       HashMap usedFonts;
       HashMap triplets;    // look up a font-triplet to find a font-name
       HashMap fonts;    // look up a font-name to get a font (that implements 
FontMetric at least)
  @@ -22,8 +32,12 @@
           this.usedFonts = new HashMap();
       }
   
  +    public boolean isSetupValid() {
  +        return triplets.containsKey(DEFAULT_FONT);
  +    }
  +
       public void addFontProperties(String name, String family, String style,
  -                                  String weight) {
  +                                  int weight) {
           /*
            * add the given family, style and weight as a lookup for the font
            * with the given name
  @@ -39,56 +53,92 @@
           this.fonts.put(name, metrics);
       }
   
  +    /**
  +     * Lookup a font.
  +     * Locate the font name for a given familyi, style and weight.
  +     * The font name can then be used as a key as it is unique for
  +     * the associated document.
  +     * This also adds the font to the list of used fonts.
  +     */
       public String fontLookup(String family, String style,
  -                             String weight) throws FOPException {
  -        return fontLookup(createFontKey(family, style, weight));
  -    }
  -
  -    public String fontLookup(String key) throws FOPException {
  +                             int weight) {
  +        String key;
  +        // first try given parameters
  +        key = createFontKey(family, style, weight);
  +        String f = (String)triplets.get(key);
  +        if(f == null) {
  +            // then adjust weight, favouring normal or bold
  +            f = findAdjustWeight(family, style, weight);
  +
  +            // then try any family with orig weight
  +            if(f == null) {
  +                key = createFontKey("any", style, weight);
  +                f = (String)triplets.get(key);
  +            }
   
  -        String f = (String)this.triplets.get(key);
  -        if (f == null) {
  -            int i = key.indexOf(',');
  -            String s = "any" + key.substring(i);
  -            f = (String)this.triplets.get(s);
  -            if (f == null) {
  -                f = (String)this.triplets.get("any,normal,normal");
  -                if (f == null) {
  -                    throw new FOPException("no default font defined by 
OutputConverter");
  -                }
  -                //log.error("defaulted font to any,normal,normal");
  +            // then try any family with adjusted weight
  +            if(f == null) {
  +                f = findAdjustWeight(family, style, weight);
               }
  -            //log.error("unknown font " + key
  -            //                       + " so defaulted font to any");
  +
  +            // then use default
  +            f = (String)triplets.get(DEFAULT_FONT);
  +
           }
   
           usedFonts.put(f, fonts.get(f));
           return f;
       }
   
  -    public boolean hasFont(String family, String style, String weight) {
  +    /**
  +     * Find a font with a given family and style by trying
  +     * different font weights according to the spec.
  +     */
  +    public String findAdjustWeight(String family, String style,
  +                             int weight) {
  +        String key;
  +        String f = null;
  +        int newWeight = weight;
  +        if(newWeight < 400) {
  +            while(f == null && newWeight > 0) {
  +                newWeight -= 100;
  +                key = createFontKey(family, style, newWeight);
  +                f = (String)triplets.get(key);
  +            }
  +        } else if(newWeight == 500) {
  +            key = createFontKey(family, style, 400);
  +            f = (String)triplets.get(key);
  +        } else if(newWeight > 500) {
  +            while(f == null && newWeight < 1000) {
  +                newWeight += 100;
  +                key = createFontKey(family, style, newWeight);
  +                f = (String)triplets.get(key);
  +            }
  +            newWeight = weight;
  +            while(f == null && newWeight > 400) {
  +                newWeight -= 100;
  +                key = createFontKey(family, style, newWeight);
  +                f = (String)triplets.get(key);
  +            }
  +        }
  +        if(f == null) {
  +            key = createFontKey(family, style, 400);
  +            f = (String)triplets.get(key);
  +        }
  +
  +        return f;
  +    }
  +
  +    public boolean hasFont(String family, String style, int weight) {
           String key = createFontKey(family, style, weight);
  -        return this.triplets.get(key) != null;
  +        return this.triplets.containsKey(key);
       }
   
       /**
        * Creates a key from the given strings
        */
       public static String createFontKey(String family, String style,
  -                                       String weight) {
  -        int i;
  -
  -        try {
  -            i = Integer.parseInt(weight);
  -        } catch (NumberFormatException e) {
  -            i = 0;
  -        }
  -
  -        if (i > 600)
  -            weight = "bold";
  -        else if (i > 0)
  -            weight = "normal";
  -
  +                                       int weight) {
           return family + "," + style + "," + weight;
       }
   
  @@ -96,13 +146,18 @@
           return this.fonts;
       }
   
  +    /**
  +     * This is used by the renderers to retrieve all the
  +     * fonts used in the document.
  +     * This is for embedded font or creating a list of used fonts.
  +     */
       public HashMap getUsedFonts() {
           return this.usedFonts;
       }
   
  -    public FontMetric getMetricsFor(String fontName) throws FOPException {
  +    public FontMetric getMetricsFor(String fontName) {
           usedFonts.put(fontName, fonts.get(fontName));
           return (FontMetric)fonts.get(fontName);
       }
  -
   }
  +
  
  
  
  1.19      +5 -34     xml-fop/src/org/apache/fop/layout/FontState.java
  
  Index: FontState.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/FontState.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- FontState.java    28 Jun 2002 07:52:54 -0000      1.18
  +++ FontState.java    23 Jul 2002 11:06:50 -0000      1.19
  @@ -9,18 +9,16 @@
   
   import java.util.HashMap;
   
  -import org.apache.fop.apps.FOPException;
   import org.apache.fop.fo.properties.FontVariant;
   import org.apache.fop.render.pdf.CodePointMapping;
   
   public class FontState {
   
  -    private FontInfo _fontInfo;
       private String _fontName;
       private int _fontSize;
       private String _fontFamily;
       private String _fontStyle;
  -    private String _fontWeight;
  +    private int _fontWeight;
       private int _fontVariant;
   
       private FontMetric _metric;
  @@ -28,17 +26,10 @@
       private static HashMap EMPTY_HASHMAP = new HashMap();
   
   
  -    public FontState(FontInfo fontInfo, String fontFamily, String fontStyle,
  -                     String fontWeight, int fontSize,
  -                     int fontVariant) throws FOPException {
  -        _fontInfo = fontInfo;
  -        _fontFamily = fontFamily;
  -        _fontStyle = fontStyle;
  -        _fontWeight = fontWeight;
  +    public FontState(String key, FontMetric met, int fontSize) {
           _fontSize = fontSize;
  -        _fontName = fontInfo.fontLookup(fontFamily, fontStyle, fontWeight);
  -        _metric = fontInfo.getMetricsFor(_fontName);
  -        _fontVariant = fontVariant;
  +        _fontName = key;
  +        _metric = met;
       }
   
       public int getAscender() {
  @@ -59,26 +50,6 @@
   
       public int getFontSize() {
           return _fontSize;
  -    }
  -
  -    public String getFontWeight() {
  -        return _fontWeight;
  -    }
  -
  -    public String getFontFamily() {
  -        return _fontFamily;
  -    }
  -
  -    public String getFontStyle() {
  -        return _fontStyle;
  -    }
  -
  -    public int getFontVariant() {
  -        return _fontVariant;
  -    }
  -
  -    public FontInfo getFontInfo() {
  -        return _fontInfo;
       }
   
       public int getXHeight() {
  
  
  
  1.7       +3 -3      xml-fop/src/org/apache/fop/layoutmgr/TextBPLayoutManager.java
  
  Index: TextBPLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/TextBPLayoutManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TextBPLayoutManager.java  18 Jun 2002 11:27:36 -0000      1.6
  +++ TextBPLayoutManager.java  23 Jul 2002 11:06:51 -0000      1.7
  @@ -527,8 +527,8 @@
           curWordArea.info.blOffset = true;
   
           curWordArea.setWord(str);
  -        //curWordArea.addTrait(new Trait(Trait.FONT_STATE, textInfo.fs));
  -        curWordArea.addTrait(Trait.FONT_STATE, textInfo.fs);
  +        curWordArea.addTrait(Trait.FONT_NAME, textInfo.fs.getFontName());
  +        curWordArea.addTrait(Trait.FONT_SIZE, new 
Integer(textInfo.fs.getFontSize()));
           return curWordArea;
       }
   
  
  
  
  1.9       +2 -2      xml-fop/src/org/apache/fop/layoutmgr/TextLayoutManager.java
  
  Index: TextLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/TextLayoutManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TextLayoutManager.java    26 May 2002 15:02:43 -0000      1.8
  +++ TextLayoutManager.java    23 Jul 2002 11:06:51 -0000      1.9
  @@ -247,7 +247,7 @@
   
           curWordArea.setWord(str);
           // curWordArea.addTrait(new Trait(Trait.FONT_STATE, textInfo.fs));
  -        curWordArea.addTrait(Trait.FONT_STATE, textInfo.fs);
  +        //curWordArea.addTrait(Trait.FONT_STATE, textInfo.fs);
           return curWordArea;
       }
   
  
  
  
  1.5       +63 -72    xml-fop/src/org/apache/fop/render/awt/FontSetup.java
  
  Index: FontSetup.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/awt/FontSetup.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FontSetup.java    22 Nov 2001 07:11:41 -0000      1.4
  +++ FontSetup.java    23 Jul 2002 11:06:51 -0000      1.5
  @@ -102,83 +102,74 @@
           // fontInfo.addMetrics("F17", new BauerBodoniBoldItalic());
   
           /* any is treated as serif */
  -        fontInfo.addFontProperties("F5", "any", "normal", "normal");
  -        fontInfo.addFontProperties("F6", "any", "italic", "normal");
  -        fontInfo.addFontProperties("F6", "any", "oblique", "normal");
  -        fontInfo.addFontProperties("F7", "any", "normal", "bold");
  -        fontInfo.addFontProperties("F8", "any", "italic", "bold");
  -        fontInfo.addFontProperties("F8", "any", "oblique", "bold");
  -
  -        fontInfo.addFontProperties("F1", "sans-serif", "normal", "normal");
  -        fontInfo.addFontProperties("F2", "sans-serif", "oblique", "normal");
  -        fontInfo.addFontProperties("F2", "sans-serif", "italic", "normal");
  -        fontInfo.addFontProperties("F3", "sans-serif", "normal", "bold");
  -        fontInfo.addFontProperties("F4", "sans-serif", "oblique", "bold");
  -        fontInfo.addFontProperties("F4", "sans-serif", "italic", "bold");
  -        fontInfo.addFontProperties("F5", "serif", "normal", "normal");
  -        fontInfo.addFontProperties("F6", "serif", "oblique", "normal");
  -        fontInfo.addFontProperties("F6", "serif", "italic", "normal");
  -        fontInfo.addFontProperties("F7", "serif", "normal", "bold");
  -        fontInfo.addFontProperties("F8", "serif", "oblique", "bold");
  -        fontInfo.addFontProperties("F8", "serif", "italic", "bold");
  -        fontInfo.addFontProperties("F9", "monospace", "normal", "normal");
  -        fontInfo.addFontProperties("F10", "monospace", "oblique", "normal");
  -        fontInfo.addFontProperties("F10", "monospace", "italic", "normal");
  -        fontInfo.addFontProperties("F11", "monospace", "normal", "bold");
  -        fontInfo.addFontProperties("F12", "monospace", "oblique", "bold");
  -        fontInfo.addFontProperties("F12", "monospace", "italic", "bold");
  -
  -        fontInfo.addFontProperties("F1", "Helvetica", "normal", "normal");
  -        fontInfo.addFontProperties("F2", "Helvetica", "oblique", "normal");
  -        fontInfo.addFontProperties("F2", "Helvetica", "italic", "normal");
  -        fontInfo.addFontProperties("F3", "Helvetica", "normal", "bold");
  -        fontInfo.addFontProperties("F4", "Helvetica", "oblique", "bold");
  -        fontInfo.addFontProperties("F4", "Helvetica", "italic", "bold");
  -        fontInfo.addFontProperties("F5", "Times", "normal", "normal");
  -        fontInfo.addFontProperties("F6", "Times", "oblique", "normal");
  -        fontInfo.addFontProperties("F6", "Times", "italic", "normal");
  -        fontInfo.addFontProperties("F7", "Times", "normal", "bold");
  -        fontInfo.addFontProperties("F8", "Times", "oblique", "bold");
  -        fontInfo.addFontProperties("F8", "Times", "italic", "bold");
  -        fontInfo.addFontProperties("F9", "Courier", "normal", "normal");
  -        fontInfo.addFontProperties("F10", "Courier", "oblique", "normal");
  -        fontInfo.addFontProperties("F10", "Courier", "italic", "normal");
  -        fontInfo.addFontProperties("F11", "Courier", "normal", "bold");
  -        fontInfo.addFontProperties("F12", "Courier", "oblique", "bold");
  -        fontInfo.addFontProperties("F12", "Courier", "italic", "bold");
  -        fontInfo.addFontProperties("F13", "Symbol", "normal", "normal");
  -        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", "normal");
  +        fontInfo.addFontProperties("F5", "any", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "any", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "any", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F7", "any", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "any", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "any", "oblique", FontInfo.BOLD);
  +
  +        fontInfo.addFontProperties("F1", "sans-serif", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F2", "sans-serif", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F2", "sans-serif", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F3", "sans-serif", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F4", "sans-serif", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F4", "sans-serif", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F5", "serif", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "serif", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "serif", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F7", "serif", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "serif", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "serif", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F9", "monospace", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F10", "monospace", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F10", "monospace", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F11", "monospace", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F12", "monospace", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F12", "monospace", "italic", FontInfo.BOLD);
  +
  +        fontInfo.addFontProperties("F1", "Helvetica", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F2", "Helvetica", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F2", "Helvetica", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F3", "Helvetica", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F4", "Helvetica", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F4", "Helvetica", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F5", "Times", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F7", "Times", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F9", "Courier", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F10", "Courier", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F10", "Courier", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F11", "Courier", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F12", "Courier", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F12", "Courier", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F13", "Symbol", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", 
FontInfo.NORMAL);
   
           // Custom type 1 fonts step 2/2
  -        // fontInfo.addFontProperties("F15", "OMEP", "normal", "normal");
  -        // fontInfo.addFontProperties("F16", "Garamond-LightCondensed", "normal", 
"normal");
  -        // fontInfo.addFontProperties("F17", "BauerBodoni", "italic", "bold");
  +        // fontInfo.addFontProperties("F15", "OMEP", "normal", FontInfo.NORMAL);
  +        // fontInfo.addFontProperties("F16", "Garamond-LightCondensed", "normal", 
FontInfo.NORMAL);
  +        // fontInfo.addFontProperties("F17", "BauerBodoni", "italic", 
FontInfo.BOLD);
   
           /* for compatibility with PassiveTex */
  -        fontInfo.addFontProperties("F5", "Times-Roman", "normal", "normal");
  -        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", "normal");
  -        fontInfo.addFontProperties("F6", "Times-Roman", "italic", "normal");
  -        fontInfo.addFontProperties("F7", "Times-Roman", "normal", "bold");
  -        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", "bold");
  -        fontInfo.addFontProperties("F8", "Times-Roman", "italic", "bold");
  -        fontInfo.addFontProperties("F5", "Times Roman", "normal", "normal");
  -        fontInfo.addFontProperties("F6", "Times Roman", "oblique", "normal");
  -        fontInfo.addFontProperties("F6", "Times Roman", "italic", "normal");
  -        fontInfo.addFontProperties("F7", "Times Roman", "normal", "bold");
  -        fontInfo.addFontProperties("F8", "Times Roman", "oblique", "bold");
  -        fontInfo.addFontProperties("F8", "Times Roman", "italic", "bold");
  +        fontInfo.addFontProperties("F5", "Times-Roman", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times-Roman", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F7", "Times-Roman", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times-Roman", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F5", "Times Roman", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times Roman", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times Roman", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F7", "Times Roman", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times Roman", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times Roman", "italic", FontInfo.BOLD);
           fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter",
  -                                   "normal", "normal");
  +                                   "normal", FontInfo.NORMAL);
       }
   
   }
  -
  -
  -
  -
  -
  -
  -
  -
  -
   
  
  
  
  1.18      +73 -64    xml-fop/src/org/apache/fop/render/pdf/FontSetup.java
  
  Index: FontSetup.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/FontSetup.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- FontSetup.java    28 Jun 2002 10:09:06 -0000      1.17
  +++ FontSetup.java    23 Jul 2002 11:06:51 -0000      1.18
  @@ -60,73 +60,73 @@
           // fontInfo.addMetrics("F17", new BauerBodoniBoldItalic());
   
           /* any is treated as serif */
  -        fontInfo.addFontProperties("F5", "any", "normal", "normal");
  -        fontInfo.addFontProperties("F6", "any", "italic", "normal");
  -        fontInfo.addFontProperties("F6", "any", "oblique", "normal");
  -        fontInfo.addFontProperties("F7", "any", "normal", "bold");
  -        fontInfo.addFontProperties("F8", "any", "italic", "bold");
  -        fontInfo.addFontProperties("F8", "any", "oblique", "bold");
  -
  -        fontInfo.addFontProperties("F1", "sans-serif", "normal", "normal");
  -        fontInfo.addFontProperties("F2", "sans-serif", "oblique", "normal");
  -        fontInfo.addFontProperties("F2", "sans-serif", "italic", "normal");
  -        fontInfo.addFontProperties("F3", "sans-serif", "normal", "bold");
  -        fontInfo.addFontProperties("F4", "sans-serif", "oblique", "bold");
  -        fontInfo.addFontProperties("F4", "sans-serif", "italic", "bold");
  -        fontInfo.addFontProperties("F5", "serif", "normal", "normal");
  -        fontInfo.addFontProperties("F6", "serif", "oblique", "normal");
  -        fontInfo.addFontProperties("F6", "serif", "italic", "normal");
  -        fontInfo.addFontProperties("F7", "serif", "normal", "bold");
  -        fontInfo.addFontProperties("F8", "serif", "oblique", "bold");
  -        fontInfo.addFontProperties("F8", "serif", "italic", "bold");
  -        fontInfo.addFontProperties("F9", "monospace", "normal", "normal");
  -        fontInfo.addFontProperties("F10", "monospace", "oblique", "normal");
  -        fontInfo.addFontProperties("F10", "monospace", "italic", "normal");
  -        fontInfo.addFontProperties("F11", "monospace", "normal", "bold");
  -        fontInfo.addFontProperties("F12", "monospace", "oblique", "bold");
  -        fontInfo.addFontProperties("F12", "monospace", "italic", "bold");
  -
  -        fontInfo.addFontProperties("F1", "Helvetica", "normal", "normal");
  -        fontInfo.addFontProperties("F2", "Helvetica", "oblique", "normal");
  -        fontInfo.addFontProperties("F2", "Helvetica", "italic", "normal");
  -        fontInfo.addFontProperties("F3", "Helvetica", "normal", "bold");
  -        fontInfo.addFontProperties("F4", "Helvetica", "oblique", "bold");
  -        fontInfo.addFontProperties("F4", "Helvetica", "italic", "bold");
  -        fontInfo.addFontProperties("F5", "Times", "normal", "normal");
  -        fontInfo.addFontProperties("F6", "Times", "oblique", "normal");
  -        fontInfo.addFontProperties("F6", "Times", "italic", "normal");
  -        fontInfo.addFontProperties("F7", "Times", "normal", "bold");
  -        fontInfo.addFontProperties("F8", "Times", "oblique", "bold");
  -        fontInfo.addFontProperties("F8", "Times", "italic", "bold");
  -        fontInfo.addFontProperties("F9", "Courier", "normal", "normal");
  -        fontInfo.addFontProperties("F10", "Courier", "oblique", "normal");
  -        fontInfo.addFontProperties("F10", "Courier", "italic", "normal");
  -        fontInfo.addFontProperties("F11", "Courier", "normal", "bold");
  -        fontInfo.addFontProperties("F12", "Courier", "oblique", "bold");
  -        fontInfo.addFontProperties("F12", "Courier", "italic", "bold");
  -        fontInfo.addFontProperties("F13", "Symbol", "normal", "normal");
  -        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", "normal");
  +        fontInfo.addFontProperties("F5", "any", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "any", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "any", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F7", "any", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "any", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "any", "oblique", FontInfo.BOLD);
  +
  +        fontInfo.addFontProperties("F1", "sans-serif", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F2", "sans-serif", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F2", "sans-serif", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F3", "sans-serif", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F4", "sans-serif", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F4", "sans-serif", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F5", "serif", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "serif", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "serif", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F7", "serif", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "serif", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "serif", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F9", "monospace", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F10", "monospace", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F10", "monospace", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F11", "monospace", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F12", "monospace", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F12", "monospace", "italic", FontInfo.BOLD);
  +
  +        fontInfo.addFontProperties("F1", "Helvetica", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F2", "Helvetica", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F2", "Helvetica", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F3", "Helvetica", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F4", "Helvetica", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F4", "Helvetica", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F5", "Times", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F7", "Times", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F9", "Courier", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F10", "Courier", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F10", "Courier", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F11", "Courier", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F12", "Courier", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F12", "Courier", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F13", "Symbol", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F14", "ZapfDingbats", "normal", 
FontInfo.NORMAL);
   
           // Custom type 1 fonts step 2/2
  -        // fontInfo.addFontProperties("F15", "OMEP", "normal", "normal");
  -        // fontInfo.addFontProperties("F16", "Garamond-LightCondensed", "normal", 
"normal");
  -        // fontInfo.addFontProperties("F17", "BauerBodoni", "italic", "bold");
  +        // fontInfo.addFontProperties("F15", "OMEP", "normal", FontInfo.NORMAL);
  +        // fontInfo.addFontProperties("F16", "Garamond-LightCondensed", "normal", 
FontInfo.NORMAL);
  +        // fontInfo.addFontProperties("F17", "BauerBodoni", "italic", 
FontInfo.BOLD);
   
           /* for compatibility with PassiveTex */
  -        fontInfo.addFontProperties("F5", "Times-Roman", "normal", "normal");
  -        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", "normal");
  -        fontInfo.addFontProperties("F6", "Times-Roman", "italic", "normal");
  -        fontInfo.addFontProperties("F7", "Times-Roman", "normal", "bold");
  -        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", "bold");
  -        fontInfo.addFontProperties("F8", "Times-Roman", "italic", "bold");
  -        fontInfo.addFontProperties("F5", "Times Roman", "normal", "normal");
  -        fontInfo.addFontProperties("F6", "Times Roman", "oblique", "normal");
  -        fontInfo.addFontProperties("F6", "Times Roman", "italic", "normal");
  -        fontInfo.addFontProperties("F7", "Times Roman", "normal", "bold");
  -        fontInfo.addFontProperties("F8", "Times Roman", "oblique", "bold");
  -        fontInfo.addFontProperties("F8", "Times Roman", "italic", "bold");
  +        fontInfo.addFontProperties("F5", "Times-Roman", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times-Roman", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times-Roman", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F7", "Times-Roman", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times-Roman", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times-Roman", "italic", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F5", "Times Roman", "normal", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times Roman", "oblique", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F6", "Times Roman", "italic", FontInfo.NORMAL);
  +        fontInfo.addFontProperties("F7", "Times Roman", "normal", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times Roman", "oblique", FontInfo.BOLD);
  +        fontInfo.addFontProperties("F8", "Times Roman", "italic", FontInfo.BOLD);
           fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter",
  -                                   "normal", "normal");
  +                                   "normal", FontInfo.NORMAL);
   
           /* Add configured fonts */
           addConfiguredFonts(fontInfo, 15);
  @@ -169,10 +169,19 @@
                       for (int c = 0; c < triplets.size(); c++) {
                           FontTriplet triplet = (FontTriplet)triplets.get(c);
   
  +                        int weight = 400;
  +                        try {
  +                            weight = Integer.parseInt(triplet.getWeight());
  +                            weight = ((int)weight/100) * 100;
  +                            if(weight < 100) weight = 100;
  +                            if(weight > 900) weight = 900;
  +                        } catch(NumberFormatException nfe) {
  +
  +                        }
                           fontInfo.addFontProperties(internalName,
                                                      triplet.getName(),
                                                      triplet.getStyle(),
  -                                                   triplet.getWeight());
  +                                                   weight);
                       }
                   }
               } catch (Exception ex) {
  
  
  
  1.111     +10 -16    xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
  
  Index: PDFRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
  retrieving revision 1.110
  retrieving revision 1.111
  diff -u -r1.110 -r1.111
  --- PDFRenderer.java  9 Jul 2002 09:43:14 -0000       1.110
  +++ PDFRenderer.java  23 Jul 2002 11:06:51 -0000      1.111
  @@ -25,6 +25,8 @@
   import org.apache.fop.area.inline.*;
   import org.apache.fop.area.inline.Character;
   import org.apache.fop.layout.FontState;
  +import org.apache.fop.layout.FontInfo;
  +import org.apache.fop.layout.FontMetric;
   
   import org.w3c.dom.Document;
   
  @@ -224,6 +226,7 @@
        currentStream.add("1 0 0 -1 0 " +
                          (int) Math.round(pageHeight / 1000) + " cm\n");
           //currentStream.add("BT\n");
  +        currentFontName = "";
   
           Page p = page.getPage();
           renderPageAreas(p);
  @@ -274,14 +277,11 @@
       public void renderWord(Word word) {
               StringBuffer pdf = new StringBuffer();
   
  -            FontState fs = null;
  -
  -         fs = (FontState)word.getTrait(Trait.FONT_STATE);
  -            String name = fs.getFontName();
  -            int size = fs.getFontSize();
  +            String name = (String)word.getTrait(Trait.FONT_NAME);
  +            int size = ((Integer)word.getTrait(Trait.FONT_SIZE)).intValue();
   
               // This assumes that *all* CIDFonts use a /ToUnicode mapping
  -            Font f = (Font)fs.getFontInfo().getFonts().get(name);
  +            Font f = (Font)fontInfo.getFonts().get(name);
               boolean useMultiByte = f.isMultiByte();
   
               // String startText = useMultiByte ? "<FEFF" : "(";
  @@ -330,6 +330,8 @@
   
           String s = word.getWord();
   
  +        FontMetric metrics = fontInfo.getMetricsFor(name);
  +        FontState fs = new FontState(name, metrics, size);
           escapeText(s, fs, useMultiByte, pdf);
           pdf.append(endText);
   
  @@ -566,15 +568,7 @@
           context.setProperty(PDFXMLHandler.PDF_STREAM, currentStream);
           context.setProperty(PDFXMLHandler.PDF_XPOS, new 
Integer(currentBlockIPPosition + (int)pos.getX()));
           context.setProperty(PDFXMLHandler.PDF_YPOS, new Integer(currentBPPosition + 
(int)pos.getY()));
  -        FontState fs = null;
  -            try {
  -                fs = new FontState(fontInfo, "Helvetica", "",
  -                                          "", 12 * 1000, 0);
  -            } catch (org.apache.fop.apps.FOPException fope) {
  -                fope.printStackTrace();
  -            }
  -
  -        context.setProperty(PDFXMLHandler.PDF_FONT_STATE, fs);
  +        context.setProperty(PDFXMLHandler.PDF_FONT_INFO, fontInfo);
           context.setProperty(PDFXMLHandler.PDF_FONT_NAME, currentFontName);
           context.setProperty(PDFXMLHandler.PDF_FONT_SIZE, new 
Integer(currentFontSize));
           context.setProperty(PDFXMLHandler.PDF_WIDTH, new 
Integer((int)pos.getWidth()));
  
  
  
  1.8       +7 -7      xml-fop/src/org/apache/fop/render/pdf/PDFXMLHandler.java
  
  Index: PDFXMLHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFXMLHandler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PDFXMLHandler.java        5 Jul 2002 09:21:48 -0000       1.7
  +++ PDFXMLHandler.java        23 Jul 2002 11:06:51 -0000      1.8
  @@ -13,7 +13,7 @@
   import org.apache.fop.pdf.*;
   import org.apache.fop.svg.*;
   import org.apache.fop.svg.SVGUserAgent;
  -import org.apache.fop.layout.FontState;
  +import org.apache.fop.layout.FontInfo;
   
   import org.apache.batik.dom.util.DOMUtilities;
   
  @@ -50,7 +50,7 @@
   public static final String PDF_STREAM = "pdfStream";
   public static final String PDF_WIDTH = "width";
   public static final String PDF_HEIGHT = "height";
  -public static final String PDF_FONT_STATE = "fontState";
  +public static final String PDF_FONT_INFO = "fontInfo";
   public static final String PDF_FONT_NAME = "fontName";
   public static final String PDF_FONT_SIZE = "fontSize";
   public static final String PDF_XPOS = "xpos";
  @@ -80,7 +80,7 @@
           pdfi.currentStream = (PDFStream)context.getProperty(PDF_STREAM);
           pdfi.width = ((Integer)context.getProperty(PDF_WIDTH)).intValue();
           pdfi.height = ((Integer)context.getProperty(PDF_HEIGHT)).intValue();
  -        pdfi.fs = (FontState)context.getProperty(PDF_FONT_STATE);
  +        pdfi.fi = (FontInfo)context.getProperty(PDF_FONT_INFO);
           pdfi.currentFontName = (String)context.getProperty(PDF_FONT_NAME);
           pdfi.currentFontSize = 
((Integer)context.getProperty(PDF_FONT_SIZE)).intValue();
           pdfi.currentXPosition = ((Integer)context.getProperty(PDF_XPOS)).intValue();
  @@ -96,7 +96,7 @@
           public PDFStream currentStream;
           int width;
           int height;
  -        FontState fs;
  +        FontInfo fi;
           String currentFontName;
           int currentFontSize;
           int currentXPosition;
  @@ -117,7 +117,7 @@
   
               GVTBuilder builder = new GVTBuilder();
               BridgeContext ctx = new BridgeContext(ua);
  -            PDFTextElementBridge tBridge = new PDFTextElementBridge(pdfInfo.fs);
  +            PDFTextElementBridge tBridge = new PDFTextElementBridge(pdfInfo.fi);
               ctx.putBridge(tBridge);
   
               PDFAElementBridge aBridge = new PDFAElementBridge();
  @@ -170,7 +170,7 @@
                                   + PDFNumber.doubleOut(vals[5]) + " cm\n");
               }
   
  -            PDFGraphics2D graphics = new PDFGraphics2D(true, pdfInfo.fs, 
pdfInfo.pdfDoc,
  +            PDFGraphics2D graphics = new PDFGraphics2D(true, pdfInfo.fi, 
pdfInfo.pdfDoc,
                                        pdfInfo.pdfPage, 
pdfInfo.pdfPage.referencePDF(), pdfInfo.currentFontName,
                                        pdfInfo.currentFontSize,
                                        pdfInfo.currentXPosition,
  
  
  
  1.10      +13 -16    xml-fop/src/org/apache/fop/tools/AreaTreeBuilder.java
  
  Index: AreaTreeBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/tools/AreaTreeBuilder.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AreaTreeBuilder.java      27 May 2002 10:59:08 -0000      1.9
  +++ AreaTreeBuilder.java      23 Jul 2002 11:06:51 -0000      1.10
  @@ -18,6 +18,7 @@
   import org.apache.fop.render.xml.*;
   import org.apache.fop.layout.FontInfo;
   import org.apache.fop.layout.FontState;
  +import org.apache.fop.layout.FontMetric;
   import org.apache.fop.fo.FOUserAgent;
   
   import org.apache.avalon.framework.logger.ConsoleLogger;
  @@ -462,13 +463,10 @@
                   Character ch =
                     new Character(getString((Element) obj).charAt(0));
                   addTraits((Element) obj, ch);
  -                try {
  -                    currentFontState =
  -                      new FontState(fontInfo, "sans-serif", "normal",
  -                                    "normal", 12000, 0);
  -                } catch (FOPException e) {
  -                    e.printStackTrace();
  -                }
  +                String fname = fontInfo.fontLookup("sans-serif", "normal", 
FontInfo.NORMAL);
  +                FontMetric metrics = fontInfo.getMetricsFor(fname);
  +                currentFontState =
  +                    new FontState(fname, metrics, 12000);
   
                   ch.setWidth(currentFontState.width(ch.getChar()));
                   ch.setOffset(currentFontState.getCapHeight());
  @@ -490,16 +488,15 @@
                       list.add(leader);
                   }
               } else if (obj.getNodeName().equals("word")) {
  -                try {
  -                    currentFontState =
  -                      new FontState(fontInfo, "sans-serif", "normal",
  -                                    "normal", 12000, 0);
  -                } catch (FOPException e) {
  -                    e.printStackTrace();
  -                }
  +                String fname = fontInfo.fontLookup("sans-serif", "normal", 
FontInfo.NORMAL);
  +                FontMetric metrics = fontInfo.getMetricsFor(fname);
  +                currentFontState =
  +                    new FontState(fname, metrics, 12000);
                   Word word = getWord((Element) obj);
   
  -             word.addTrait(Trait.FONT_STATE, currentFontState);
  +                word.addTrait(Trait.FONT_NAME, fname);
  +                word.addTrait(Trait.FONT_SIZE, new Integer(12000));
  +
                   if (word != null) {
                       list.add(word);
                   }
  
  
  

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

Reply via email to