Added workaround for broken Mono GDI+ text offset.

Commented-out unused code.
This commit is contained in:
the_fiddler 2009-05-30 17:35:42 +00:00
parent 4773f4470f
commit 2bdf2e9828
2 changed files with 17 additions and 1 deletions

View file

@ -12,7 +12,7 @@ namespace Examples
{
#region Fields
PrivateFontCollection font_collection = new PrivateFontCollection();
//PrivateFontCollection font_collection = new PrivateFontCollection();
#endregion

View file

@ -385,6 +385,22 @@ namespace OpenTK.Graphics.Text
}
}
// Mono's GDI+ implementation suffers from an issue where the specified layoutRect is not taken into
// account. We will try to improve the situation by moving text to the correct location on this
// error condition. This will not help word wrapping, but it is better than nothing.
// Todo: Mono 2.8 is supposed to ship with a Pango-based GDI+ text renderer, which should not
// suffer from this bug. Verify that this is the case and remove the hack.
if (Configuration.RunningOnMono && (layoutRect.X != 0 || layoutRect.Y != 0) && measured_glyphs.Count > 0)
{
for (int i = 0; i < measured_glyphs.Count; i++)
{
RectangleF rect = measured_glyphs[i];
rect.X += layoutRect.X;
rect.Y += layoutRect.Y;
measured_glyphs[i] = rect;
}
}
return measured_glyphs;
}