change point size calculation to use rotation #41

point size was previously only calculated based on the transformation matrix but now uses the transformation matrix, the rotation matrix and the font matrix values. the calculated value still seems unlikely to be correct so it is exposed using the page's experimental access for now, rather than as a public getter.
This commit is contained in:
Eliot Jones 2019-07-07 12:12:09 +01:00
parent 0dfe742770
commit 198cca1336
2 changed files with 10 additions and 1 deletions

View File

@ -154,6 +154,15 @@
{
return annotationProvider.GetAnnotations();
}
/// <summary>
/// Gets the calculated letter size in points.
/// This is considered experimental because the calculated value is incorrect for some documents at present.
/// </summary>
public decimal GetPointSize(Letter letter)
{
return letter.PointSize;
}
}
}
}

View File

@ -126,7 +126,7 @@
// TODO: this does not seem correct, produces the correct result for now but we need to revisit.
// see: https://stackoverflow.com/questions/48010235/pdf-specification-get-font-size-in-points
var pointSize = decimal.Round(fontSize * transformationMatrix.A, 2);
var pointSize = decimal.Round(rotation.Rotate(transformationMatrix).Multiply(TextMatrices.TextMatrix).Multiply(fontSize).A, 2);
while (bytes.MoveNext())
{