inexorabletash wrote:
Note that the other text is now offset as if rendered centered vs. top-left. If I restart the process (e.g. rebuild) then the odd offsets reset. The offsets don't accumulate; it's either present or not.
This appears to be because I was saving XStringFormat instances - see
viewtopic.php?f=3&t=2403 - rather than using the accessors that mint new instances in XStringFormats:
i.e. instead of this:
Code:
g.DrawString(glyph.Characters, font, brush, x, y, XStringFormats.Center);
I was doing this:
Code:
g.DrawString(glyph.Characters, font, brush, x, y, StringFormatCentered);
//...
private static XStringFormat CreateStringFormat(XStringAlignment alignment, XLineAlignment
lineAlignment)
{
XStringFormat format = new XStringFormat();
format.Alignment = alignment;
format.LineAlignment = lineAlignment;
return format;
}
public static XStringFormat StringFormatCentered { get { return centeredFormat; } }
private static readonly XStringFormat centeredFormat = CreateStringFormat(XStringAlignment.
Center, XLineAlignment.Center);
So something in 1.50 changed how "saved" XStringFormat instances behave when used for different rendering passes.