Hi!
I have a small problem and I'd be more than happy if anyone helped me.
A project I'm currently working on uses MigraDoc PdfSharp. So far it used the latest stable version: 1.32.2608, but we are trying to migrate to a newer, prerelease version (because of a connected project using 1.50.4619-beta4c). And almost everything looks fine, but there is one thing I'm not sure how to get around. There is a function measuring a string's size, looking (to put it simply) something about that:
Code:
protected SSize GetSize(string text, MigraDoc.DocumentObjectModel.Font font)
{
var doc = new PdfDocument();
var page = doc.AddPage;
var sizer = XGraphics.FromPdfPage(page);
var style = XFontStyle.Regular;
//some style checks
var xf = new XFont(font.Name, font.Size, style);
var st = new XStringFormat();
st.FormatFlags = XStringFormatFlags.MeasureTrailingSpaces;
var xs = sizer.MeasureString(text, xf, st);
return new SSize {
Height = XUnit.FromPoint(xs.Height * _measureCorrection).Centimeter,
Width = XUnit.FromPoint(xs.Width * _measureCorrection).Centimeter
};
}
and the problematic line is:
Code:
st.FormatFlags = XStringFormatFlags.MeasureTrailingSpaces;
as the XStringFormat lost the FormatFlags property, and there is no longer the XStringFormatFlags enum.
Could anyone give me a clue, how to transform it properly to a new version?