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 tk...@apache.org on 2001/12/03 14:56:49 UTC
cvs commit: xml-batik/sources/org/apache/batik/bridge SVGUtilities.java
tkormann 01/12/03 05:56:49
Modified: samples/tests/spec/structure systemLanguage.svg
sources/org/apache/batik/bridge SVGUtilities.java
Added: samples/tests/spec/structure systemLanguageDialect.svg
Log:
fix bug 5239
Languages and dialects now work properly.
new test added
Revision Changes Path
1.2 +2 -2 xml-batik/samples/tests/spec/structure/systemLanguage.svg
Index: systemLanguage.svg
===================================================================
RCS file: /home/cvs/xml-batik/samples/tests/spec/structure/systemLanguage.svg,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- systemLanguage.svg 2001/12/03 13:01:40 1.1
+++ systemLanguage.svg 2001/12/03 13:56:48 1.2
@@ -11,10 +11,10 @@
<!-- ====================================================================== -->
<!-- ====================================================================== -->
-<!-- Tests text-anchor on multiple text chunks on single tspan element -->
+<!-- Tests systemLanguage on elements -->
<!-- -->
<!-- @author tkormann@ilog.fr -->
-<!-- @version $Id: systemLanguage.svg,v 1.1 2001/12/03 13:01:40 tkormann Exp $ -->
+<!-- @version $Id: systemLanguage.svg,v 1.2 2001/12/03 13:56:48 tkormann Exp $ -->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
1.1 xml-batik/samples/tests/spec/structure/systemLanguageDialect.svg
Index: systemLanguageDialect.svg
===================================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- ====================================================================== -->
<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
<!-- -->
<!-- This software is published under the terms of the Apache Software -->
<!-- License version 1.1, a copy of which has been included with this -->
<!-- distribution in the LICENSE file. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- Tests systemLanguage with dialects -->
<!-- -->
<!-- @author tkormann@ilog.fr -->
<!-- @version $Id: systemLanguageDialect.svg,v 1.1 2001/12/03 13:56:48 tkormann Exp $ -->
<!-- ====================================================================== -->
<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
<svg width="450" height="500" viewBox="0 0 450 500" >
<!-- ============================================================= -->
<!-- Test content -->
<!-- ============================================================= -->
<g id="testContent">
<text x="225" y="50" class="title">Test the 'systemLanguage' attribute with dialect</text>
<text x="50%" y="150" style="text-anchor:middle; font-size:32" systemLanguage="en">english (en)</text>
<text x="50%" y="250" style="text-anchor:middle; font-size:32" systemLanguage="en-UK">english UK (en-UK)</text>
</g>
<!-- ============================================================= -->
<!-- Batik sample mark -->
<!-- ============================================================= -->
<use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" />
</svg>
1.18 +10 -10 xml-batik/sources/org/apache/batik/bridge/SVGUtilities.java
Index: SVGUtilities.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGUtilities.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- SVGUtilities.java 2001/11/08 23:02:43 1.17
+++ SVGUtilities.java 2001/12/03 13:56:48 1.18
@@ -50,7 +50,7 @@
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
* @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
- * @version $Id: SVGUtilities.java,v 1.17 2001/11/08 23:02:43 deweese Exp $
+ * @version $Id: SVGUtilities.java,v 1.18 2001/12/03 13:56:48 tkormann Exp $
*/
public abstract class SVGUtilities implements SVGConstants, ErrorConstants {
@@ -151,7 +151,7 @@
test: if (elt.hasAttributeNS(null, SVG_SYSTEM_LANGUAGE_ATTRIBUTE)) {
// Tests the system languages.
String sl = elt.getAttributeNS(null, SVG_SYSTEM_LANGUAGE_ATTRIBUTE);
- StringTokenizer st = new StringTokenizer(sl, ",");
+ StringTokenizer st = new StringTokenizer(sl, ", ");
while (st.hasMoreTokens()) {
String s = st.nextToken();
if (matchUserLanguage(s, ua.getLanguages())) {
@@ -193,12 +193,12 @@
* @param userLanguages the user langages
*/
protected static boolean matchUserLanguage(String s, String userLanguages) {
- StringTokenizer st = new StringTokenizer(userLanguages, ",");
+ StringTokenizer st = new StringTokenizer(userLanguages, ", ");
while (st.hasMoreTokens()) {
String t = st.nextToken();
- if (t.startsWith(s)) {
- if (t.length() > s.length()) {
- return (t.charAt(s.length()) == '-') ? true : false;
+ if (s.startsWith(t)) {
+ if (s.length() > t.length()) {
+ return (s.charAt(t.length()) == '-');
}
return true;
}
@@ -872,7 +872,7 @@
/**
* Scans the children of the input <tt>e</tt> element and
* invokes any registered bridge found for the children.
- *
+ *
* @param ctx active BridgeContext
* @param e element to be scanned
*/
@@ -881,17 +881,17 @@
for (Node n = elt.getFirstChild();
n != null;
n = n.getNextSibling()) {
-
+
if ((n.getNodeType() != Node.ELEMENT_NODE)) {
continue;
}
-
+
Element e = (Element)n;
Bridge bridge = ctx.getBridge(e);
if (bridge == null || !(bridge instanceof GenericBridge)) {
continue;
}
-
+
((GenericBridge)bridge).handleElement(ctx, e);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org