コード例 #1
0
ファイル: ExampleForm.cs プロジェクト: HinTak/SharpFont
        public ExampleForm()
        {
            InitializeComponent();

            fontService = new FontService();
            fontFolder = "Fonts/";
            sampleText = "SharpFont";
            // Some variations of the character set shown by the Windows Font Viewer
            //sampleText = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890.:,;'\"(!?)+-*//=";
            //sampleText = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890";
            sampleText = "abcdefghijklmnopqrstuvwxyz";
            fontService.Size = 62f;
            fontSize = 62f;
            mainMenuFontSize.Text = fontService.Size.ToString("0.0");
            foreColor = Color.Black;
            backColor = Color.Transparent;

            decimal testValue = 12.1234567890123456M;
            Debug.Print("testValue  : {0}", (double)testValue);
            // none of these keep the precision I was expecting...
            var f26 = new Fixed26Dot6(testValue);
            Debug.Print("Fixed 26.6 : {0}", (double)f26);
            Debug.Print("Fixed 26.6 : {0}", f26);
            var f16 = new Fixed16Dot16(testValue);
            Debug.Print("Fixed 16.16: {0}", (double)f16);
            Debug.Print("Fixed 16.16: {0}", f16);
            var f2 = new Fixed2Dot14((double)testValue); // decimal constructor crashes here
            Debug.Print("Fixed  2.14: {0}", (double)f2);
            Debug.Print("Fixed  2.14: {0}", f2);
        }
コード例 #2
0
ファイル: ExampleForm.cs プロジェクト: stride3d/SharpFont
        public ExampleForm()
        {
            InitializeComponent();

            fontService = new FontService();
            fontFolder  = "Fonts/";
            sampleText  = "SharpFont";
            // Some variations of the character set shown by the Windows Font Viewer
            //sampleText = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890.:,;'\"(!?)+-*//=";
            //sampleText = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890";
            sampleText            = "abcdefghijklmnopqrstuvwxyz";
            fontService.Size      = 62f;
            fontSize              = 62f;
            mainMenuFontSize.Text = fontService.Size.ToString("0.0");
            foreColor             = Color.Black;
            backColor             = Color.Transparent;

            decimal testValue = 12.1234567890123456M;

            Debug.Print("testValue  : {0}", (double)testValue);
            // none of these keep the precision I was expecting...
            var f26 = new Fixed26Dot6(testValue);

            Debug.Print("Fixed 26.6 : {0}", (double)f26);
            Debug.Print("Fixed 26.6 : {0}", f26);
            var f16 = new Fixed16Dot16(testValue);

            Debug.Print("Fixed 16.16: {0}", (double)f16);
            Debug.Print("Fixed 16.16: {0}", f16);
            var f2 = new Fixed2Dot14((double)testValue);             // decimal constructor crashes here

            Debug.Print("Fixed  2.14: {0}", (double)f2);
            Debug.Print("Fixed  2.14: {0}", f2);
        }
コード例 #3
0
 private void ShowException(Exception ex)
 {
     statusLabel.Text = ex.Message;
     if (ex.GetType() == typeof(FreeTypeException))
     {
         fontService      = new FontService();
         fontService.Size = fontSize;
     }
     statusLabel.Image = SystemIcons.Error.ToBitmap();
 }
コード例 #4
0
ファイル: ExampleForm.cs プロジェクト: HinTak/SharpFont
 private void ShowException(Exception ex)
 {
     statusLabel.Text = ex.Message;
     if (ex.GetType() == typeof(FreeTypeException))
     {
         fontService = new FontService();
         fontService.Size = fontSize;
     }
     statusLabel.Image = SystemIcons.Error.ToBitmap();
 }