]> O.S.I.I.S - jp/crow.git/commitdiff
global FontRenderingOptions for cairo
authorjpbruyere <jp.bruyere@hotmail.com>
Mon, 11 Jul 2016 04:24:45 +0000 (06:24 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Mon, 11 Jul 2016 04:24:45 +0000 (06:24 +0200)
src/GraphicObjects/Label.cs
src/GraphicObjects/TextRun.cs
src/Interface.cs

index 769220dd25767d2fbe928f0927ac77501aa4adaf..22a60aa0e6e83e1476f8e69e33b54df9d3439b81 100644 (file)
@@ -334,6 +334,7 @@ namespace Crow
                        CurrentColumn = 0;
                        NotifyValueChanged ("Text", Text);
                }
+
                #region GraphicObject overrides
                protected override int measureRawSize(LayoutingType lt)
         {                      
@@ -381,10 +382,10 @@ namespace Crow
 
                        gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
                        gr.SetFontSize (Font.Size);
+                       gr.FontOptions = Interface.FontRenderingOptions;
 
                        gr.Antialias = Antialias.Subpixel;
-                       //gr.FontOptions.Antialias = Antialias.Subpixel;
-                       //gr.FontOptions.HintMetrics = HintMetrics.On;
+
 
                        rText = new Rectangle(new Size(
                                measureRawSize(LayoutingType.Width), measureRawSize(LayoutingType.Height)));
@@ -632,6 +633,7 @@ namespace Crow
                        RegisterForGraphicUpdate ();
                }
                #endregion
+
                /// <summary>
                /// Update Current Column, line and TextCursorPos
                /// from mouseLocalPos
index 7f50a34ee01c615ec7c5378e9903884e012befe9..103f2fcf73a044403fa500052753b854e7860e91 100644 (file)
@@ -174,10 +174,9 @@ namespace Crow
 
                        gr.SelectFontFace (Font.Name, Font.Slant, Font.Wheight);
                        gr.SetFontSize (Font.Size);
+                       gr.FontOptions = Interface.FontRenderingOptions;
 
                        gr.Antialias = Antialias.Subpixel;
-                       //gr.FontOptions.Antialias = Antialias.Subpixel;
-                       //gr.FontOptions.HintMetrics = HintMetrics.On;
 
                        rText = new Rectangle(new Size(
                                measureRawSize(LayoutingType.Width), measureRawSize(LayoutingType.Height)));
index 0ab08f598524f12e07909bc5f740f3efdab99e2a..d0c385e781a2f5242c241d6544c4e0ea58ceefae 100644 (file)
@@ -35,6 +35,12 @@ namespace Crow
                #region CTOR
                static Interface(){
                        Interface.LoadCursors ();
+
+                       FontRenderingOptions = new FontOptions ();
+                       FontRenderingOptions.Antialias = Antialias.Subpixel;
+                       FontRenderingOptions.HintMetrics = HintMetrics.On;
+                       FontRenderingOptions.HintStyle = HintStyle.Medium;
+                       FontRenderingOptions.SubpixelOrder = SubpixelOrder.Rgb;
                }
                public Interface(){
                        LayoutingQueue = new Queue<LayoutingQueueItem>();
@@ -64,6 +70,7 @@ namespace Crow
                public static int BorderThreshold = 5;
                public const int MaxCacheSize = 2048;
                public const int MaxLayoutingTries = 50;
+               public static FontOptions FontRenderingOptions;
                #endregion
 
                public Queue<LayoutingQueueItem> LayoutingQueue;