You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by de...@apache.org on 2003/10/12 18:55:50 UTC
cvs commit: xml-batik/sources/org/apache/batik/swing/svg JSVGComponent.java
deweese 2003/10/12 09:55:50
Modified: samples mines.svg
sources/org/apache/batik/bridge UpdateManager.java
sources/org/apache/batik/svggen/font Font.java
sources/org/apache/batik/svggen/font/table CmapFormat4.java
sources/org/apache/batik/swing/svg JSVGComponent.java
Log:
1) Fixed a bug in the handling of Cmap type 4 TrueType fonts in
ttf2svg.
2) The UpdateManager now disposes the BridgeContext before calling
UpdateManagerStopped event listeners.
Revision Changes Path
1.6 +65 -60 xml-batik/samples/mines.svg
Index: mines.svg
===================================================================
RCS file: /home/cvs/xml-batik/samples/mines.svg,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- mines.svg 8 Aug 2003 11:39:29 -0000 1.5
+++ mines.svg 12 Oct 2003 16:55:49 -0000 1.6
@@ -351,70 +351,73 @@
]]>
</script>
- <defs>
- <radialGradient id="bombGrad" gradientUnits="userSpaceOnUse"
- cx="5" cy="6.5" fx="4" fy="5" r="2.5">
- <stop offset="0%" stop-color="#FFF"/>
- <stop offset="20%" stop-color="#888"/>
- <stop offset="100%" stop-color="#000"/>
- </radialGradient>
- <path id="empty" style="fill:#AAA; stroke:#DDD; stroke-width:0.5;"
- d="M0.25,0.25 h9.5 v9.5 h-9.5 v-9.5"/>
-
- <g id="blank"
- ><rect style="fill:#AAA" width="10" height="10"
+ <defs>
+ <radialGradient id="bombGrad" gradientUnits="userSpaceOnUse"
+ cx="5" cy="6.5" fx="4" fy="5" r="2.5">
+ <stop offset="0%" stop-color="#FFF"/>
+ <stop offset="20%" stop-color="#888"/>
+ <stop offset="100%" stop-color="#000"/>
+ </radialGradient>
+ <path id="empty" style="fill:#AAA; stroke:#DDD; stroke-width:0.5;"
+ d="M0.25,0.25 h9.5 v9.5 h-9.5 v-9.5"/>
+
+ <g id="blank"
+ ><rect style="fill:#AAA" width="10" height="10"
/><path style="fill:#DDD"
- d="M0,0 h10 l-1,1 h-8 v8 l-1,1 v-10"
+ d="M0,0 h10 l-1,1 h-8 v8 l-1,1 v-10"
/><path style="fill:#888"
- d="M10,10 h-10 l1,-1 h8 v-8 l1,-1 v10"
- /></g>
-
- <use id="square0" xlink:href="#empty"/>
- <g id="square1" style="text-anchor:middle; font-size:8;"
- ><use xlink:href="#empty"
- /><text x="5" y="8" fill="#008">1</text></g>
- <g id="square2" style="text-anchor:middle; font-size:8;"
- ><use xlink:href="#empty"
- /><text x="5" y="8" fill="#00C">2</text></g>
- <g id="square3" style="text-anchor:middle; font-size:8;"
- ><use xlink:href="#empty"
- /><text x="5" y="8" fill="#40F">3</text></g>
- <g id="square4" style="text-anchor:middle; font-size:8;"
- ><use xlink:href="#empty"
- /><text x="5" y="8" fill="#80C">4</text></g>
- <g id="square5" style="text-anchor:middle; font-size:8;"
- ><use xlink:href="#empty"
- /><text x="5" y="8" fill="#C0C">5</text></g>
- <g id="square6" style="text-anchor:middle; font-size:8;"
- ><use xlink:href="#empty"
- /><text x="5" y="8" fill="#F08">6</text></g>
- <g id="square7" style="text-anchor:middle; font-size:8;"
- ><use xlink:href="#empty"
- /><text x="5" y="8" fill="#F04">7</text></g>
- <g id="square8" style="text-anchor:middle; font-size:8;"
- ><use xlink:href="#empty"
- /><text x="5" y="8" fill="#F00">8</text></g>
-
- <g id="bomb"
- ><use xlink:href="#empty"
+ d="M10,10 h-10 l1,-1 h8 v-8 l1,-1 v10"
+ /></g>
+
+ <use id="square0" xlink:href="#empty"/>
+ <g id="square1" style="text-anchor:middle; font-size:8;"
+ ><use xlink:href="#empty"
+ /><text x="5" y="8" fill="#008" pointer-events="none">1</text></g>
+ <g id="square2" style="text-anchor:middle; font-size:8;"
+ ><use xlink:href="#empty"
+ /><text x="5" y="8" fill="#00C" pointer-events="none">2</text></g>
+ <g id="square3" style="text-anchor:middle; font-size:8;"
+ ><use xlink:href="#empty"
+ /><text x="5" y="8" fill="#40F" pointer-events="none">3</text></g>
+ <g id="square4" style="text-anchor:middle; font-size:8;"
+ ><use xlink:href="#empty"
+ /><text x="5" y="8" fill="#80C" pointer-events="none">4</text></g>
+ <g id="square5" style="text-anchor:middle; font-size:8;"
+ ><use xlink:href="#empty"
+ /><text x="5" y="8" fill="#C0C" pointer-events="none">5</text></g>
+ <g id="square6" style="text-anchor:middle; font-size:8;"
+ ><use xlink:href="#empty"
+ /><text x="5" y="8" fill="#F08" pointer-events="none">6</text></g>
+ <g id="square7" style="text-anchor:middle; font-size:8;"
+ ><use xlink:href="#empty"
+ /><text x="5" y="8" fill="#F04" pointer-events="none">7</text></g>
+ <g id="square8" style="text-anchor:middle; font-size:8;"
+ ><use xlink:href="#empty"
+ /><text x="5" y="8" fill="#F00" pointer-events="none">8</text></g>
+
+ <g id="bomb"
+ ><use xlink:href="#empty"
/><rect fill="#000" x="4" y="3" width="2" height="2"
/><circle fill="url(#bombGrad)" cx="5" cy="6.5" r="2.5"
/><path fill="none" stroke="#000" stroke-width="0.3"
- d="M5,3 c0,-1.5 1.5,-1.5 1.5,0 c0,1.5 1.5,1.5 1.5,0"
- /></g>
-
- <g id="flag"
- ><use xlink:href="#blank"
+ d="M5,3 c0,-1.5 1.5,-1.5 1.5,0 c0,1.5 1.5,1.5 1.5,0"
+ /></g>
+
+ <g id="flag"
+ ><use xlink:href="#blank"
/><path d="M3.5,2 h.5 v6.5 h-1 l.5,-6.5"
/><path fill="crimson" d="M4,2 l4,1.5 l-4,1.5 z"
- /></g>
- </defs>
-
- <g id="body">
- <text id="title" x="25" y="60" font-size="40">SVG Mines</text>
- <text id="mines" x="250" y="30" font-size="20">Mines Left: </text>
+ /></g>
+ </defs>
+
+ <g id="body">
+ <text id="title" x="25" y="60" font-size="40"
+ pointer-events="none">SVG Mines</text>
+ <text id="mines" x="250" y="30" font-size="20"
+ pointer-events="none">Mines Left: </text>
- <text id="boardsz" x="250" y="54" font-size="20">Board Size: </text>
+ <text id="boardsz" x="250" y="54" font-size="20"
+ pointer-events="none">Board Size: </text>
<g transform="translate(242, 38)" fill="black">
<path onclick="largerBoard(evt)"
d="M2.5,0 l-2.5,7 h5 z"/>
@@ -430,14 +433,16 @@
Middle or Control: show surround</desc>
<circle cx="430" cy="18" r="12"
fill="grey" stroke="lightgrey" stroke-width="2" />
- <text font-size="15" fill="blue" x="430" y="25" >?</text>
+ <text font-size="15" fill="blue" x="430" y="25"
+ pointer-events="none">?</text>
</g>
<g onclick="newGame()">
<desc xml:space="preserve">Start new game</desc>
<circle cx="430" cy="48" r="12"
fill="grey" stroke="lightgrey" stroke-width="2" />
- <text font-size="10" fill="blue" x="430" y="53" >NG</text>
+ <text font-size="10" fill="blue" x="430" y="53"
+ pointer-events="none">NG</text>
</g>
</g>
@@ -450,7 +455,7 @@
</g>
</g>
<text id="working" fill="green" x="25" y="60" font-size="40"
- >Working</text>
+ pointer-events="none">Working</text>
</g>
<!-- ============================================================= -->
1.27 +8 -2 xml-batik/sources/org/apache/batik/bridge/UpdateManager.java
Index: UpdateManager.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/UpdateManager.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- UpdateManager.java 25 Sep 2003 00:45:11 -0000 1.26
+++ UpdateManager.java 12 Oct 2003 16:55:49 -0000 1.27
@@ -350,9 +350,15 @@
((EventTarget)(document.getDocumentElement())).
dispatchEvent(evt);
running = false;
-
+
+ // Now shut everything down and disconnect
+ // everything before we send the
+ // UpdateMangerStopped event.
scriptingEnvironment.interrupt();
updateRunnableQueue.getThread().interrupt();
+ bridgeContext.dispose();
+
+ // Send the UpdateManagerStopped event.
fireEvent(stoppedDispatcher,
new UpdateManagerEvent(this, null, null));
}
1.5 +4 -3 xml-batik/sources/org/apache/batik/svggen/font/Font.java
Index: Font.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/font/Font.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Font.java 8 Aug 2003 11:39:22 -0000 1.4
+++ Font.java 12 Oct 2003 16:55:49 -0000 1.5
@@ -190,7 +190,8 @@
// Load each of the tables
for (int i = 0; i < tableDirectory.getNumTables(); i++) {
- tables[i] = TableFactory.create(tableDirectory.getEntry(i), raf);
+ tables[i] = TableFactory.create
+ (tableDirectory.getEntry(i), raf);
}
raf.close();
@@ -212,7 +213,7 @@
loca.init(maxp.getNumGlyphs(), head.getIndexToLocFormat() == 0);
glyf.init(maxp.getNumGlyphs(), loca);
} catch (IOException e) {
- System.err.println(e.getMessage());
+ e.printStackTrace();
}
}
1.3 +3 -2 xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat4.java
Index: CmapFormat4.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/font/table/CmapFormat4.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CmapFormat4.java 8 Aug 2003 11:39:22 -0000 1.2
+++ CmapFormat4.java 12 Oct 2003 16:55:50 -0000 1.3
@@ -59,6 +59,7 @@
*/
public class CmapFormat4 extends CmapFormat {
+ public int language;
private int segCountX2;
private int searchRange;
private int entrySelector;
@@ -97,7 +98,7 @@
}
// Whatever remains of this header belongs in glyphIdArray
- int count = (length - 24) / 2;
+ int count = (length - 16 - (segCount*8)) / 2;
glyphIdArray = new int[count];
for (int i = 0; i < count; i++) {
glyphIdArray[i] = raf.readUnsignedShort();
1.85 +38 -7 xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java
Index: JSVGComponent.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -r1.84 -r1.85
--- JSVGComponent.java 7 Sep 2003 22:25:28 -0000 1.84
+++ JSVGComponent.java 12 Oct 2003 16:55:50 -0000 1.85
@@ -356,6 +356,8 @@
protected Dimension prevComponentSize;
+ protected Runnable afterStopRunnable = null;
+
/**
* Creates a new JSVGComponent.
*/
@@ -589,6 +591,16 @@
* queue thread. It returns immediately.
*/
protected void stopThenRun(final Runnable r) {
+ synchronized (this) {
+ if (afterStopRunnable != null) {
+ // Have it run our new runnable, and not
+ // run the 'old' runnable.
+ afterStopRunnable = r;
+ return;
+ }
+ afterStopRunnable = r;
+ }
+
if (documentLoader != null) {
documentLoader.addSVGDocumentLoaderListener
(new SVGDocumentLoaderAdapter() {
@@ -603,7 +615,10 @@
// Remove ourselves from the doc loader,
// and install the new document.
sdl.removeSVGDocumentLoaderListener(this);
- EventQueue.invokeLater(r);
+ synchronized (JSVGComponent.this) {
+ EventQueue.invokeLater(afterStopRunnable);
+ afterStopRunnable = null;
+ }
}
});
stopProcessing();
@@ -621,7 +636,10 @@
// Remove ourselves from the old tree builder,
// and install the new document.
gtb.removeGVTTreeBuilderListener(this);
- EventQueue.invokeLater(r);
+ synchronized (JSVGComponent.this) {
+ EventQueue.invokeLater(afterStopRunnable);
+ afterStopRunnable = null;
+ }
}
});
stopProcessing();
@@ -636,7 +654,10 @@
// Remove ourselves from the old update manger,
// and install the new document.
um.removeUpdateManagerListener(this);
- EventQueue.invokeLater(r);
+ synchronized (JSVGComponent.this) {
+ EventQueue.invokeLater(afterStopRunnable);
+ afterStopRunnable = null;
+ }
}
// There really should be an updateManagerAdapter.
public void managerStarted(UpdateManagerEvent e) { }
@@ -664,7 +685,10 @@
// Remove ourselves from the old update manger,
// and install the new document.
gtr.removeGVTTreeRendererListener(this);
- EventQueue.invokeLater(r);
+ synchronized (JSVGComponent.this) {
+ EventQueue.invokeLater(afterStopRunnable);
+ afterStopRunnable = null;
+ }
}
});
stopProcessing();
@@ -685,13 +709,20 @@
// Remove ourselves from the old onload dispacher
// and install the new document.
sled.removeSVGLoadEventDispatcherListener(this);
- EventQueue.invokeLater(r);
+ synchronized (JSVGComponent.this) {
+ EventQueue.invokeLater(afterStopRunnable);
+ afterStopRunnable = null;
+ }
}
});
stopProcessing();
} else {
stopProcessing();
- r.run();
+ synchronized (this) {
+ Runnable asr = afterStopRunnable;
+ afterStopRunnable = null;
+ asr.run();
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org