deweese 2004/12/04 10:40:45 Modified: sources/org/apache/batik/gvt/flow FlowGlyphLayout.java LineInfo.java test-resources/org/apache/batik/test samplesRendering.xml Added: samples/tests/spec12/text flowBidi.svg test-references/samples/tests/spec12/text flowBidi.png Log: Fixed a bug in BIDI handling in flowRoot element. Revision Changes Path 1.1 xml-batik/samples/tests/spec12/text/flowBidi.svg Index: flowBidi.svg =================================================================== <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <!-- Copyright 2002-2003 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. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- ====================================================================== --> <!-- Tests various text on a path --> <!-- --> <!-- @author [EMAIL PROTECTED] --> <!-- @version $Id: flowBidi.svg,v 1.1 2004/12/04 18:40:45 deweese Exp $ --> <!-- ====================================================================== --> <svg id="body" width="450" height="500" viewBox="0 0 450 500" xmlns="http://www.w3.org/2000/svg" version="1.2" xmlns:xlink="http://www.w3.org/1999/xlink" > <title>Test of Text wrapping stuff.</title> <g id="content" > <text class="title" x="50%" y="40">Test of Text wrapping stuff</text> <!-- Space after size 40 'that' is aci 45 --> <rect x="17" y="80" width="200" height="200" fill="rgb(220,220,255)"/> <rect x="233" y="80" width="200" height="200" fill="rgb(220,220,255)"/> <rect x="17" y="290" width="200" height="150" fill="rgb(220,220,255)"/> <rect x="220" y="290" width="10" height="150" fill="rgb(220,220,255)"/> <rect x="233" y="290" width="200" height="150" fill="rgb(220,220,255)"/> <!-- <line x1="27" y1="70" x2="27" y2="490" stroke="grey" fill="none"/> <line x1="207" y1="70" x2="207" y2="490" stroke="grey" fill="none"/> <line x1="243" y1="70" x2="243" y2="490" stroke="grey" fill="none"/> <line x1="423" y1="70" x2="423" y2="490" stroke="grey" fill="none"/> --> <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"/> </flowRegion> <flowDiv> <flowPara indent="20" margin-bottom="10" >Some <flowSpan fill="darkred" direction="rtl" unicode-bidi="embed">(embedded bidi)</flowSpan> of text.</flowPara> <flowPara>Some text goes <flowSpan fill="blue" direction="rtl" unicode-bidi="bidi-override">(right to left)</flowSpan>, other text goes (left to right).</flowPara> <flowPara>arabic: ء​​أ​ؤ​إ​ئ​ا​ب​ة​ت​ث​ج​ح​خ​د​ذ​ر​ز​س​ش​ص​ض​ط​ظ​ع​ـ​ف​ق​ك​ل​م​ن​ه​و​ى​ِ​ٶ</flowPara> </flowDiv> </flowRoot> <flowRoot font-size="20" xml:space="preserve"> <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"/> </flowRegion> <flowDiv> <flowPara indent="20" margin-bottom="10" >Some <flowSpan fill="darkred" direction="rtl" unicode-bidi="embed">(embedded bidi)</flowSpan> of text.</flowPara> <flowPara>Some text goes <flowSpan fill="blue" direction="rtl" unicode-bidi="bidi-override">(right to left)</flowSpan>, other text goes (left to right).</flowPara> <flowPara>arabic: ء​​أ​ؤ​إ​ئ​ا​ب​ة​ت​ث​ج​ح​خ​د​ذ​ر​ز​س​ش​ص​ض​ط​ظ​ع​ـ​ف​ق​ك​ل​م​ن​ه​و​ى​ِ​ٶ</flowPara> </flowDiv> </flowRoot> </g> </svg> 1.3 +12 -10 xml-batik/sources/org/apache/batik/gvt/flow/FlowGlyphLayout.java Index: FlowGlyphLayout.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/flow/FlowGlyphLayout.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FlowGlyphLayout.java 2 Dec 2004 01:24:37 -0000 1.2 +++ FlowGlyphLayout.java 4 Dec 2004 18:40:45 -0000 1.3 @@ -385,6 +385,7 @@ int []wordGlyphGroupsCounts = new int [words]; for (int i=0; i<numGlyphs; i++) { int cWord = glyphWords[i]; + // System.err.println("CW: " + cWord); int [] wgs = wordGlyphs[cWord]; if (wgs == null) { wgs = wordGlyphs[cWord] @@ -408,6 +409,7 @@ for (int i=0; i<words; i++) { int cnt = wordGlyphGroupsCounts[i]; + // System.err.println("WGGC: " + cnt); GlyphGroupInfo []wordGlyphGroups = new GlyphGroupInfo[cnt]; if (cnt == 1) { int [] glyphs = wordGlyphs[i]; @@ -418,21 +420,21 @@ glyphPos, advAdj, lastAdvAdj, space); } else { int glyphGroup = 0; - int []wordGlyph = wordGlyphs[i]; - int prev = wordGlyph[0]; - int start = 0; - for (int j=1; j<wordGlyph.length; j++) { - if (prev+1 != wordGlyph[j]) { - int end = j-1; + int []glyphs = wordGlyphs[i]; + int prev = glyphs[0]; + int start = prev; + for (int j=1; j<glyphs.length; j++) { + if (prev+1 != glyphs[j]) { + int end = glyphs[j-1]; wordGlyphGroups[glyphGroup] = new GlyphGroupInfo (gv, start, end, hide, hideLast[end], glyphPos, advAdj, lastAdvAdj, space); - start = j; + start = glyphs[j]; glyphGroup++; } - prev = wordGlyph[j]; + prev = glyphs[j]; } - int end = wordGlyph.length-1; + int end = glyphs[glyphs.length-1]; wordGlyphGroups[glyphGroup] = new GlyphGroupInfo (gv, start, end, hide, hideLast[end], glyphPos, advAdj, lastAdvAdj, space); 1.4 +5 -1 xml-batik/sources/org/apache/batik/gvt/flow/LineInfo.java Index: LineInfo.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/flow/LineInfo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- LineInfo.java 2 Dec 2004 01:24:37 -0000 1.3 +++ LineInfo.java 4 Dec 2004 18:40:45 -0000 1.4 @@ -310,6 +310,10 @@ newGGIS[newSize++] = wi.getGlyphGroup(i++); } } + // for (int i=0; i<newSize; i++) { + // System.err.println("GGIS["+i+"]: " + newGGIS[i].start + " -> " + + // newGGIS[i].end); + // } } 1.1 xml-batik/test-references/samples/tests/spec12/text/flowBidi.png <<Binary file>> 1.123 +4 -1 xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml Index: samplesRendering.xml =================================================================== RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml,v retrieving revision 1.122 retrieving revision 1.123 diff -u -r1.122 -r1.123 --- samplesRendering.xml 3 Dec 2004 12:20:16 -0000 1.122 +++ samplesRendering.xml 4 Dec 2004 18:40:45 -0000 1.123 @@ -54,6 +54,9 @@ </testGroup> <testGroup id="svg1.2" name="SVG Version 1.2 functionality tests"> + <test id="samples/tests/spec12/text/flowBidi.svg" > + <property name="Validating" class="java.lang.Boolean" value="false" /> + </test> <test id="samples/tests/spec12/text/flowText.svg" > <property name="Validating" class="java.lang.Boolean" value="false" /> </test>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]