Hello there!

In spite of text-transform non-recommended status and i18n issues I 
believe fop can rely on java i18n support and implement this property 
using toUpperCase()/toLowerCase() stuff.
Here is suggested patch.

-- 
Oleg Tkachenko
Multiconn International, Israel
Index: fop-cvs/xml-fop/src/codegen/foproperties.xml
===================================================================
RCS file: /home/cvspublic/xml-fop/src/codegen/foproperties.xml,v
retrieving revision 1.25.2.4
diff -u -r1.25.2.4 foproperties.xml
--- fop-cvs/xml-fop/src/codegen/foproperties.xml        1 Jul 2002 19:11:54 -0000      
 1.25.2.4
+++ fop-cvs/xml-fop/src/codegen/foproperties.xml        21 Jul 2002 19:45:07 -0000
@@ -1266,7 +1266,13 @@
   <property>
     <name>text-transform</name>
     <inherited>true</inherited>
-    <datatype>ToBeImplemented</datatype>
+    <datatype>Enum</datatype>
+      <enumeration>
+        <value const="NONE">none</value>
+        <value const="CAPITALIZE">capitalize</value>
+        <value const="UPPERCASE">uppercase</value>
+        <value const="LOWERCASE">lowercase</value>
+      </enumeration>
     <default>none</default>
   </property>
   <property>
Index: fop-cvs/xml-fop/src/org/apache/fop/fo/FOText.java
===================================================================
RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/fo/FOText.java,v
retrieving revision 1.24.2.3
diff -u -r1.24.2.3 FOText.java
--- fop-cvs/xml-fop/src/org/apache/fop/fo/FOText.java   6 Jul 2002 19:05:29 -0000      
 1.24.2.3
+++ fop-cvs/xml-fop/src/org/apache/fop/fo/FOText.java   21 Jul 2002 19:45:09 -0000
@@ -44,7 +44,31 @@
         super(parent);
         this.length = b.length();
         this.ca = new char[this.length];
-        b.getChars(0,length,ca,0);
+        switch (parent.properties.get("text-transform").getEnum()) {
+            case TextTransform.UPPERCASE:
+                (b.toString().toUpperCase()).getChars(0,length,ca,0);
+                break;
+            case TextTransform.LOWERCASE:
+                (b.toString().toLowerCase()).getChars(0,length,ca,0);
+                break;
+            case TextTransform.CAPITALIZE:
+                boolean isFirst = true;
+                for (int i=0; i<length; i++) {
+                    char c = b.charAt(i);
+                    if (!Character.isLetter(c))
+                        isFirst = true;
+                    else if (isFirst) {
+                        c = Character.toUpperCase(c);
+                        isFirst = false;
+                    }
+                    else
+                        c = Character.toLowerCase(c);
+                    ca[i] = c;
+                }
+                break;
+            default:
+                b.getChars(0,length,ca,0);
+        }
     }
 
     public void setUnderlined(boolean ul) {

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to