Beispiel #1
0
        public static void Main(string[] args)
        {
            //HACK I'm making the assumption that the .dll.config will correctly resolve Linux and OS X.
            //Therefore only Windows needs to switch dirs.
            int p = (int)Environment.OSVersion.Platform;

            if (p != 4 && p != 6 && p != 128)
            {
                //Thanks StackOverflow! http://stackoverflow.com/a/2594135/1122135
                string path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                path = Path.Combine(path, IntPtr.Size == 8 ? "x64" : "x86");
                if (!SetDllDirectory(path))
                {
                    throw new System.ComponentModel.Win32Exception();
                }
            }

            var form = new ExampleForm();

            Application.EnableVisualStyles();
            Application.Run(form);

            /*try
             * {
             *      using (Library lib = new Library())
             *      {
             *              Console.WriteLine("FreeType version: " + lib.Version + "\n");
             *
             *              using (Face face = lib.NewFace(@"Fonts/Cousine-Regular-Latin.ttf", 0))
             *              {
             *                      //attach a finalizer delegate
             *                      face.Generic = new Generic(IntPtr.Zero, OnFaceDestroyed);
             *
             *                      //write out some basic font information
             *                      Console.WriteLine("Information for font " + face.FamilyName);
             *                      Console.WriteLine("====================================");
             *                      Console.WriteLine("Number of faces: " + face.FaceCount);
             *                      Console.WriteLine("Face flags: " + face.FaceFlags);
             *                      Console.WriteLine("Style: " + face.StyleName);
             *                      Console.WriteLine("Style flags: " + face.StyleFlags);
             *
             *                      face.SetCharSize(0, 32, 0, 96);
             *
             *                      Console.WriteLine("\nWriting string \"Hello World!\":");
             *                      Bitmap bmp = RenderString(face, "Hello World!");
             *                      bmp.Save("helloworld.png", ImageFormat.Png);
             *                      bmp.Dispose();
             *
             *                      Console.WriteLine("Done!\n");
             *              }
             *      }
             * }
             * catch (FreeTypeException e)
             * {
             *      Console.Write(e.Error.ToString());
             * }
             *
             * Console.ReadKey();*/
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            //HACK I'm making the assumption that the .dll.config will correctly resolve Linux and OS X.
            //Therefore only Windows needs to switch dirs.
            int p = (int)Environment.OSVersion.Platform;
            if (p != 4 && p != 6 && p != 128)
            {
                //Thanks StackOverflow! http://stackoverflow.com/a/2594135/1122135
                string path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                path = Path.Combine(path, IntPtr.Size == 8 ? "x64" : "x86");
                if (!SetDllDirectory(path))
                    throw new System.ComponentModel.Win32Exception();
            }

            var form = new ExampleForm();
            Application.EnableVisualStyles();
            Application.Run(form);

            /*try
            {
                using (Library lib = new Library())
                {
                    Console.WriteLine("FreeType version: " + lib.Version + "\n");

                    using (Face face = lib.NewFace(@"Fonts/Cousine-Regular-Latin.ttf", 0))
                    {
                        //attach a finalizer delegate
                        face.Generic = new Generic(IntPtr.Zero, OnFaceDestroyed);

                        //write out some basic font information
                        Console.WriteLine("Information for font " + face.FamilyName);
                        Console.WriteLine("====================================");
                        Console.WriteLine("Number of faces: " + face.FaceCount);
                        Console.WriteLine("Face flags: " + face.FaceFlags);
                        Console.WriteLine("Style: " + face.StyleName);
                        Console.WriteLine("Style flags: " + face.StyleFlags);

                        face.SetCharSize(0, 32, 0, 96);

                        Console.WriteLine("\nWriting string \"Hello World!\":");
                        Bitmap bmp = RenderString(face, "Hello World!");
                        bmp.Save("helloworld.png", ImageFormat.Png);
                        bmp.Dispose();

                        Console.WriteLine("Done!\n");
                    }
                }
            }
            catch (FreeTypeException e)
            {
                Console.Write(e.Error.ToString());
            }

            Console.ReadKey();*/
        }
Beispiel #3
0
        public static void Main(string[] args)
        {
            //HACK I'm making the assumption that the .dll.config will correctly resolve Linux and OS X.
            //Therefore only Windows needs to switch dirs.
            int p = (int)Environment.OSVersion.Platform;
            if (p != 4 && p != 6 && p != 128)
            {
                //Thanks StackOverflow! http://stackoverflow.com/a/2594135/1122135
                string path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                path = Path.Combine(path, IntPtr.Size == 8 ? "x64" : "x86");
                if (!SetDllDirectory(path))
                    throw new System.ComponentModel.Win32Exception();
            }

            var form = new ExampleForm();
            Application.EnableVisualStyles();
            Application.Run(form);
        }
Beispiel #4
0
        public static void Main(string[] args)
        {
            //HACK I'm making the assumption that the .dll.config will correctly resolve Linux and OS X.
            //Therefore only Windows needs to switch dirs.
            int p = (int)Environment.OSVersion.Platform;

            if (p != 4 && p != 6 && p != 128)
            {
                //Thanks StackOverflow! http://stackoverflow.com/a/2594135/1122135
                string path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                path = Path.Combine(path, IntPtr.Size == 8 ? "x64" : "x86");
                if (!SetDllDirectory(path))
                {
                    throw new System.ComponentModel.Win32Exception();
                }
            }

            var form = new ExampleForm();

            Application.EnableVisualStyles();
            Application.Run(form);
        }