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 2005/10/23 21:04:23 UTC
svn commit: r327838 - in /xmlgraphics/batik/branches/svg11: lib/
samples/tests/spec12/text/ sources/org/apache/batik/bridge/
sources/org/apache/batik/bridge/svg12/ sources/org/apache/batik/gvt/
sources/org/apache/batik/gvt/flow/
Author: deweese
Date: Sun Oct 23 12:03:39 2005
New Revision: 327838
URL: http://svn.apache.org/viewcvs?rev=327838&view=rev
Log:
Flow text fixes from trunk branch
Modified:
xmlgraphics/batik/branches/svg11/lib/pdf-transcoder.jar
xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowBidi.svg
xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowRegionBreak.svg
xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText.svg
xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText2.svg
xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText3.svg
xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText4.svg
xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText5.svg
xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowTextAlign.svg
xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/lineHeightFontShorthand.svg
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/gvt/TextNode.java
xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/flow/FlowGlyphLayout.java
Modified: xmlgraphics/batik/branches/svg11/lib/pdf-transcoder.jar
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/lib/pdf-transcoder.jar?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
Binary files - no diff available.
Modified: xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowBidi.svg
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowBidi.svg?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowBidi.svg (original)
+++ xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowBidi.svg Sun Oct 23 12:03:39 2005
@@ -52,8 +52,8 @@
<flowRoot font-size="20" xml:space="preserve">
<flowRegion>
- <rect x="17" y="80" width="200" height="200"/>
- <rect x="233" y="80" width="200" height="200"/>
+ <rect x="17" y="80" width="200" height="200" visibility="hidden"/>
+ <rect x="233" y="80" width="200" height="200" visibility="hidden"/>
</flowRegion>
<flowDiv>
@@ -67,7 +67,7 @@
<flowRegion>
<path d="M 17,290 v150 h200 v-150 z
M 220,290 v150 h10 v-150 z
- M 233,290 v150 h200 v-150 z"/>
+ M 233,290 v150 h200 v-150 z" visibility="hidden"/>
</flowRegion>
<flowDiv>
Modified: xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowRegionBreak.svg
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowRegionBreak.svg?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowRegionBreak.svg (original)
+++ xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowRegionBreak.svg Sun Oct 23 12:03:39 2005
@@ -48,10 +48,10 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="15"/>
- <rect x="10" y="30" width="100" height="15"/>
- <rect x="10" y="50" width="100" height="15"/>
- <rect x="10" y="70" width="100" height="15"/>
+ <rect x="10" y="10" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="30" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="50" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="70" width="100" height="15" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -73,10 +73,10 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="15"/>
- <rect x="10" y="30" width="100" height="15"/>
- <rect x="10" y="50" width="100" height="15"/>
- <rect x="10" y="70" width="100" height="15"/>
+ <rect x="10" y="10" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="30" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="50" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="70" width="100" height="15" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -97,10 +97,10 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="15"/>
- <rect x="10" y="30" width="100" height="15"/>
- <rect x="10" y="50" width="100" height="15"/>
- <rect x="10" y="70" width="100" height="15"/>
+ <rect x="10" y="10" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="30" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="50" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="70" width="100" height="15" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -119,10 +119,10 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="15"/>
- <rect x="10" y="30" width="100" height="15"/>
- <rect x="10" y="50" width="100" height="15"/>
- <rect x="10" y="70" width="100" height="15"/>
+ <rect x="10" y="10" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="30" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="50" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="70" width="100" height="15" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -144,10 +144,10 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="15"/>
- <rect x="10" y="30" width="100" height="15"/>
- <rect x="10" y="50" width="100" height="15"/>
- <rect x="10" y="70" width="100" height="15"/>
+ <rect x="10" y="10" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="30" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="50" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="70" width="100" height="15" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -168,10 +168,10 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="15"/>
- <rect x="10" y="30" width="100" height="15"/>
- <rect x="10" y="50" width="100" height="15"/>
- <rect x="10" y="70" width="100" height="15"/>
+ <rect x="10" y="10" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="30" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="50" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="70" width="100" height="15" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -193,10 +193,10 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="15"/>
- <rect x="10" y="30" width="100" height="15"/>
- <rect x="10" y="50" width="100" height="15"/>
- <rect x="10" y="70" width="100" height="15"/>
+ <rect x="10" y="10" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="30" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="50" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="70" width="100" height="15" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -217,10 +217,10 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="15"/>
- <rect x="10" y="30" width="100" height="15"/>
- <rect x="10" y="50" width="100" height="15"/>
- <rect x="10" y="70" width="100" height="15"/>
+ <rect x="10" y="10" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="30" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="50" width="100" height="15" visibility="hidden"/>
+ <rect x="10" y="70" width="100" height="15" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -240,8 +240,8 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="30"/>
- <rect x="10" y="45" width="100" height="30"/>
+ <rect x="10" y="10" width="100" height="30" visibility="hidden"/>
+ <rect x="10" y="45" width="100" height="30" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -260,8 +260,8 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="30"/>
- <rect x="10" y="45" width="100" height="30"/>
+ <rect x="10" y="10" width="100" height="30" visibility="hidden"/>
+ <rect x="10" y="45" width="100" height="30" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -280,8 +280,8 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="30"/>
- <rect x="10" y="45" width="100" height="30"/>
+ <rect x="10" y="10" width="100" height="30" visibility="hidden"/>
+ <rect x="10" y="45" width="100" height="30" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -297,8 +297,8 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="30"/>
- <rect x="10" y="45" width="100" height="30"/>
+ <rect x="10" y="10" width="100" height="30" visibility="hidden"/>
+ <rect x="10" y="45" width="100" height="30" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -317,8 +317,8 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="30"/>
- <rect x="10" y="45" width="100" height="30"/>
+ <rect x="10" y="10" width="100" height="30" visibility="hidden"/>
+ <rect x="10" y="45" width="100" height="30" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -337,8 +337,8 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="30"/>
- <rect x="10" y="45" width="100" height="30"/>
+ <rect x="10" y="10" width="100" height="30" visibility="hidden"/>
+ <rect x="10" y="45" width="100" height="30" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -357,8 +357,8 @@
<flowRoot font-size="20" fill="black">
<flowRegion>
- <rect x="10" y="10" width="100" height="30"/>
- <rect x="10" y="45" width="100" height="30"/>
+ <rect x="10" y="10" width="100" height="30" visibility="hidden"/>
+ <rect x="10" y="45" width="100" height="30" visibility="hidden"/>
</flowRegion>
<flowDiv font-size="12">
@@ -372,4 +372,4 @@
</g>
-</svg>
\ No newline at end of file
+</svg>
Modified: xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText.svg
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText.svg?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText.svg (original)
+++ xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText.svg Sun Oct 23 12:03:39 2005
@@ -48,8 +48,8 @@
<flowRoot font-size="20">
<flowRegion>
- <rect x="17" y="80" width="200" height="400"/>
- <rect x="233" y="80" width="200" height="400"/>
+ <rect x="17" y="80" width="200" height="400" visibility="hidden"/>
+ <rect x="233" y="80" width="200" height="400" visibility="hidden"/>
</flowRegion>
<flowDiv>
Modified: xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText2.svg
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText2.svg?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText2.svg (original)
+++ xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText2.svg Sun Oct 23 12:03:39 2005
@@ -55,9 +55,9 @@
<flowRoot font-size="20">
<flowRegion>
- <path d="M 67,80 l-50,400 h200 l-50,-400 z"/>
- <!-- <rect x="17" y="80" width="200" height="400"/> -->
- <rect x="233" y="80" width="200" height="400"/>
+ <path d="M 67,80 l-50,400 h200 l-50,-400 z" visibility="hidden"/>
+ <!-- <rect x="17" y="80" width="200" height="400" visibility="hidden"/> -->
+ <rect x="233" y="80" width="200" height="400" visibility="hidden"/>
</flowRegion>
<flowDiv>
Modified: xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText3.svg
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText3.svg?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText3.svg (original)
+++ xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText3.svg Sun Oct 23 12:03:39 2005
@@ -52,7 +52,7 @@
<flowRegion>
<path d="M 17,80 v400 h200 v-400 z
M 220,80 v400 h10 v-400 z
- M 233,80 v400 h200 v-400 z"/>
+ M 233,80 v400 h200 v-400 z" visibility="hidden"/>
</flowRegion>
<flowDiv>
Modified: xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText4.svg
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText4.svg?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText4.svg (original)
+++ xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText4.svg Sun Oct 23 12:03:39 2005
@@ -45,9 +45,9 @@
>B</text>
<flowRoot font-size="10">
<flowRegion>
- <text x="225" y="450" font-size="500" font-weight="bold" text-anchor="middle">B</text>
- <!-- <rect x="17" y="80" width="200" height="400"/>
- <rect x="233" y="80" width="200" height="400"/>-->
+ <text x="225" y="450" font-size="500" font-weight="bold" text-anchor="middle" visibility="hidden">B</text>
+ <!-- <rect x="17" y="80" width="200" height="400" visibility="hidden"/>
+ <rect x="233" y="80" width="200" height="400" visibility="hidden"/>-->
</flowRegion>
<flowDiv>
Modified: xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText5.svg
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText5.svg?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText5.svg (original)
+++ xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowText5.svg Sun Oct 23 12:03:39 2005
@@ -44,7 +44,7 @@
<g transform="rotate(-45, 200, 200)">
<flowRoot font-size="15.75">
<flowRegion>
- <use transform="rotate(45, 200, 200)" width="400" height="400" xlink:href="../../../batikLogo.svg#Batik_Squiggle" />
+ <use transform="rotate(45, 200, 200)" width="400" height="400" visibility="hidden" xlink:href="../../../batikLogo.svg#Batik_Squiggle" />
</flowRegion>
<flowDiv>
@@ -74,11 +74,11 @@
<g transform="rotate(-45, 200, 200)">
<flowRoot font-size="16.5">
<flowRegion>
- <use transform="rotate(45, 200, 200), scale(.73,.73)"
+ <use transform="rotate(45, 200, 200), scale(.73,.73)" visibility="hidden"
xlink:href="../../../batikLogo.svg#Batik_Squiggle_Blue"/>
- <use transform="rotate(45, 200, 200), scale(.73,.73)"
+ <use transform="rotate(45, 200, 200), scale(.73,.73)" visibility="hidden"
xlink:href="../../../batikLogo.svg#Batik_Squiggle_Red"/>
- <use transform="rotate(45, 200, 200), scale(.73,.73)"
+ <use transform="rotate(45, 200, 200), scale(.73,.73)" visibility="hidden"
xlink:href="../../../batikLogo.svg#Batik_Squiggle_Green"/>
</flowRegion>
Modified: xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowTextAlign.svg
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowTextAlign.svg?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowTextAlign.svg (original)
+++ xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/flowTextAlign.svg Sun Oct 23 12:03:39 2005
@@ -46,13 +46,13 @@
<flowText xmlns="http://xml.apache.org/batik/ext"
font-size="24" xml:space="preserve">
<flowRegion vertical-align="top">
- <rect x="12.5" y="0" width="125" height="36"/>
+ <rect x="12.5" y="0" width="125" height="36" visibility="hidden"/>
</flowRegion>
<flowRegion vertical-align="middle">
- <rect x="162.5" y="0" width="125" height="36"/>
+ <rect x="162.5" y="0" width="125" height="36" visibility="hidden"/>
</flowRegion>
<flowRegion vertical-align="bottom">
- <rect x="312.5" y="0" width="125" height="36"/>
+ <rect x="312.5" y="0" width="125" height="36" visibility="hidden"/>
</flowRegion>
<flowDiv>
<flowRegionBreak justification="middle"
@@ -78,16 +78,16 @@
<flowText xmlns="http://xml.apache.org/batik/ext"
font-size="24" xml:space="preserve">
<flowRegion vertical-align="top">
- <rect x="12.5" y="0" width="125" height="36"/>
- <rect x="12.5" y="40" width="125" height="36"/>
+ <rect x="12.5" y="0" width="125" height="36" visibility="hidden"/>
+ <rect x="12.5" y="40" width="125" height="36" visibility="hidden"/>
</flowRegion>
<flowRegion vertical-align="middle">
- <rect x="162.5" y="0" width="125" height="36"/>
- <rect x="162.5" y="40" width="125" height="36"/>
+ <rect x="162.5" y="0" width="125" height="36" visibility="hidden"/>
+ <rect x="162.5" y="40" width="125" height="36" visibility="hidden"/>
</flowRegion>
<flowRegion vertical-align="bottom">
- <rect x="312.5" y="0" width="125" height="36"/>
- <rect x="312.5" y="40" width="125" height="36"/>
+ <rect x="312.5" y="0" width="125" height="36" visibility="hidden"/>
+ <rect x="312.5" y="40" width="125" height="36" visibility="hidden"/>
</flowRegion>
<flowDiv>
<flowRegionBreak justification="middle"
@@ -110,13 +110,13 @@
<flowText xmlns="http://xml.apache.org/batik/ext"
font-size="24" xml:space="preserve">
<flowRegion vertical-align="top">
- <rect x="12.5" y="0" width="125" height="72"/>
+ <rect x="12.5" y="0" width="125" height="72" visibility="hidden"/>
</flowRegion>
<flowRegion vertical-align="middle">
- <rect x="162.5" y="0" width="125" height="72"/>
+ <rect x="162.5" y="0" width="125" height="72" visibility="hidden"/>
</flowRegion>
<flowRegion vertical-align="bottom">
- <rect x="312.5" y="0" width="125" height="72"/>
+ <rect x="312.5" y="0" width="125" height="72" visibility="hidden"/>
</flowRegion>
<flowDiv>
<flowRegionBreak justification="middle"
@@ -139,13 +139,13 @@
<flowText xmlns="http://xml.apache.org/batik/ext"
font-size="24" xml:space="preserve">
<flowRegion vertical-align="top">
- <rect x="12.5" y="0" width="125" height="72"/>
+ <rect x="12.5" y="0" width="125" height="72" visibility="hidden"/>
</flowRegion>
<flowRegion vertical-align="middle">
- <rect x="162.5" y="0" width="125" height="72"/>
+ <rect x="162.5" y="0" width="125" height="72" visibility="hidden"/>
</flowRegion>
<flowRegion vertical-align="bottom">
- <rect x="312.5" y="0" width="125" height="72"/>
+ <rect x="312.5" y="0" width="125" height="72" visibility="hidden"/>
</flowRegion>
<flowDiv>
<flowPara justification="middle"
Modified: xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/lineHeightFontShorthand.svg
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/lineHeightFontShorthand.svg?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/lineHeightFontShorthand.svg (original)
+++ xmlgraphics/batik/branches/svg11/samples/tests/spec12/text/lineHeightFontShorthand.svg Sun Oct 23 12:03:39 2005
@@ -48,6 +48,7 @@
.f7 { font: italic bold 20/15px times; }
.f8 { font: 700 20/1em times; }
.f9 { font: 700 20/75% times; }
+ flowRegion > rect { fill: none; }
]]></style>
<g id="testContent" font="8pt sanserif">
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=327838&r1=327837&r2=327838&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 Oct 23 12:03:39 2005
@@ -498,12 +498,17 @@
protected void computeLaidoutText(BridgeContext ctx,
Element e,
GraphicsNode node) {
+ TextNode tn = (TextNode)node;
AttributedString as = buildAttributedString(ctx, e);
+ if (as == null) {
+ tn.setAttributedCharacterIterator(null);
+ return;
+ }
+
addGlyphPositionAttributes(as, e, ctx);
if (ctx.isDynamic()) {
laidoutText = new AttributedString(as.getIterator());
}
- TextNode tn = (TextNode)node;
elemTPI.clear();
// Add null TPI objects to the text (after we set it on the
// Text we will swap in the correct values.
@@ -706,6 +711,8 @@
return;
TextNode tn = (TextNode)node;
+ if (tn.getAttributedCharacterIterator() == null)
+ return;
TextPaintInfo pi, oldPI;
if ( cssProceedElement == e ){
@@ -735,6 +742,8 @@
int getElementStartIndex
(AttributedCharacterIterator aci, Element element) {
+ if (aci == null) return -1;
+
// calculate which chars in the string belong to this element
for (int i = 0; i < aci.getEndIndex();) {
aci.setIndex(i);
@@ -749,6 +758,8 @@
int getElementEndIndex
(AttributedCharacterIterator aci, Element element) {
+ if (aci == null) return -1;
+
// calculate which chars in the string belong to this element
for (int i = aci.getEndIndex()-1; i >= 0;) {
aci.setIndex(i);
@@ -1084,7 +1095,7 @@
public AttributedString toAttributedString() {
switch (count) {
case 0:
- return new AttributedString(" ");
+ return null;
case 1:
return new AttributedString((String)strings.get(0),
(Map)attributes.get(0));
@@ -1656,8 +1667,10 @@
*/
protected TextPaintInfo getParentTextPaintInfo
(AttributedCharacterIterator aci, Element child) {
- Element parent = null;
+ if (aci == null)
+ return new TextPaintInfo();
+ Element parent = null;
// calculate which chars in the string belong to the parent
int firstChar = -1;
for (int i = 0; i < aci.getEndIndex();) {
@@ -2156,7 +2169,10 @@
*/
protected int getNumberOfChars(Element element){
- AttributedCharacterIterator aci = ((TextNode)node).getAttributedCharacterIterator();
+ AttributedCharacterIterator aci;
+ aci = ((TextNode)node).getAttributedCharacterIterator();
+ if (aci == null)
+ return 0;
//get the index in the aci for the first character
//of the element
@@ -2179,6 +2195,7 @@
AttributedCharacterIterator aci;
aci = ((TextNode)node).getAttributedCharacterIterator();
+ if (aci == null) return null;
int firstChar = getElementStartIndex(aci,element);
@@ -2233,10 +2250,12 @@
*/
protected Point2D getStartPositionOfChar(Element element,int charnum){
- AttributedCharacterIterator aci = ((TextNode)node).getAttributedCharacterIterator();
+ AttributedCharacterIterator aci;
+ aci = ((TextNode)node).getAttributedCharacterIterator();
+ if (aci == null)
+ return null;
int firstChar = getElementStartIndex(aci,element);
-
if ( firstChar == -1 )
return null;
@@ -2284,9 +2303,10 @@
AttributedCharacterIterator aci;
aci = ((TextNode)node).getAttributedCharacterIterator();
+ if (aci == null)
+ return null;
int firstChar = getElementStartIndex(aci,element);
-
if ( firstChar == -1 )
return null;
@@ -2335,9 +2355,11 @@
AttributedCharacterIterator aci;
aci = ((TextNode)node).getAttributedCharacterIterator();
+ if (aci == null)
+ return 0;
+
//first the first character for the element
int firstChar = getElementStartIndex(aci,element);
-
if ( firstChar == -1 )
return 0;
@@ -2414,8 +2436,10 @@
AttributedCharacterIterator aci;
aci = ((TextNode)node).getAttributedCharacterIterator();
- TextNode textNode = (TextNode)node;
+ if (aci == null)
+ return -1;
+ TextNode textNode = (TextNode)node;
int firstChar = getElementStartIndex(aci,element);
if ( firstChar == -1 )
@@ -2548,8 +2572,10 @@
protected void selectSubString(Element element, int charnum, int nchars) {
AttributedCharacterIterator aci;
aci = ((TextNode)node).getAttributedCharacterIterator();
- TextNode textNode = (TextNode)node;
+ if (aci == null)
+ return;
+ TextNode textNode = (TextNode)node;
int firstChar = getElementStartIndex(aci,element);
if ( firstChar == -1 )
@@ -2579,6 +2605,10 @@
protected int getCharNumAtPosition(Element e, float x, float y){
TextNode textNode = (TextNode)node;
+ AttributedCharacterIterator aci;
+ aci = textNode.getAttributedCharacterIterator();
+ if (aci == null)
+ return -1;
//check if there is an hit
List list = getTextRuns(textNode);
@@ -2588,15 +2618,14 @@
TextHit hit = null;
for( int i = list.size()-1 ; i>= 0 && hit == null; i-- ){
-
- hit = ((StrokingTextPainter.TextRun)list.get(i)).getLayout().hitTestChar(x,y);
+ StrokingTextPainter.TextRun textRun;
+ textRun = (StrokingTextPainter.TextRun)list.get(i);
+ hit = textRun.getLayout().hitTestChar(x,y);
}
- if ( hit == null ){
+ if ( hit == null )
return -1;
- }
- AttributedCharacterIterator aci = ((TextNode)node).getAttributedCharacterIterator();
//found an hit, check if it belong to the element
int first = getElementStartIndex( aci, e );
@@ -2604,13 +2633,10 @@
int hitIndex = hit.getCharIndex();
- if ( hitIndex >= first && hitIndex <= last ){
-
+ if ( hitIndex >= first && hitIndex <= last )
return hitIndex - first;
- }
- else{
- return -1;
- }
+
+ return -1;
}
/**
@@ -2652,34 +2678,35 @@
info.characterIndex = startIndex+charnum;
for (int i = 0; i < list.size(); i++) {
- StrokingTextPainter.TextRun run =
- (StrokingTextPainter.TextRun)list.get(i);
-
- if ( run.getLayout().hasCharacterIndex(info.characterIndex) ){
- info.layout = run.getLayout();
+ StrokingTextPainter.TextRun run;
+ run = (StrokingTextPainter.TextRun)list.get(i);
- aci.setIndex(info.characterIndex);
+ if (!run.getLayout().hasCharacterIndex(info.characterIndex) )
+ continue;
- //check is it is a altGlyph
- if (aci.getAttribute(ALT_GLYPH_HANDLER) != null){
+ info.layout = run.getLayout();
+
+ aci.setIndex(info.characterIndex);
+
+ //check is it is a altGlyph
+ if (aci.getAttribute(ALT_GLYPH_HANDLER) != null){
+ info.glyphIndexStart = 0;
+ info.glyphIndexEnd = info.layout.getGlyphCount()-1;
+ } else {
+ info.glyphIndexStart = info.layout.getGlyphIndex
+ (info.characterIndex);
+
+ //special case when the glyph does not have a unicode
+ //associated to it, it will return -1
+ if ( info.glyphIndexStart == -1 ){
info.glyphIndexStart = 0;
info.glyphIndexEnd = info.layout.getGlyphCount()-1;
- } else {
- info.glyphIndexStart = info.layout.getGlyphIndex
- (info.characterIndex);
-
- //special case when the glyph does not have a unicode
- //associated to it, it will return -1
- if ( info.glyphIndexStart == -1 ){
- info.glyphIndexStart = 0;
- info.glyphIndexEnd = info.layout.getGlyphCount()-1;
- }
- else{
- info.glyphIndexEnd = info.glyphIndexStart;
- }
}
- return info;
+ else{
+ info.glyphIndexEnd = info.glyphIndexStart;
+ }
}
+ return info;
}
return null;
}
@@ -2712,9 +2739,13 @@
public Set getTextIntersectionSet(AffineTransform at,
Rectangle2D rect) {
+ Set elems = new HashSet();
+
TextNode tn = (TextNode)node;
List list = tn.getTextRuns();
- Set elems = new HashSet();
+ if (list == null)
+ return elems;
+
for (int i = 0 ; i < list.size(); i++) {
StrokingTextPainter.TextRun run;
run = (StrokingTextPainter.TextRun)list.get(i);
@@ -2755,8 +2786,11 @@
TextNode tn = (TextNode)node;
Set elems = new HashSet();
- Set reject = new HashSet();
List list = tn.getTextRuns();
+ if (list == null)
+ return elems;
+
+ Set reject = new HashSet();
for (int i = 0 ; i < list.size(); i++) {
StrokingTextPainter.TextRun run;
run = (StrokingTextPainter.TextRun)list.get(i);
@@ -2809,6 +2843,10 @@
if (txtBridge == null) return false;
TextNode tn = (TextNode)txtBridge.node;
+ List list = tn.getTextRuns();
+ if (list == null)
+ return false;
+
Element txtElem = txtBridge.e;
AffineTransform at = tn.getGlobalTransform();
@@ -2819,7 +2857,6 @@
tnRect = at.createTransformedShape(tnRect).getBounds2D();
if (!rect.intersects(tnRect)) return false;
- List list = tn.getTextRuns();
for (int i = 0 ; i < list.size(); i++) {
StrokingTextPainter.TextRun run;
run = (StrokingTextPainter.TextRun)list.get(i);
@@ -2877,11 +2914,13 @@
if (txtBridge == null) return null;
TextNode tn = (TextNode)txtBridge.node;
- Element txtElem = txtBridge.e;
+ List list = tn.getTextRuns();
+ if (list == null)
+ return null;
+ Element txtElem = txtBridge.e;
Rectangle2D ret = null;
- List list = tn.getTextRuns();
- if (list == null) return null;
+
for (int i = 0 ; i < list.size(); i++) {
StrokingTextPainter.TextRun run;
run = (StrokingTextPainter.TextRun)list.get(i);
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=327838&r1=327837&r2=327838&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 Oct 23 12:03:39 2005
@@ -1,6 +1,6 @@
/*
- Copyright 1999-2003 The Apache Software Foundation
+ Copyright 1999-2003,2005 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -18,14 +18,15 @@
package org.apache.batik.bridge.svg12;
+import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.font.TextAttribute;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.LinkedList;
@@ -36,15 +37,12 @@
import org.w3c.dom.events.EventTarget;
import org.apache.batik.bridge.Bridge;
-import org.apache.batik.bridge.BridgeException;
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.CSSUtilities;
-import org.apache.batik.bridge.GraphicsNodeBridge;
import org.apache.batik.bridge.GVTBuilder;
import org.apache.batik.bridge.SVGTextElementBridge;
import org.apache.batik.bridge.SVGUtilities;
import org.apache.batik.bridge.TextUtilities;
-import org.apache.batik.bridge.UnitProcessor;
import org.apache.batik.bridge.UserAgent;
import org.apache.batik.bridge.SVGAElementBridge;
@@ -56,9 +54,12 @@
import org.apache.batik.css.engine.value.Value;
import org.apache.batik.css.engine.value.ValueConstants;
+import org.apache.batik.dom.svg.SVGOMElement;
+import org.apache.batik.dom.svg12.SVGOMFlowRegionElement;
import org.apache.batik.dom.util.XMLSupport;
import org.apache.batik.dom.util.XLinkSupport;
+import org.apache.batik.gvt.CompositeGraphicsNode;
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.gvt.TextNode;
import org.apache.batik.gvt.flow.BlockInfo;
@@ -67,11 +68,11 @@
import org.apache.batik.gvt.flow.TextLineBreaks;
import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
-import org.apache.batik.gvt.text.TextPaintInfo;
import org.apache.batik.gvt.text.TextPath;
import org.apache.batik.util.SVG12Constants;
import org.apache.batik.util.SVG12CSSConstants;
+import org.apache.batik.util.XMLConstants;
/**
* Bridge class for the <flowRoot> element.
@@ -81,21 +82,50 @@
*/
public class SVGFlowRootElementBridge extends SVGTextElementBridge {
- public static final AttributedCharacterIterator.Attribute FLOW_PARAGRAPH
- = GVTAttributedCharacterIterator.TextAttribute.FLOW_PARAGRAPH;
+ public static final
+ AttributedCharacterIterator.Attribute FLOW_PARAGRAPH =
+ GVTAttributedCharacterIterator.TextAttribute.FLOW_PARAGRAPH;
+
+ public static final
+ AttributedCharacterIterator.Attribute FLOW_EMPTY_PARAGRAPH =
+ GVTAttributedCharacterIterator.TextAttribute.FLOW_EMPTY_PARAGRAPH;
+
+ public static final
+ AttributedCharacterIterator.Attribute FLOW_LINE_BREAK =
+ GVTAttributedCharacterIterator.TextAttribute.FLOW_LINE_BREAK;
+
+ public static final
+ AttributedCharacterIterator.Attribute FLOW_REGIONS =
+ GVTAttributedCharacterIterator.TextAttribute.FLOW_REGIONS;
+
+ public static final
+ AttributedCharacterIterator.Attribute LINE_HEIGHT =
+ GVTAttributedCharacterIterator.TextAttribute.LINE_HEIGHT;
- public static final AttributedCharacterIterator.Attribute
- FLOW_EMPTY_PARAGRAPH
- = GVTAttributedCharacterIterator.TextAttribute.FLOW_EMPTY_PARAGRAPH;
+ public final static
+ GVTAttributedCharacterIterator.TextAttribute TEXTPATH =
+ GVTAttributedCharacterIterator.TextAttribute.TEXTPATH;
- public static final AttributedCharacterIterator.Attribute FLOW_LINE_BREAK
- = GVTAttributedCharacterIterator.TextAttribute.FLOW_LINE_BREAK;
-
- public static final AttributedCharacterIterator.Attribute FLOW_REGIONS
- = GVTAttributedCharacterIterator.TextAttribute.FLOW_REGIONS;
+ public final static
+ GVTAttributedCharacterIterator.TextAttribute ANCHOR_TYPE =
+ GVTAttributedCharacterIterator.TextAttribute.ANCHOR_TYPE;
- public static final AttributedCharacterIterator.Attribute LINE_HEIGHT
- = GVTAttributedCharacterIterator.TextAttribute.LINE_HEIGHT;
+ public final static
+ GVTAttributedCharacterIterator.TextAttribute LETTER_SPACING =
+ GVTAttributedCharacterIterator.TextAttribute.LETTER_SPACING;
+
+ public final static
+ GVTAttributedCharacterIterator.TextAttribute WORD_SPACING =
+ GVTAttributedCharacterIterator.TextAttribute.WORD_SPACING;
+
+ public final static
+ GVTAttributedCharacterIterator.TextAttribute KERNING =
+ GVTAttributedCharacterIterator.TextAttribute.KERNING;
+
+ /**
+ * Map of flowRegion elements to their graphics nodes.
+ */
+ protected Map flowRegionNodes;
/**
* Constructs a new bridge for the <flowRoot> element.
@@ -130,6 +160,59 @@
return false;
}
+ /**
+ * Creates a <tt>GraphicsNode</tt> according to the specified parameters.
+ *
+ * @param ctx the bridge context to use
+ * @param e the element that describes the graphics node to build
+ * @return a graphics node that represents the specified element
+ */
+ public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
+ // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage'
+ if (!SVGUtilities.matchUserAgent(e, ctx.getUserAgent())) {
+ return null;
+ }
+
+ CompositeGraphicsNode cgn = new CompositeGraphicsNode();
+
+ // 'transform'
+ String s = e.getAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE);
+ if (s.length() != 0) {
+ cgn.setTransform
+ (SVGUtilities.convertTransform(e, SVG_TRANSFORM_ATTRIBUTE, s));
+ }
+ // 'visibility'
+ cgn.setVisible(CSSUtilities.convertVisibility(e));
+
+ // 'text-rendering' and 'color-rendering'
+ RenderingHints hints = null;
+ hints = CSSUtilities.convertColorRendering(e, hints);
+ hints = CSSUtilities.convertTextRendering (e, hints);
+ if (hints != null) {
+ cgn.setRenderingHints(hints);
+ }
+
+ // first child holds the flow region nodes
+ CompositeGraphicsNode cgn2 = new CompositeGraphicsNode();
+ cgn.add(cgn2);
+
+ // second child is the text node
+ FlowTextNode tn = (FlowTextNode)instantiateGraphicsNode();
+ tn.setLocation(getLocation(ctx, e));
+
+ // specify the text painter to use
+ if (ctx.getTextPainter() != null) {
+ tn.setTextPainter(ctx.getTextPainter());
+ }
+
+ cgn.add(tn);
+
+ return cgn;
+ }
+
+ /**
+ * Creates the graphics node for this element.
+ */
protected GraphicsNode instantiateGraphicsNode() {
return new FlowTextNode();
}
@@ -168,6 +251,53 @@
nodeName.equals(SVG12Constants.SVG_FLOW_SPAN_TAG));
}
+ /**
+ * Builds using the specified BridgeContext and element, the
+ * specified graphics node.
+ *
+ * @param ctx the bridge context to use
+ * @param e the element that describes the graphics node to build
+ * @param node the graphics node to build
+ */
+ public void buildGraphicsNode(BridgeContext ctx,
+ Element e,
+ GraphicsNode node) {
+ CompositeGraphicsNode cgn = (CompositeGraphicsNode) node;
+
+ // build flowRegion shapes
+ boolean isStatic = !ctx.isDynamic();
+ if (isStatic) {
+ flowRegionNodes = new HashMap();
+ }
+ CompositeGraphicsNode cgn2 = (CompositeGraphicsNode) cgn.get(0);
+ GVTBuilder builder = ctx.getGVTBuilder();
+ for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) {
+ if (n instanceof SVGOMFlowRegionElement) {
+ for (Node m = n.getFirstChild();
+ m != null;
+ m = m.getNextSibling()) {
+ if (m.getNodeType() != Node.ELEMENT_NODE) {
+ continue;
+ }
+ GraphicsNode gn = builder.build(ctx, (Element) m);
+ if (gn != null) {
+ cgn2.add(gn);
+ if (isStatic) {
+ flowRegionNodes.put(m, gn);
+ }
+ }
+ }
+ }
+ }
+
+ // build text node
+ GraphicsNode tn = (GraphicsNode) cgn.get(1);
+ super.buildGraphicsNode(ctx, e, tn);
+
+ // Drop references once static build is completed.
+ flowRegionNodes = null;
+ }
+
protected void computeLaidoutText(BridgeContext ctx,
Element e,
GraphicsNode node) {
@@ -175,6 +305,33 @@
}
/**
+ * Add to the element children of the node, a
+ * <code>SVGContext</code> to support dynamic update. This is
+ * recursive, the children of the nodes are also traversed to add
+ * to the support elements their context
+ *
+ * @param ctx a <code>BridgeContext</code> value
+ * @param e an <code>Element</code> value
+ *
+ * @see org.apache.batik.dom.svg.SVGContext
+ * @see org.apache.batik.bridge.BridgeUpdateHandler
+ */
+ protected void addContextToChild(BridgeContext ctx, Element e) {
+ if (SVG_NAMESPACE_URI.equals(e.getNamespaceURI())) {
+ String ln = e.getLocalName();
+ if (ln.equals(SVG12Constants.SVG_FLOW_DIV_TAG)
+ || ln.equals(SVG12Constants.SVG_FLOW_LINE_TAG)
+ || ln.equals(SVG12Constants.SVG_FLOW_PARA_TAG)
+ || ln.equals(SVG12Constants.SVG_FLOW_SPAN_TAG)) {
+ ((SVGOMElement) e).setSVGContext
+ (new FlowContentBridge(ctx, this, e));
+ }
+ }
+
+ super.addContextToChild(ctx, e);
+ }
+
+ /**
* Creates the attributed string which represents the given text
* element children.
*
@@ -185,6 +342,7 @@
Element element) {
List rgns = getRegions(ctx, element);
AttributedString ret = getFlowDiv(ctx, element);
+ if (ret == null) return ret;
ret.addAttribute(FLOW_REGIONS, rgns, 0, 1);
TextLineBreaks.findLineBrk(ret);
// dumpACIWord(ret);
@@ -192,6 +350,8 @@
}
protected void dumpACIWord(AttributedString as) {
+ if (as == null) return;
+
String chars = "";
String brkStr = "";
AttributedCharacterIterator aci = as.getIterator();
@@ -272,6 +432,8 @@
// Layer in the PARAGRAPH/LINE_BREAK Attributes so we can
// break up text chunks.
AttributedString ret = asb.toAttributedString();
+ if (ret == null)
+ return null;
// Note: The Working Group (in conjunction with XHTML working
// group) has decided that multiple line elements collapse.
@@ -312,6 +474,9 @@
return ret;
}
+ /**
+ * Returns a list of Shapes that define the flow regions.
+ */
protected List getRegions(BridgeContext ctx, Element element) {
// Element comes in as flowDiv element we want flowRoot.
element = (Element)element.getParentNode();
@@ -339,22 +504,25 @@
protected void gatherRegionInfo(BridgeContext ctx, Element rgn,
float verticalAlign, List regions) {
- GVTBuilder builder = ctx.getGVTBuilder();
+ boolean isStatic = !ctx.isDynamic();
for (Node n = rgn.getFirstChild();
n != null; n = n.getNextSibling()) {
- if (n.getNodeType() != Node.ELEMENT_NODE) continue;
- if (!getNamespaceURI().equals(n.getNamespaceURI())) continue;
- Element e = (Element)n;
-
- GraphicsNode gn = builder.build(ctx, e) ;
- if (gn == null) continue;
+ if (n.getNodeType() != Node.ELEMENT_NODE) {
+ continue;
+ }
+ GraphicsNode gn = isStatic ? (GraphicsNode) flowRegionNodes.get(n)
+ : ctx.getGraphicsNode((Element) n);
Shape s = gn.getOutline();
- if (s == null) continue;
+ if (s == null) {
+ continue;
+ }
+
AffineTransform at = gn.getTransform();
- if (at != null)
+ if (at != null) {
s = at.createTransformedShape(s);
+ }
regions.add(new RegionInfo(s, verticalAlign));
}
}
@@ -388,11 +556,11 @@
if (preserve)
endLimit = startLen;
- Map map = getAttributeMap(ctx, element, null, bidiLevel);
- Object o = map.get(TextAttribute.BIDI_EMBEDDING);
+ Map map = getAttributeMap(ctx, element, null, bidiLevel);
+ Object o = map.get(TextAttribute.BIDI_EMBEDDING);
Integer subBidiLevel = bidiLevel;
- if (o != null)
- subBidiLevel = (Integer)o;
+ if (o != null)
+ subBidiLevel = (Integer)o;
int lineBreak = -1;
if (lnLocs.size() != 0)
@@ -432,7 +600,7 @@
if (ln.equals(SVG12Constants.SVG_FLOW_LINE_TAG)) {
fillAttributedStringBuffer(ctx, nodeElement,
false, subBidiLevel,
- asb, lnLocs);
+ asb, lnLocs);
// System.out.println("Line: " + asb.length() +
// " - '" + asb + "'");
lineBreak = asb.length();
@@ -441,7 +609,7 @@
ln.equals(SVG12Constants.SVG_ALT_GLYPH_TAG)) {
fillAttributedStringBuffer(ctx, nodeElement,
false, subBidiLevel,
- asb, lnLocs);
+ asb, lnLocs);
} else if (ln.equals(SVG_A_TAG)) {
if (ctx.isInteractive()) {
EventTarget target = (EventTarget)nodeElement;
@@ -472,7 +640,7 @@
s = normalizeString(s, preserve, prevEndsWithSpace);
if (s != null) {
Map m = getAttributeMap(ctx, nodeElement, null,
- bidiLevel);
+ bidiLevel);
asb.append(s, m);
}
}
@@ -528,26 +696,6 @@
return result;
}
- protected final static
- GVTAttributedCharacterIterator.TextAttribute TEXTPATH =
- GVTAttributedCharacterIterator.TextAttribute.TEXTPATH;
-
- protected final static
- GVTAttributedCharacterIterator.TextAttribute ANCHOR_TYPE =
- GVTAttributedCharacterIterator.TextAttribute.ANCHOR_TYPE;
-
- protected final static
- GVTAttributedCharacterIterator.TextAttribute LETTER_SPACING =
- GVTAttributedCharacterIterator.TextAttribute.LETTER_SPACING;
-
- protected final static
- GVTAttributedCharacterIterator.TextAttribute WORD_SPACING =
- GVTAttributedCharacterIterator.TextAttribute.WORD_SPACING;
-
- protected final static
- GVTAttributedCharacterIterator.TextAttribute KERNING =
- GVTAttributedCharacterIterator.TextAttribute.KERNING;
-
protected void checkMap(Map attrs) {
if (attrs.containsKey(TEXTPATH)) {
return; // Problem, unsupported attr
@@ -658,5 +806,20 @@
((LineHeightValue)v).getFontSizeRelative())
lineHeight *= fontSize;
return lineHeight;
+ }
+
+ /**
+ * Bridge class for flow text children that contain text.
+ */
+ protected class FlowContentBridge extends AbstractTextChildTextContent {
+
+ /**
+ * Creates a new FlowContentBridge.
+ */
+ public FlowContentBridge(BridgeContext ctx,
+ SVGTextElementBridge parent,
+ Element e) {
+ super(ctx, parent, e);
+ }
}
}
Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/TextNode.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/TextNode.java?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/TextNode.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/TextNode.java Sun Oct 23 12:03:39 2005
@@ -147,7 +147,13 @@
* Returns the text of this <tt>TextNode</tt> as a string.
*/
public String getText() {
- if (text == null) {
+
+ if (text != null)
+ return text;
+
+ if (aci == null) {
+ text = "";
+ } else {
StringBuffer buf = new StringBuffer(aci.getEndIndex());
for (char c = aci.first();
c != CharacterIterator.DONE;
@@ -344,6 +350,7 @@
int[] ranges = textPainter.getSelected(beginMark, endMark);
Object o = null;
+ if (aci == null) return o;
// TODO: later we can return more complex things like
// noncontiguous selections
Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/flow/FlowGlyphLayout.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/flow/FlowGlyphLayout.java?rev=327838&r1=327837&r2=327838&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/flow/FlowGlyphLayout.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/gvt/flow/FlowGlyphLayout.java Sun Oct 23 12:03:39 2005
@@ -63,7 +63,7 @@
int numChunks = acis.length;
// System.out.println("Len: " + acis.length + " Size: " +
- // chunkLayouts.size());
+ // chunkLayouts.size());
// Make a list of the GlyphVectors so we can construct a
// multiGlyphVector that makes them all look like one big
@@ -77,7 +77,7 @@
BlockInfo [] blockInfos = new BlockInfo[acis.length];
float [] topSkip = new float[acis.length];
for (int chunk=0; clIter.hasNext(); chunk++) {
- // System.out.println("Chunk: " + chunk);
+ // System.err.print("Chunk: " + chunk + " Str: '");
AttributedCharacterIterator aci = acis[chunk];
List gvl = new LinkedList();
List layouts = (List)clIter.next();
@@ -296,7 +296,10 @@
int aciWordStart = aciIdx;
GVTFont gvtFont = (GVTFont)aci.getAttribute(GVT_FONT);
- float lineHeight = ((Float)aci.getAttribute(LINE_HEIGHT)).floatValue();
+ float lineHeight = 1.f;
+ Float lineHeightFloat = (Float)aci.getAttribute(LINE_HEIGHT);
+ if (lineHeightFloat != null)
+ lineHeight = lineHeightFloat.floatValue();
int runLimit = aci.getRunLimit(szAtts);
WordInfo prevWI = null;
float [] lastAdvAdj = new float [numGlyphs];