OSDN Git Service

.0
[psychlops/silverlight.git] / dev3 / psychlops / core / graphic / font.cs
index 95dd6bc..e3a4b41 100644 (file)
@@ -20,7 +20,7 @@ namespace Psychlops
                public double size;\r
                public int weight;\r
                public Style style;\r
-               public string[] family;\r
+               public string family;\r
 \r
                static Font()\r
                {\r
@@ -31,23 +31,23 @@ namespace Psychlops
                        size = 18;\r
                        weight = (int)Weight.normal;\r
                        style = Style.normal;\r
-                       family = new string[1];\r
+                       //family = new string[1];\r
                }\r
                public Font(double size_, int weight_, Style style_, string family_)\r
                {\r
                        size = size_;\r
                        weight = weight_;\r
                        style = style_;\r
-                       family = new string[1];\r
-                       family[0] = family_;\r
+                       //family = new string[1];\r
+                       family = family_;\r
                }\r
                public Font(string family_, double size_, int weight_, Style style_)\r
                {\r
                        size = size_;\r
                        weight = weight_;\r
                        style = style_;\r
-                       family = new string[1];\r
-                       family[0] = family_;\r
+                       //family = new string[1];\r
+                       family = family_;\r
                }\r
                ~Font()\r
                {\r
@@ -59,28 +59,29 @@ namespace Psychlops
                protected string str_;\r
                protected Font font_;\r
                protected double width_, height_;\r
-               public Point datum;\r
+               public Point datum { get; set; }\r
 \r
-               public enum HorizontalAlign { NOT_SPECIFIED=-1, TEXT_ALIGN_LEFT=0, TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT };\r
+               public enum HorizontalAlign { not_specified=-1, left=0, center, right };\r
+               //public const HorizontalAlign NOT_SPECIFIED=HorizontalAlign.not_specified, TEXT_ALIGN_LEFT=HorizontalAlign.left, TEXT_ALIGN_CENTER = HorizontalAlign.center, TEXT_ALIGN_RIGHT=HorizontalAlign.right;\r
                public HorizontalAlign align;\r
 \r
                public Letters()\r
                {\r
                        str_ = "";\r
                        font = Font.default_font;\r
-                       align = HorizontalAlign.TEXT_ALIGN_LEFT;\r
+                       align = HorizontalAlign.left;\r
                }\r
                public Letters(String init_str)\r
                {\r
                        str_ = init_str;\r
                        font_ = Font.default_font;\r
-                       align = HorizontalAlign.TEXT_ALIGN_LEFT;\r
+                       align = HorizontalAlign.center;\r
                }\r
                public Letters(String init_str, Font init_font)\r
                {\r
                        str_ = init_str;\r
                        font_ = init_font;\r
-                       align = HorizontalAlign.TEXT_ALIGN_LEFT;\r
+                       align = HorizontalAlign.right;\r
                }\r
                ~Letters()\r
                {\r
@@ -100,11 +101,12 @@ namespace Psychlops
                public Figure centering(Point p)\r
                {\r
                        datum = p;\r
-                       align = HorizontalAlign.TEXT_ALIGN_CENTER;\r
+                       align = HorizontalAlign.center;\r
                        return this;\r
                }\r
                public Figure shift(Point p)\r
                {\r
+                       datum = datum + p;\r
                        return this;\r
                }\r
                public Letters locate(Point p)\r
@@ -114,7 +116,7 @@ namespace Psychlops
                }\r
                public Letters locate(double x, double y)\r
                {\r
-                       datum.set(x,y);\r
+                       datum = new Point(x,y);\r
                        return this;\r
                }\r
 \r