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:40:51 UTC

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

Author: deweese
Date: Sun Mar 26 06:40:49 2006
New Revision: 388911

URL: http://svn.apache.org/viewcvs?rev=388911&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/branches/svg11/sources/org/apache/batik/bridge/SVGTextElementBridge.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/extension/svg/GlyphIterator.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/flow/BlockInfo.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/font/AWTFontFamily.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java

Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/SVGTextElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/SVGTextElementBridge.java?rev=388911&r1=388910&r2=388911&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/SVGTextElementBridge.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/SVGTextElementBridge.java Sun Mar 26 06:40:49 2006
@@ -94,6 +94,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;
 
@@ -102,10 +106,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;
 
@@ -273,6 +273,9 @@
         node.setPointerEventType(CSSUtilities.convertPointerEvents(e));
 
         initializeDynamicSupport(ctx, e, node);
+        if (!ctx.isDynamic()) {
+            elemTPI.clear();
+        }
     }
 
     /**
@@ -1319,30 +1322,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();
 
-        return map;
+        // 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);
+        }
+
+        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;
     }
 
     /**
@@ -1381,30 +1435,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.
@@ -1625,39 +1658,6 @@
     }
 
 
-    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
      * of the node 'child' and extract the text decorations
@@ -1672,6 +1672,7 @@
         while (parent != null) {
             TextPaintInfo tpi = (TextPaintInfo)elemTPI.get(parent);
             if (tpi != null) return tpi;
+            parent = parent.getParentNode();
         }
         return null;
     }

Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java?rev=388911&r1=388910&r2=388911&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/svg12/SVGFlowRootElementBridge.java Sun Mar 26 06:40:49 2006
@@ -810,18 +810,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/branches/svg11/sources/org/apache/batik/extension/svg/GlyphIterator.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/extension/svg/GlyphIterator.java?rev=388911&r1=388910&r2=388911&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/extension/svg/GlyphIterator.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/extension/svg/GlyphIterator.java Sun Mar 26 06:40:49 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/branches/svg11/sources/org/apache/batik/gvt/flow/BlockInfo.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/flow/BlockInfo.java?rev=388911&r1=388910&r2=388911&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/flow/BlockInfo.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/flow/BlockInfo.java Sun Mar 26 06:40:49 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/branches/svg11/sources/org/apache/batik/gvt/font/AWTFontFamily.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/font/AWTFontFamily.java?rev=388911&r1=388910&r2=388911&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/font/AWTFontFamily.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/font/AWTFontFamily.java Sun Mar 26 06:40:49 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/branches/svg11/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java?rev=388911&r1=388910&r2=388911&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java Sun Mar 26 06:40:49 2006
@@ -83,8 +83,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 
@@ -135,7 +135,7 @@
 
     static {
         extendedAtts.add(FLOW_PARAGRAPH);
-        extendedAtts.add(TEXT_COMPOUND_DELIMITER);
+        extendedAtts.add(TEXT_COMPOUND_ID);
         extendedAtts.add(GVT_FONT);
         // extendedAtts.add(BIDI_LEVEL);
     }
@@ -325,7 +325,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
@@ -417,10 +417,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/branches/svg11/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java?rev=388911&r1=388910&r2=388911&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/text/GVTAttributedCharacterIterator.java Sun Mar 26 06:40:49 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: r388911 - TEXT_COMPOUND_DELIMITER

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

On Sun, 2006-03-26 at 22:14 -0500, thomas.deweese@kodak.com wrote:
> > >    The solution I committed is maximally backwards compatible but has 
> some 
> > > ugliness to it.  My preferred solution would be to remove 
> TEXT_COMPOUND_DELIMITER
> > > completely and instead use TEXT_COMPOUND_ID as a soft reference to the 
> > Element. 
> > 

It is no problem if you completely remove TEXT_COMPOUND_DELIMITER and
use another methods either backward or not backward compatible. We will
adjust our code accordingly, we just hope that the new methods allow
similar capability and if possible more flexible :)

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


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


Re: svn commit: r388911 - TEXT_COMPOUND_DELIMITER

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


Tonny Kohar <to...@kiyut.com> wrote on 03/29/2006 12:31:16 AM:

> I look at the batik source code in related of TEXT_COMPONENT_ID, and a
> little bit confused, so
> 
> - What is the purpose of TEXT_COMPOUND_ID, is it only as a marking to
> indicate this part of text have different attribute style or it is
> planned as a replacement for TEXT_COMPOUND_DELIMITER ?

   Currently it is just marking what parts of text might have different
styling.

> - and the code  e =
> (Element)((SoftReference)aci.getAttribute(TEXT_COMPOUND_ID)).get(); will
> return plain Object instead of element, since TEXT_COMPOUND_ID is just
> "New Object()"

   Correct, right now.

   I was going to make it a SoftReference but it felt very odd to be 
binding
a SoftReference and a hard reference.  So I decided to wait and check if
the move to remove TEXT_COMPOUND_DELIMITER was a go or not.  Since it 
looks
like it is I will make TEXT_COMPOUND_ID a SoftReference, and start 
replacing
use of the TCD, with TCI.

   Note that the SoftReference (even when cleared) serves just as well
for simply delimiting parts of the text that might be styled differently.


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


Re: svn commit: r388911 - TEXT_COMPOUND_DELIMITER

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

>    Just to be clear TEXT_COMPOUND_ID is currently just a 'new Object()'. 
> So this would be a small additional change to make TEXT_COMPOUND_ID a 
> soft reference. As long as you currently always build your documents 
> as dynamic the change should be as simple as:
> 
>         Element e;
>         e = (Element)aci.getAttribute(TEXT_COMPOUND_DELIMITER);
> 
> With:
>         e = 
> (Element)((SoftReference)aci.getAttribute(TEXT_COMPOUND_ID)).get();

I look at the batik source code in related of TEXT_COMPONENT_ID, and a
little bit confused, so

- What is the purpose of TEXT_COMPOUND_ID, is it only as a marking to
indicate this part of text have different attribute style or it is
planned as a replacement for TEXT_COMPOUND_DELIMITER ?

- and the code  e =
(Element)((SoftReference)aci.getAttribute(TEXT_COMPOUND_ID)).get(); will
return plain Object instead of element, since TEXT_COMPOUND_ID is just
"New Object()"

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


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


Re: svn commit: r388911 - TEXT_COMPOUND_DELIMITER

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

Tonny Kohar <to...@kiyut.com> wrote on 03/26/2006 09:29:12 PM:

> On Sun, 2006-03-26 at 10:11 -0500, thomas.deweese@kodak.com wrote:
> > Hi all,
> > 
> >    I am curious to hear how/if people are using 
TEXT_COMPOUND_DELIMITER.
> 
> I am heavy usage on TEXT_COMPOUND_DELIMITER. It is used in our inline
> editing Text Editor Component.

   I figured there were users out there.

> >    The solution I committed is maximally backwards compatible but has 
some 
> > ugliness to it.  My preferred solution would be to remove 
TEXT_COMPOUND_DELIMITER
> > completely and instead use TEXT_COMPOUND_ID as a soft reference to the 

> > Element. 
> 
> I will look at how the new TEXT_COMPOUND_ID as a replacement for
> TEXT_COMPOUND_DELIMITER.

   Just to be clear TEXT_COMPOUND_ID is currently just a 'new Object()'. 
So this would be a small additional change to make TEXT_COMPOUND_ID a 
soft reference. As long as you currently always build your documents 
as dynamic the change should be as simple as:

        Element e;
        e = (Element)aci.getAttribute(TEXT_COMPOUND_DELIMITER);

With:
        e = 
(Element)((SoftReference)aci.getAttribute(TEXT_COMPOUND_ID)).get();

   As the soft reference should never go to GC since the DOM will be held 
by
the Canvas (and a million other references) in the Dynamic case.

   The advantage of the current code is that it allows the document to
go to GC for static documents w/o any impact on users code.  The proposed 
change
is a minimally impactful change, but a change none the less.


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


Re: svn commit: r388911 - TEXT_COMPOUND_DELIMITER

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

Tonny Kohar <to...@kiyut.com> wrote on 03/26/2006 09:29:12 PM:

> On Sun, 2006-03-26 at 10:11 -0500, thomas.deweese@kodak.com wrote:
> > Hi all,
> > 
> >    I am curious to hear how/if people are using 
TEXT_COMPOUND_DELIMITER.
> 
> I am heavy usage on TEXT_COMPOUND_DELIMITER. It is used in our inline
> editing Text Editor Component.

   I figured there were users out there.

> >    The solution I committed is maximally backwards compatible but has 
some 
> > ugliness to it.  My preferred solution would be to remove 
TEXT_COMPOUND_DELIMITER
> > completely and instead use TEXT_COMPOUND_ID as a soft reference to the 

> > Element. 
> 
> I will look at how the new TEXT_COMPOUND_ID as a replacement for
> TEXT_COMPOUND_DELIMITER.

   Just to be clear TEXT_COMPOUND_ID is currently just a 'new Object()'. 
So this would be a small additional change to make TEXT_COMPOUND_ID a 
soft reference. As long as you currently always build your documents 
as dynamic the change should be as simple as:

        Element e;
        e = (Element)aci.getAttribute(TEXT_COMPOUND_DELIMITER);

With:
        e = 
(Element)((SoftReference)aci.getAttribute(TEXT_COMPOUND_ID)).get();

   As the soft reference should never go to GC since the DOM will be held 
by
the Canvas (and a million other references) in the Dynamic case.

   The advantage of the current code is that it allows the document to
go to GC for static documents w/o any impact on users code.  The proposed 
change
is a minimally impactful change, but a change none the less.


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


Re: svn commit: r388911 - TEXT_COMPOUND_DELIMITER

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

On Sun, 2006-03-26 at 10:11 -0500, thomas.deweese@kodak.com wrote:
> Hi all,
> 
>    I am curious to hear how/if people are using TEXT_COMPOUND_DELIMITER.

I am heavy usage on TEXT_COMPOUND_DELIMITER. It is used in our inline
editing Text Editor Component.
>    The solution I committed is maximally backwards compatible but has some 
> uglyness
> to it.  My proffered solution would be to remove TEXT_COMPOUND_DELIMITER
> completely and instead use TEXT_COMPOUND_ID as a soft reference to the 
> Element. 

I will look at how the new TEXT_COMPOUND_ID as a replacement for
TEXT_COMPOUND_DELIMITER.

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


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


Re: svn commit: r388911 - TEXT_COMPOUND_DELIMITER

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

   I am curious to hear how/if people are using TEXT_COMPOUND_DELIMITER.

   The solution I committed is maximally backwards compatible but has some 
uglyness
to it.  My proffered solution would be to remove TEXT_COMPOUND_DELIMITER
completely and instead use TEXT_COMPOUND_ID as a soft reference to the 
Element. 

   This would clean up the code a bit and make the behavior a little less 
modal than
it currently is.  Would this be a significant problem for anyone?

deweese@apache.org wrote on 03/26/2006 09:40:51 AM:

> 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.


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