You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by de...@apache.org on 2006/03/26 16:57:02 UTC

svn commit: r388912 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/ bridge/svg12/ extension/svg/ gvt/flow/ gvt/font/ gvt/renderer/ gvt/text/

Author: deweese
Date: Sun Mar 26 06:57:00 2006
New Revision: 388912

URL: http://svn.apache.org/viewcvs?rev=388912&view=rev
Log:
1) SVG Text no longer forces reference to SVG DOM for static content,
   when using AWT fonts.  (SVG Fonts currently still hold a reference
   to the SVG Document).

2) In most places TEXT_COMPOUND_DELIMITER has effectively been
   replaced by TEXT_COMPOUND_ID.  TEXT_COMPOUND_ID has a unique
   value for each element in the DOM but retains no reference to
   the element.

   In dynamic documents TEXT_COMPOUND_DELIMITER is still bound on
   elements, with a hard reference to the DOM element.


Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/GlyphIterator.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/BlockInfo.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/AWTFontFamily.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java?rev=388912&r1=388911&r2=388912&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java Sun Mar 26 06:57:00 2006
@@ -92,6 +92,10 @@
         AttributedCharacterIterator.Attribute TEXT_COMPOUND_DELIMITER =
         GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER;
 
+    public static final 
+        AttributedCharacterIterator.Attribute TEXT_COMPOUND_ID =
+        GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_ID;
+
     public static final AttributedCharacterIterator.Attribute PAINT_INFO =
          GVTAttributedCharacterIterator.TextAttribute.PAINT_INFO;
 
@@ -100,10 +104,6 @@
         GVTAttributedCharacterIterator.TextAttribute.ALT_GLYPH_HANDLER;
         
     public static final 
-        AttributedCharacterIterator.Attribute GVT_FONT_FAMILIES 
-        = GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES;
-
-    public static final 
         AttributedCharacterIterator.Attribute TEXTPATH
         = GVTAttributedCharacterIterator.TextAttribute.TEXTPATH;
 
@@ -271,6 +271,9 @@
         node.setPointerEventType(CSSUtilities.convertPointerEvents(e));
 
         initializeDynamicSupport(ctx, e, node);
+        if (!ctx.isDynamic()) {
+            elemTPI.clear();
+        }
     }
 
     /**
@@ -1373,30 +1376,81 @@
         }
     }
 
-    protected Map getFontProperties(BridgeContext ctx, Element element, 
-                                    Map map) {
-        if (map == null) map = new HashMap(4);
+    /**
+     * This method adds all the font related properties to <tt>result</tt>
+     * It also builds a List of the GVTFonts and returns it.
+     */
+    protected List getFontList(BridgeContext ctx, 
+                               Element       element, 
+                               Map           result) {
 
-        // Needed for SVG fonts.
-        map.put(TEXT_COMPOUND_DELIMITER, element);
+        // Unique value for text element - used for run identification.
+        result.put(TEXT_COMPOUND_ID, new Object());
 
+        Float fsFloat = TextUtilities.convertFontSize(element);
+        float fontSize = fsFloat.floatValue();
         // Font size.
-        map.put(TextAttribute.SIZE, 
-                TextUtilities.convertFontSize(element));
+        result.put(TextAttribute.SIZE, fsFloat);
 
         // Font stretch
-        map.put(TextAttribute.WIDTH, 
+        result.put(TextAttribute.WIDTH, 
                 TextUtilities.convertFontStretch(element));
 
+        // Font style
+        result.put(TextAttribute.POSTURE, 
+                TextUtilities.convertFontStyle(element));
+
         // Font weight
-        map.put(TextAttribute.WEIGHT, 
+        result.put(TextAttribute.WEIGHT, 
                 TextUtilities.convertFontWeight(element));
 
+        // Font weight
+        Value v = CSSUtilities.getComputedStyle
+            (element, SVGCSSEngine.FONT_WEIGHT_INDEX);
+        String fontWeightString = v.getCssText();
+
         // Font style
-        map.put(TextAttribute.POSTURE, 
-                TextUtilities.convertFontStyle(element));
+        String fontStyleString = CSSUtilities.getComputedStyle
+            (element, SVGCSSEngine.FONT_STYLE_INDEX).getStringValue();
+
+        // Needed for SVG fonts (also for dynamic documents).
+        result.put(TEXT_COMPOUND_DELIMITER, element);
+
+        //  make a list of GVTFont objects
+        Value val = CSSUtilities.getComputedStyle
+            (element, SVGCSSEngine.FONT_FAMILY_INDEX);
+        List fontList = new ArrayList();
+        int len = val.getLength();
+        for (int i = 0; i < len; i++) {
+            Value it = val.item(i);
+            String fontFamilyName = it.getStringValue();
+            GVTFontFamily fontFamily;
+            fontFamily = SVGFontUtilities.getFontFamily
+                (element, ctx, fontFamilyName,
+                 fontWeightString, fontStyleString);
+            if (fontFamily == null) continue;
+            if (fontFamily instanceof UnresolvedFontFamily) {
+                fontFamily = FontFamilyResolver.resolve
+                    ((UnresolvedFontFamily)fontFamily);
+                if (fontFamily == null) continue;
+            }
+            if (fontFamily instanceof SVGFontFamily) {
+                SVGFontFamily svgFF = (SVGFontFamily)fontFamily;
+                if (svgFF.isComplex()) {
+                    usingComplexSVGFont = true;
+                }
+            }
+            GVTFont ft = fontFamily.deriveFont(fontSize, result);
+            fontList.add(ft);
+        }
 
-        return map;
+        if (!ctx.isDynamic()) {
+            // Only leave this in the map for dynamic documents.
+            // Otherwise it will cause the whole DOM to stay when
+            // we don't really need it.
+            result.remove(TEXT_COMPOUND_DELIMITER);
+        }
+        return fontList;
     }
 
     /**
@@ -1435,30 +1489,9 @@
         TextNode.Anchor a = TextUtilities.convertTextAnchor(element);
         result.put(ANCHOR_TYPE, a);
 
-        // get font size/width/weight/posture properties
-        getFontProperties(ctx, element, result);
-
         // Font family
-        List fontFamilyList = getFontFamilyList(element, ctx);
-        // result.put(GVT_FONT_FAMILIES, fontFamilyList);
-
-        List fonts = new ArrayList(fontFamilyList.size());
-        Iterator iter = fontFamilyList.iterator();
-        float fontSize = 12;
-        Float fsFloat = (Float)result.get(TextAttribute.SIZE);
-        if (fsFloat != null) {
-            fontSize = fsFloat.floatValue();
-        }
-        while (iter.hasNext()) {
-            GVTFontFamily ff = (GVTFontFamily)iter.next();
-            if (ff instanceof UnresolvedFontFamily) {
-                ff = FontFamilyResolver.resolve((UnresolvedFontFamily)ff);
-            }
-            if (ff == null) continue;
-            GVTFont ft = ff.deriveFont(fontSize, result);
-            fonts.add(ft);
-        }
-        result.put(GVT_FONTS, fonts);
+        List fontList = getFontList(ctx, element, result);
+        result.put(GVT_FONTS, fontList);
 
 
         // Text baseline adjustment.
@@ -1678,39 +1711,6 @@
         return result;
     }
 
-
-    protected List getFontFamilyList(Element element, BridgeContext ctx) {
-        // Font weight
-        Value v = CSSUtilities.getComputedStyle
-            (element, SVGCSSEngine.FONT_WEIGHT_INDEX);
-        String fontWeightString = v.getCssText();
-
-        // Font style
-        String fontStyleString = CSSUtilities.getComputedStyle
-            (element, SVGCSSEngine.FONT_STYLE_INDEX).getStringValue();
-
-        Value val = CSSUtilities.getComputedStyle
-            (element, SVGCSSEngine.FONT_FAMILY_INDEX);
-        //  make a list of GVTFontFamily objects
-        List fontFamilyList = new ArrayList();
-        int len = val.getLength();
-        for (int i = 0; i < len; i++) {
-            Value it = val.item(i);
-            String fontFamilyName = it.getStringValue();
-            GVTFontFamily fontFamily
-                = SVGFontUtilities.getFontFamily(element, ctx, fontFamilyName,
-                                                 fontWeightString, 
-                                                 fontStyleString);
-            if (fontFamily instanceof SVGFontFamily) {
-                SVGFontFamily svgFF = (SVGFontFamily)fontFamily;
-                if (svgFF.isComplex()) {
-                    usingComplexSVGFont = true;
-                }
-            }
-            fontFamilyList.add(fontFamily);
-        }
-        return fontFamilyList;
-    }
 
     /**
      * Retrieve in the AttributeString the closest parent

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java?rev=388912&r1=388911&r2=388912&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java Sun Mar 26 06:57:00 2006
@@ -834,18 +834,17 @@
         else
             textAlign = BlockInfo.ALIGN_FULL;
 
-        Map   fontAttrs      = getFontProperties(ctx, element, null);
+        Map   fontAttrs      = new HashMap(20);
+        List  fontList       = getFontList(ctx, element, fontAttrs);
         Float fs             = (Float)fontAttrs.get(TextAttribute.SIZE);
         float fontSize       = fs.floatValue();
         float lineHeight     = getLineHeight(ctx, element, fontSize);
-        List  fontFamilyList = getFontFamilyList(element, ctx);
 
         String ln = element.getLocalName();
         boolean rgnBr;
         rgnBr = ln.equals(SVG12Constants.SVG_FLOW_REGION_BREAK_TAG);
         return new BlockInfo(top, right, bottom, left, indent, textAlign, 
-                             lineHeight, fontFamilyList, fontAttrs,
-                             rgnBr);
+                             lineHeight, fontList, fontAttrs, rgnBr);
     }
 
     protected float getLineHeight(BridgeContext ctx, Element element, 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/GlyphIterator.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/GlyphIterator.java?rev=388912&r1=388911&r2=388912&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/GlyphIterator.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/GlyphIterator.java Sun Mar 26 06:57:00 2006
@@ -35,9 +35,8 @@
     public static final AttributedCharacterIterator.Attribute FLOW_LINE_BREAK 
         = GVTAttributedCharacterIterator.TextAttribute.FLOW_LINE_BREAK;
 
-    public static final AttributedCharacterIterator.Attribute 
-        TEXT_COMPOUND_DELIMITER 
-        = GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER;
+    public static final AttributedCharacterIterator.Attribute TEXT_COMPOUND_ID
+        = GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_ID;
     public static final 
         AttributedCharacterIterator.Attribute GVT_FONT 
         = GVTAttributedCharacterIterator.TextAttribute.GVT_FONT;
@@ -122,7 +121,7 @@
         this.maxDescent  = -Float.MAX_VALUE;
 
         // Figure out where the font size might change again...
-        this.runLimit  = aci.getRunLimit(TEXT_COMPOUND_DELIMITER);
+        this.runLimit  = aci.getRunLimit(TEXT_COMPOUND_ID);
         
         this.lineBreakRunLimit = aci.getRunLimit(FLOW_LINE_BREAK);
         Object o = aci.getAttribute(FLOW_LINE_BREAK);
@@ -307,7 +306,7 @@
 
         if (aciIdx >= runLimit) {
             updateLineMetrics(aciIdx);
-            runLimit = aci.getRunLimit(TEXT_COMPOUND_DELIMITER);
+            runLimit = aci.getRunLimit(TEXT_COMPOUND_ID);
             font     = (GVTFont)aci.getAttribute(GVT_FONT);
             if (font == null) {
                 font = new AWTGVTFont(aci.getAttributes());

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/BlockInfo.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/BlockInfo.java?rev=388912&r1=388911&r2=388912&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/BlockInfo.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/BlockInfo.java Sun Mar 26 06:57:00 2006
@@ -23,11 +23,8 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.batik.gvt.font.FontFamilyResolver;
 import org.apache.batik.gvt.font.GVTFont;
-import org.apache.batik.gvt.font.GVTFontFamily;
 import org.apache.batik.gvt.font.GVTLineMetrics;
-import org.apache.batik.gvt.font.UnresolvedFontFamily;
 
 public class BlockInfo {
     public final static int ALIGN_START  = 0;
@@ -45,7 +42,7 @@
     protected int     alignment;
 
     protected float   lineHeight;
-    protected List    fontFamilyList;
+    protected List    fontList;
     protected Map     fontAttrs;
     protected float   ascent=-1;
     protected float   descent=-1;
@@ -55,7 +52,7 @@
 
     public BlockInfo(float top, float right, float bottom, float left,
                      float indent, int alignment, float lineHeight,
-                     List fontFamilyList, Map fontAttrs, 
+                     List fontList, Map fontAttrs, 
                      boolean flowRegionBreak) {
         this.top    = top;
         this.right  = right;
@@ -66,9 +63,9 @@
 
         this.alignment = alignment;
 
-        this.lineHeight       = lineHeight;
-        this.fontFamilyList   = fontFamilyList;
-        this.fontAttrs        = fontAttrs;
+        this.lineHeight      = lineHeight;
+        this.fontList        = fontList;
+        this.fontAttrs       = fontAttrs;
 
         this.flowRegionBreak = flowRegionBreak;
     }
@@ -93,17 +90,9 @@
         if (fsFloat != null) 
             fontSize = fsFloat.floatValue();
 
-        Iterator i = fontFamilyList.iterator();
+        Iterator i = fontList.iterator();
         while (i.hasNext()) {
-            GVTFontFamily fontFamily = (GVTFontFamily)i.next();
-            if (fontFamily instanceof UnresolvedFontFamily) {
-                fontFamily = FontFamilyResolver.resolve
-                    ((UnresolvedFontFamily)fontFamily);
-            }
-            if (fontFamily == null) continue;
-            
-            
-            GVTFont font = fontFamily.deriveFont(fontSize, fontAttrs);
+            GVTFont font = (GVTFont)i.next();
             GVTLineMetrics lm = font.getLineMetrics("", frc);
             this.ascent = lm.getAscent();
             this.descent = lm.getDescent();
@@ -126,7 +115,7 @@
 
 
     public float   getLineHeight()      { return lineHeight; }
-    public List    getFontFamilyList()  { return fontFamilyList; }
+    public List    getFontList()        { return fontList; }
     public Map     getFontAttrs()       { return fontAttrs; }
     public float   getAscent()          { return ascent; }
     public float   getDescent()         { return descent; }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/AWTFontFamily.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/AWTFontFamily.java?rev=388912&r1=388911&r2=388912&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/AWTFontFamily.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/AWTFontFamily.java Sun Mar 26 06:57:00 2006
@@ -32,6 +32,10 @@
  */
 public class AWTFontFamily implements GVTFontFamily {
 
+    public static final 
+        AttributedCharacterIterator.Attribute TEXT_COMPOUND_DELIMITER =
+        GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER;
+
     protected GVTFontFace fontFace;
     protected Font   font;
 
@@ -106,7 +110,7 @@
         Map fontAttributes = new HashMap(attrs);
         fontAttributes.put(TextAttribute.SIZE, new Float(size));
         fontAttributes.put(TextAttribute.FAMILY, fontFace.getFamilyName());
-        fontAttributes.remove(GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER);
+        fontAttributes.remove(TEXT_COMPOUND_DELIMITER);
         return new AWTGVTFont(fontAttributes);
     }
      

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java?rev=388912&r1=388911&r2=388912&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java Sun Mar 26 06:57:00 2006
@@ -81,8 +81,8 @@
         GVTAttributedCharacterIterator.TextAttribute.FLOW_PARAGRAPH;
 
     public static final 
-        AttributedCharacterIterator.Attribute TEXT_COMPOUND_DELIMITER 
-        = GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER;
+        AttributedCharacterIterator.Attribute TEXT_COMPOUND_ID 
+        = GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_ID;
 
     public static final 
         AttributedCharacterIterator.Attribute GVT_FONT 
@@ -133,7 +133,7 @@
 
     static {
         extendedAtts.add(FLOW_PARAGRAPH);
-        extendedAtts.add(TEXT_COMPOUND_DELIMITER);
+        extendedAtts.add(TEXT_COMPOUND_ID);
         extendedAtts.add(GVT_FONT);
         // extendedAtts.add(BIDI_LEVEL);
     }
@@ -323,7 +323,7 @@
                 }
 
                 // find end of compound.
-                end   = aci.getRunLimit(TEXT_COMPOUND_DELIMITER);
+                end   = aci.getRunLimit(TEXT_COMPOUND_ID);
 
                 if (start != chunkStartIndex)
                     // If we aren't starting a new chunk then we know
@@ -415,10 +415,10 @@
         int asOff = 0;
         int begin = aci.getBeginIndex();
         boolean moreChunks = true;
-        int start, end   = aci.getRunStart(TEXT_COMPOUND_DELIMITER);
+        int start, end   = aci.getRunStart(TEXT_COMPOUND_ID);
         while (moreChunks) {
             start = end;
-            end = aci.getRunLimit(TEXT_COMPOUND_DELIMITER);
+            end = aci.getRunLimit(TEXT_COMPOUND_ID);
             int aciLength = end-start;
 
             List fonts;

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java?rev=388912&r1=388911&r2=388912&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java Sun Mar 26 06:57:00 2006
@@ -230,6 +230,11 @@
         public final static TextAttribute TEXT_COMPOUND_DELIMITER =
                               new TextAttribute("TEXT_COMPOUND_DELIMITER");
 
+        /** Element identifier all chars from same element will share an
+         *  ID. */
+        public final static TextAttribute TEXT_COMPOUND_ID =
+                              new TextAttribute("TEXT_COMPOUND_ID");
+
         /** Anchor type.*/
         public final static TextAttribute ANCHOR_TYPE =
                               new TextAttribute("ANCHOR_TYPE");
@@ -318,8 +323,6 @@
         public final static TextAttribute HORIZONTAL_ORIENTATION_ANGLE =
                                           new TextAttribute("HORIZONTAL_ORIENTATION_ANGLE");
 
-        public final static TextAttribute GVT_FONT_FAMILIES =
-                                          new TextAttribute("GVT_FONT_FAMILIES");
         public final static TextAttribute GVT_FONTS =
                                           new TextAttribute("GVT_FONTS");
 



Re: svn commit: r388912 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/ bridge/svg12/ extension/svg/ gvt/flow/ gvt/font/ gvt/renderer/ gvt/text/

Posted by th...@kodak.com.
Hi Jeremias,

Jeremias Maerki <de...@jeremias-maerki.ch> wrote on 03/30/2006 02:34:44 AM:

> I hope I'll have time during the weekend to investigate
> further. We really need to get the XML Graphics Commons story forward
> somehow. If the PDFTextPainter were in Batik, there would have been no
> problem. 

   Yup...

> As it stands right now, we would pretty much block our ability
> to release FOP until the next Batik release if we follow the changes in
> Batik Trunk. I guess we need to temporarily change the Gump descriptor
> to use the batik.jar in FOP's lib directory. That would at least allow
> you to proceed in the intended direction and you could remove
> GVT_FONT_FAMILIES again.

   I wouldn't worry about this too much.  There is another fairly large
change that would have to happen to remove the hard refs in the SVGGVTFont
class.  This is at least possible/practical (removing them before
deriveFont is called on the FontFamily isn't).  I probably won't get to
this change for a while so keeping the extra Font Families attribute
is only a small ugliness for now.

> On 27.03.2006 15:34:44 thomas.deweese wrote:
> > Hi Jeremias,
> > 
> > Jeremias Maerki <de...@jeremias-maerki.ch> wrote on 03/27/2006 01:10:36 
AM:
> > 
> > > This change removes 
> > GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES
> > > which FOP's PDFTextPainter relies on. 
> > 
> >    Hmm, yes it does.  Sorry about that...
> > 
> > > PDFTextPainter uses that list to determine if a font is an SVG font 
and 
> > > needs to be painted as shapes instead of as text. Just FYI. I'll 
have to 
> > 
> > > find time to take a closer look.
> > 
> >    Actually this wouldn't be much of a problem, but it also uses it to
> > figure out the name of the font to use in the PDF.  However this isn't
> > really the best, it should look at GVT_FONT to see what font has been
> > selected for each character/run of chars.  Batik selects the font 
based
> > on it's ability to display the text.
> > 
> >    I've added an interface to GVTFont to get the font family name.
> > So eventually FOP can just use the GVT_FONT (or perhaps GVT_FONTS) to
> > do this selection (you can test if the GVTFont is an instance of
> > batik.bridge.SVGGVTFont like you do for font familes). 
> > 
> >    I can add GVT_FONT_FAMILIES back for now, but it will have to go 
> > away eventually since it nessesarily holds a hard ref to the font's 
> > DOM (so the font instance can inherit properties from the text). It is
> > bad for our GVT tree to hold hard refs to the DOM.
> > 
> > > On 26.03.2006 16:57:02 deweese wrote:
> > > > Author: deweese
> > > > Date: Sun Mar 26 06:57:00 2006
> > > > New Revision: 388912
> > > > 
> > > > URL: http://svn.apache.org/viewcvs?rev=388912&view=rev
> > > > Log:
> > > > 1) SVG Text no longer forces reference to SVG DOM for static 
content,
> > > >    when using AWT fonts.  (SVG Fonts currently still hold a 
reference
> > > >    to the SVG Document).
> > > > 
> > > > 2) In most places TEXT_COMPOUND_DELIMITER has effectively been
> > > >    replaced by TEXT_COMPOUND_ID.  TEXT_COMPOUND_ID has a unique
> > > >    value for each element in the DOM but retains no reference to
> > > >    the element.
> > > > 
> > > >    In dynamic documents TEXT_COMPOUND_DELIMITER is still bound on
> > > >    elements, with a hard reference to the DOM element.
> > > > 
> > > > 
> > > > Modified:
> > > > 
> > 
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
> > > > 
> > > 
> > 
> 
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.
> > > java
> > > > 
> > 
xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/GlyphIterator.java
> > > > 
> > 
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/BlockInfo.java
> > > > 
> > 
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/AWTFontFamily.java
> > > > 
> > > 
> > 
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
> > > > 
> > > 
> > 
> 
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.
> > > java
> > > <snip/>
> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Re: svn commit: r388912 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/ bridge/svg12/ extension/svg/ gvt/flow/ gvt/font/ gvt/renderer/ gvt/text/

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Thanks, Thomas. I hope I'll have time during the weekend to investigate
further. We really need to get the XML Graphics Commons story forward
somehow. If the PDFTextPainter were in Batik, there would have been no
problem. As it stands right now, we would pretty much block our ability
to release FOP until the next Batik release if we follow the changes in
Batik Trunk. I guess we need to temporarily change the Gump descriptor
to use the batik.jar in FOP's lib directory. That would at least allow
you to proceed in the intended direction and you could remove
GVT_FONT_FAMILIES again.

On 27.03.2006 15:34:44 thomas.deweese wrote:
> Hi Jeremias,
> 
> Jeremias Maerki <de...@jeremias-maerki.ch> wrote on 03/27/2006 01:10:36 AM:
> 
> > This change removes 
> GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES
> > which FOP's PDFTextPainter relies on. 
> 
>    Hmm, yes it does.  Sorry about that...
> 
> > PDFTextPainter uses that list to determine if a font is an SVG font and 
> > needs to be painted as shapes instead of as text. Just FYI. I'll have to 
> 
> > find time to take a closer look.
> 
>    Actually this wouldn't be much of a problem, but it also uses it to
> figure out the name of the font to use in the PDF.  However this isn't
> really the best, it should look at GVT_FONT to see what font has been
> selected for each character/run of chars.  Batik selects the font based
> on it's ability to display the text.
> 
>    I've added an interface to GVTFont to get the font family name.
> So eventually FOP can just use the GVT_FONT (or perhaps GVT_FONTS) to
> do this selection (you can test if the GVTFont is an instance of
> batik.bridge.SVGGVTFont like you do for font familes). 
> 
>    I can add GVT_FONT_FAMILIES back for now, but it will have to go 
> away eventually since it nessesarily holds a hard ref to the font's 
> DOM (so the font instance can inherit properties from the text). It is
> bad for our GVT tree to hold hard refs to the DOM.
> 
> > On 26.03.2006 16:57:02 deweese wrote:
> > > Author: deweese
> > > Date: Sun Mar 26 06:57:00 2006
> > > New Revision: 388912
> > > 
> > > URL: http://svn.apache.org/viewcvs?rev=388912&view=rev
> > > Log:
> > > 1) SVG Text no longer forces reference to SVG DOM for static content,
> > >    when using AWT fonts.  (SVG Fonts currently still hold a reference
> > >    to the SVG Document).
> > > 
> > > 2) In most places TEXT_COMPOUND_DELIMITER has effectively been
> > >    replaced by TEXT_COMPOUND_ID.  TEXT_COMPOUND_ID has a unique
> > >    value for each element in the DOM but retains no reference to
> > >    the element.
> > > 
> > >    In dynamic documents TEXT_COMPOUND_DELIMITER is still bound on
> > >    elements, with a hard reference to the DOM element.
> > > 
> > > 
> > > Modified:
> > > 
> xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
> > > 
> > 
> xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.
> > java
> > > 
> xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/GlyphIterator.java
> > > 
> xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/BlockInfo.java
> > > 
> xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/AWTFontFamily.java
> > > 
> > 
> xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
> > > 
> > 
> xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.
> > java
> > <snip/>



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Re: svn commit: r388912 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/ bridge/svg12/ extension/svg/ gvt/flow/ gvt/font/ gvt/renderer/ gvt/text/

Posted by th...@kodak.com.
Hi Jeremias,

Jeremias Maerki <de...@jeremias-maerki.ch> wrote on 03/27/2006 01:10:36 AM:

> This change removes 
GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES
> which FOP's PDFTextPainter relies on. 

   Hmm, yes it does.  Sorry about that...

> PDFTextPainter uses that list to determine if a font is an SVG font and 
> needs to be painted as shapes instead of as text. Just FYI. I'll have to 

> find time to take a closer look.

   Actually this wouldn't be much of a problem, but it also uses it to
figure out the name of the font to use in the PDF.  However this isn't
really the best, it should look at GVT_FONT to see what font has been
selected for each character/run of chars.  Batik selects the font based
on it's ability to display the text.

   I've added an interface to GVTFont to get the font family name.
So eventually FOP can just use the GVT_FONT (or perhaps GVT_FONTS) to
do this selection (you can test if the GVTFont is an instance of
batik.bridge.SVGGVTFont like you do for font familes). 

   I can add GVT_FONT_FAMILIES back for now, but it will have to go 
away eventually since it nessesarily holds a hard ref to the font's 
DOM (so the font instance can inherit properties from the text). It is
bad for our GVT tree to hold hard refs to the DOM.

> On 26.03.2006 16:57:02 deweese wrote:
> > Author: deweese
> > Date: Sun Mar 26 06:57:00 2006
> > New Revision: 388912
> > 
> > URL: http://svn.apache.org/viewcvs?rev=388912&view=rev
> > Log:
> > 1) SVG Text no longer forces reference to SVG DOM for static content,
> >    when using AWT fonts.  (SVG Fonts currently still hold a reference
> >    to the SVG Document).
> > 
> > 2) In most places TEXT_COMPOUND_DELIMITER has effectively been
> >    replaced by TEXT_COMPOUND_ID.  TEXT_COMPOUND_ID has a unique
> >    value for each element in the DOM but retains no reference to
> >    the element.
> > 
> >    In dynamic documents TEXT_COMPOUND_DELIMITER is still bound on
> >    elements, with a hard reference to the DOM element.
> > 
> > 
> > Modified:
> > 
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
> > 
> 
xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.
> java
> > 
xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/GlyphIterator.java
> > 
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/BlockInfo.java
> > 
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/AWTFontFamily.java
> > 
> 
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
> > 
> 
xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.
> java
> <snip/>
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Re: svn commit: r388912 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: bridge/ bridge/svg12/ extension/svg/ gvt/flow/ gvt/font/ gvt/renderer/ gvt/text/

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
This change removes GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES
which FOP's PDFTextPainter relies on. PDFTextPainter uses that list to
determine if a font is an SVG font and needs to be painted as shapes
instead of as text. Just FYI. I'll have to find time to take a closer
look.

On 26.03.2006 16:57:02 deweese wrote:
> Author: deweese
> Date: Sun Mar 26 06:57:00 2006
> New Revision: 388912
> 
> URL: http://svn.apache.org/viewcvs?rev=388912&view=rev
> Log:
> 1) SVG Text no longer forces reference to SVG DOM for static content,
>    when using AWT fonts.  (SVG Fonts currently still hold a reference
>    to the SVG Document).
> 
> 2) In most places TEXT_COMPOUND_DELIMITER has effectively been
>    replaced by TEXT_COMPOUND_ID.  TEXT_COMPOUND_ID has a unique
>    value for each element in the DOM but retains no reference to
>    the element.
> 
>    In dynamic documents TEXT_COMPOUND_DELIMITER is still bound on
>    elements, with a hard reference to the DOM element.
> 
> 
> Modified:
>     xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGTextElementBridge.java
>     xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java
>     xmlgraphics/batik/trunk/sources/org/apache/batik/extension/svg/GlyphIterator.java
>     xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/flow/BlockInfo.java
>     xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/font/AWTFontFamily.java
>     xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
>     xmlgraphics/batik/trunk/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java
<snip/>


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org