aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-07-11 06:24:45 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-07-11 06:24:45 +0200
commit10fd075dd4aa49d90a75e7e41a15a28996b6b736 (patch)
treeb51c5cb216c6679a88b67a4e79b7d2d630b186ed /src
parent2b4574f91b46193f9be68e65d1be1ab0038160c2 (diff)
global FontRenderingOptions for cairo
Diffstat (limited to 'src')
-rw-r--r--src/GraphicObjects/Label.cs6
-rw-r--r--src/GraphicObjects/TextRun.cs3
-rw-r--r--src/Interface.cs7
3 files changed, 12 insertions, 4 deletions
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
+
/// <summary>
/// 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<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;