OSDN Git Service

.0
[psychlops/silverlight.git] / dev3 / psychlops / core / graphic / font.cs
index 3c03840..e3a4b41 100644 (file)
@@ -15,12 +15,12 @@ namespace Psychlops
        {\r
                public static Font default_font;\r
 \r
-               public enum Style { normal_style, italic, oblique };\r
-               public enum Weight { normal_weight=400, bold=700 };\r
+               public enum Style { normal, italic, oblique };\r
+               public enum Weight { normal=400, bold=700 };\r
                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
@@ -28,59 +28,60 @@ namespace Psychlops
                }\r
                public Font()\r
                {\r
-                       size = 24;\r
-                       weight = (int)Weight.normal_weight;\r
-                       style = Style.normal_style;\r
-                       family = new string[1];\r
+                       size = 18;\r
+                       weight = (int)Weight.normal;\r
+                       style = Style.normal;\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
                }\r
        }\r
 \r
-       public class Letters : Shape\r
+       public partial class Letters : Shape\r
        {\r
                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,18 +116,18 @@ 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
                public void draw()\r
                {\r
-                       Main.drawable.letters(this, Color.white);\r
-               }\r
-               public void draw(Color c)\r
-               {\r
-                       Main.drawable.letters(this, c);\r
+                       Main.drawable.letters(this);\r
                }\r
+\r
+               public Color fill { get; set; }\r
+               public Stroke stroke { get; set; }\r
+\r
        }\r
 \r
 }\r