Image size: Italic support [PATCH]
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
WPF-Math |
New
|
Undecided
|
Unassigned |
Bug Description
Image size is incorrectly calculated when using italic.
I'm not sure if this patch 100% correct but it seems to work for the samples I tested.
diff --git a/WpfMath/Box.cs b/WpfMath/Box.cs
index 59311b4..17e0006 100644
--- a/WpfMath/Box.cs
+++ b/WpfMath/Box.cs
@@ -54,6 +54,17 @@ namespace WpfMath
get { return this.Height + this.Depth; }
}
+ public double TotalWidth
+ {
+ get { return this.Width + this.Italic; }
+ }
+
+ public double Italic
+ {
+ get;
+ set;
+ }
+
public double Width
{
get;
@@ -84,7 +95,7 @@ namespace WpfMath
{
// Fill background of box with color.
- this.Width * scale, (this.Height + this.Depth) * scale));
+ (this.Width + this.Italic) * scale, (this.Height + this.Depth) * scale));
}
}
diff --git a/WpfMath/
index 0e3d877..66d6ce4 100644
--- a/WpfMath/
+++ b/WpfMath/
@@ -17,6 +17,7 @@ namespace WpfMath
+ this.Italic = charInfo.
}
public CharInfo Character
diff --git a/WpfMath/
index bf049d1..7b69ae1 100644
--- a/WpfMath/
+++ b/WpfMath/
@@ -59,6 +59,7 @@ namespace WpfMath
+ this.Italic = Math.Max(
}
public override void Draw(DrawingContext drawingContext, double scale, double x, double y)
diff --git a/WpfMath/
index fa2d7d7..b00cbf2 100644
--- a/WpfMath/
+++ b/WpfMath/
@@ -33,7 +33,7 @@ namespace WpfMath
{
get
{
- return new Size(this.Box.Width * this.Scale, this.Box.
+ return new Size(this.
}
}
Hello, Marc!
Your patch has been merged into a project fork: https:/ /github. com/ForNeVeR/ wpf-math/ pull/16
Thank you!