https://bugzilla.novell.com/show_bug.cgi?id=327039#c2
Bart Jansen <[EMAIL PROTECTED]> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[EMAIL
PROTECTED]
Status|NEEDINFO |NEW
Info Provider|[EMAIL PROTECTED] |
--- Comment #2 from Bart Jansen <[EMAIL PROTECTED]> 2007-09-21 13:55:37 MST ---
Some explanation on the problem: I draw a rectangle on the screen of a given
size and I have to show a given string inside the rectangle. If the string
does not fit into the rectangle, I have to remove characters from the string
until it fits.
Now, using MeasureString this works fine under windows, however under linux it
is going wrong all the time, no matter the precise string. It might be true
that the difference is not big, but some characters are constantly out of the
rectangle. So, for my application, this was a (big) problem.
So from this experience, it might just be the case that the linux lib is
returning a value which is always x too small or so.
function to trim the string to given length (using MeasureString to show the
problem)
private string trimTextToWidth(string text, int width, Font f, Graphics g)
{
int i = 1;
string result = text.Substring(0, 1);
float w = g.MeasureString(result, f).Width;
while ((w <= width) && (i < text.Length))
{
result += text[i++];
w = g.MeasureString(result, f).Width;
}
return result;
}
SO :
e.FillRectangle(brush, 0, 0, Width, Height);
string t = trimTextToWidth(text, Width, font, e.Graphics);
e.Graphics.DrawString(t, font, brush, 0, 0);
On linux, the text is out of the rectangle, on windows it is perfectly in.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs