Browse Source

Merge pull request #66 from ncarrillo/pango-tweaks

Pango tweaks
pull/69/head
Steven Kirk 11 years ago
parent
commit
ceda47a27f
  1. 4
      Cairo/Perspex.Cairo/Media/DrawingContext.cs
  2. 23
      Cairo/Perspex.Cairo/Media/FormattedTextImpl.cs
  3. 2
      Gtk/Perspex.Gtk/WindowImpl.cs

4
Cairo/Perspex.Cairo/Media/DrawingContext.cs

@ -175,7 +175,7 @@ namespace Perspex.Cairo.Media
/// </summary>
/// <param name="pen">The pen.</param>
/// <param name="rect">The rectangle bounds.</param>
public void DrawRectange(Pen pen, Rect rect)
public void DrawRectange(Pen pen, Rect rect, float cornerRadius)
{
this.SetPen(pen);
this.context.Rectangle(rect.ToCairo());
@ -202,7 +202,7 @@ namespace Perspex.Cairo.Media
/// </summary>
/// <param name="brush">The brush.</param>
/// <param name="rect">The rectangle bounds.</param>
public void FillRectange(Perspex.Media.Brush brush, Rect rect)
public void FillRectange(Perspex.Media.Brush brush, Rect rect, float cornerRadius)
{
this.SetBrush(brush);
this.context.Rectangle(rect.ToCairo());

23
Cairo/Perspex.Cairo/Media/FormattedTextImpl.cs

@ -29,23 +29,25 @@ namespace Perspex.Cairo.Media
this.Layout.FontDescription = new Pango.FontDescription
{
Family = fontFamily,
Size = Pango.Units.FromDouble(fontSize),
Size = Pango.Units.FromDouble(fontSize * 0.73),
Style = (Pango.Style)fontStyle,
Weight = fontWeight.ToCairo()
};
this.Layout.Alignment = textAlignment.ToCairo();
}
private Size size;
public Size Constraint
{
get
{
return new Size(this.Layout.Width, double.PositiveInfinity);
return size;
}
set
{
this.size = value;
this.Layout.Width = Pango.Units.FromDouble(value.Width);
}
}
@ -92,8 +94,14 @@ namespace Perspex.Cairo.Media
public IEnumerable<Rect> HitTestTextRange(int index, int length, Point origin)
{
// TODO: Implement.
return new Rect[0];
var ranges = new List<Rect>();
for (var i = 0; i < length; i++)
{
ranges.Add(this.HitTestTextPosition(index+i));
}
return ranges;
}
public Size Measure()
@ -102,11 +110,6 @@ namespace Perspex.Cairo.Media
int height;
this.Layout.GetPixelSize(out width, out height);
if (this.Layout.Alignment == Pango.Alignment.Right)
{
return new Size(width, height);
}
return new Size(width, height);
}

2
Gtk/Perspex.Gtk/WindowImpl.cs

@ -133,7 +133,7 @@ namespace Perspex.Gtk
protected override bool OnConfigureEvent(Gdk.EventConfigure evnt)
{
var newSize = new Size(evnt.Width, evnt.Height);
if (newSize != this.clientSize)
{
this.Resized(newSize);

Loading…
Cancel
Save