Update word bounding box computation

This commit is contained in:
BobLd
2020-01-17 11:03:09 +00:00
committed by Eliot Jones
parent 27edf6cf77
commit 9bcafdaa98
2 changed files with 4 additions and 3 deletions

View File

@@ -55,7 +55,7 @@ namespace UglyToad.PdfPig.Core
/// <summary> /// <summary>
/// Area of the rectangle. /// Area of the rectangle.
/// </summary> /// </summary>
public double Area => Width * Height; public double Area { get; }
/// <summary> /// <summary>
/// Left. /// Left.
@@ -128,6 +128,7 @@ namespace UglyToad.PdfPig.Core
Rotation = Math.Round(t * 180.0 / Math.PI, 5); Rotation = Math.Round(t * 180.0 / Math.PI, 5);
Width = Math.Round(cosSqSinSqInv * (bx * cosT - by * sinT), 5); Width = Math.Round(cosSqSinSqInv * (bx * cosT - by * sinT), 5);
Height = Math.Round(cosSqSinSqInv * (-bx * sinT + by * cosT), 5); Height = Math.Round(cosSqSinSqInv * (-bx * sinT + by * cosT), 5);
Area = Width * Height;
} }
/// <summary> /// <summary>

View File

@@ -196,7 +196,7 @@
minY = letter.EndBaseLine.Y; minY = letter.EndBaseLine.Y;
} }
var right = letter.StartBaseLine.X - letter.GlyphRectangle.Width; var right = letter.StartBaseLine.X + letter.GlyphRectangle.Height;
if (right > maxX) if (right > maxX)
{ {
maxX = right; maxX = right;
@@ -238,7 +238,7 @@
minY = letter.StartBaseLine.Y; minY = letter.StartBaseLine.Y;
} }
var right = letter.StartBaseLine.X - letter.GlyphRectangle.Width; var right = letter.StartBaseLine.X - letter.GlyphRectangle.Height;
if (right < minX) if (right < minX)
{ {
minX = right; minX = right;