diff dwt/graphics/FontData.d @ 238:380bad9f6852

reverted char[] to String
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:42:55 +0200
parents 08789b28bdf3
children c0d810de7093
line wrap: on
line diff
--- a/dwt/graphics/FontData.d	Sat Apr 26 10:01:30 2008 +0200
+++ b/dwt/graphics/FontData.d	Mon May 05 00:42:55 2008 +0200
@@ -19,6 +19,7 @@
 import tango.text.Util : locate;
 import tango.util.Convert;
 import dwt.dwthelper.utils;
+import tango.util.log.Trace;
 
 /**
  * Instances of this class describe operating system fonts.
@@ -55,7 +56,7 @@
      * platforms and should never be accessed from application code.
      * </p>
      */
-    public char[] name;
+    public String name;
 
     /**
      * The height of the font data in points
@@ -91,12 +92,12 @@
      * platforms and should never be accessed from application code.
      * </p>
      */
-    public char[] str;
+    public String str;
 
     /**
      * The locales of the font
      */
-    char[] lang, country, variant;
+    String lang, country, variant;
 
 /**
  * Constructs a new uninitialized font data.
@@ -124,12 +125,12 @@
  *
  * @see #toString
  */
-public this(char[] str) {
+public this(String str) {
     if (str is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     int start = 0;
     int end = locate( str, '|' );
     if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
-    char[] version1 = str[ start .. end ];
+    String version1 = str[ start .. end ];
     try {
         if (to!(int)(version1) !is 1) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
     } catch (ConversionException e) {
@@ -139,7 +140,7 @@
     start = end + 1;
     end = locate( str, '|', start );
     if (end is str.length ) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
-    char[] name = str[start .. end ];
+    String name = str[start .. end ];
 
     start = end + 1;
     end = locate( str, '|', start );
@@ -167,12 +168,12 @@
     setHeight(height);
     setStyle(style);
     if (end is str.length) return;
-    char[] platform = str[ start .. end ];
+    String platform = str[ start .. end ];
 
     start = end + 1;
     end = locate( str, '|', start );
     if (end is str.length) return;
-    char[] version2 = str[ start .. end ];
+    String version2 = str[ start .. end ];
 
     if (platform.equals("GTK") && version2.equals("1")) {
         return;
@@ -193,13 +194,13 @@
  *    <li>ERROR_INVALID_ARGUMENT - if the height is negative</li>
  * </ul>
  */
-public this(char[] name, int height, int style) {
+public this(String name, int height, int style) {
     setName(name);
     setHeight(height);
     setStyle(style);
 }
 
-/*public*/ this(char[] name, float height, int style) {
+/*public*/ this(String name, float height, int style) {
     setName(name);
     setHeight(height);
     setStyle(style);
@@ -255,8 +256,8 @@
  * @return the <code>String</code> representing a Locale object
  * @since 3.0
  */
-public char[] getLocale () {
-    char[] result;
+public String getLocale () {
+    String result;
     const char sep = '_';
     if (lang !is null) {
         result ~= lang;
@@ -275,6 +276,7 @@
             result = result[0 .. $ - 1];
         }
     }
+Trace.formatln( "getLocal {}", result );
     return result;
 }
 
@@ -287,7 +289,7 @@
  *
  * @see #setName
  */
-public char[] getName() {
+public String getName() {
     return name;
 }
 
@@ -315,7 +317,7 @@
  * @see #equals
  */
 public override hash_t toHash () {
-    return typeid(char[]).getHash(&name) ^ getHeight() ^ style;
+    return typeid(String).getHash(&name) ^ getHeight() ^ style;
 }
 
 /**
@@ -360,7 +362,8 @@
  * @param locale the <code>String</code> representing a Locale object
  * @see java.util.Locale#toString
  */
-public void setLocale(char[] locale) {
+public void setLocale(String locale) {
+Trace.formatln( "setLocal {}", locale );
     lang = country = variant = null;
     if (locale !is null) {
         char sep = '_';
@@ -405,7 +408,7 @@
  *
  * @see #getName
  */
-public void setName(char[] name) {
+public void setName(String name) {
     if (name is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     this.name = name;
     this.str = null;
@@ -435,7 +438,7 @@
  *
  * @see FontData
  */
-public override char[] toString() {
+public override String toString() {
     return Format( "1|{}|{}|{}|GTK|1|", getName, getHeightF, getStyle );
 }