Added workaround for broken Mono GDI+ text offset.
Commented-out unused code.
This commit is contained in:
parent
4773f4470f
commit
2bdf2e9828
2 changed files with 17 additions and 1 deletions
|
@ -12,7 +12,7 @@ namespace Examples
|
|||
{
|
||||
#region Fields
|
||||
|
||||
PrivateFontCollection font_collection = new PrivateFontCollection();
|
||||
//PrivateFontCollection font_collection = new PrivateFontCollection();
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue