mono / libgdiplus

C-based implementation of the GDI+ API
http://www.mono-project.com/
MIT License
334 stars 171 forks source link

A long string without spaces and line breaks is drawn without word wrap in Linux #624

Open andrey-astakhov opened 4 years ago

andrey-astakhov commented 4 years ago

Below is the code-snippet illustrating the issue. In Windows the code works fine.

RectangleF textRect = new RectangleF(new PointF(0, 0), new SizeF(115, 44));
Rectangle borderRect = new Rectangle(new Point(0, 0), new Size(116, 45));
string textToDraw = "WordWrapWordWrapWordWrapWordWrapWordWrapWordWrapWordWrapWordWrapWordWrap";
Image img = new Bitmap(117, 46);
Graphics gr = Graphics.FromImage(img);
Font font = new Font("Arial", 9.75f);
Brush brush = Brushes.Black;
gr.DrawRectangle(new Pen(brush), borderRect);
gr.DrawString(textToDraw, font, brush, textRect);
img.Save("drawing.png", ImageFormat.Png);

Thanks, Andy.

oleg-varlamov commented 4 years ago

Is there any movement on this? We have the same problem with controls on CentOS!

IshmaZX82 commented 4 years ago

The same issue, using v6.0.5 on Debian Also, the rest of the text after this long word is not displayed at all ... For example, for "WordWrapWordWrapWordWrapWordWrapWordWrapWordWrapWrapWordWrap 1 2 3 4 5", only left part of first word will be visible,