From: jpbruyere Date: Mon, 11 Jul 2016 04:24:45 +0000 (+0200) Subject: global FontRenderingOptions for cairo X-Git-Tag: v0.4~59 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=10fd075dd4aa49d90a75e7e41a15a28996b6b736;p=jp%2Fcrow.git global FontRenderingOptions for cairo --- diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs index 769220dd..22a60aa0 100644 --- a/src/GraphicObjects/Label.cs +++ b/src/GraphicObjects/Label.cs @@ -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 + /// /// Update Current Column, line and TextCursorPos /// from mouseLocalPos diff --git a/src/GraphicObjects/TextRun.cs b/src/GraphicObjects/TextRun.cs index 7f50a34e..103f2fcf 100644 --- a/src/GraphicObjects/TextRun.cs +++ b/src/GraphicObjects/TextRun.cs @@ -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))); diff --git a/src/Interface.cs b/src/Interface.cs index 0ab08f59..d0c385e7 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -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(); @@ -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 LayoutingQueue;