mono / libgdiplus

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

Does not rendering some characters. #715

Open N08I40K opened 2 years ago

N08I40K commented 2 years ago

If the repeating characters are similar to these "π‘Ž 𝑑 𝑧 𝑒 π”₯", then the operation of drawing text on the picture does not occur, and subsequent ones too.

C# Example


string text = "π‘Ž 𝑑 𝑧 𝑒 π”₯";
using (Bitmap MainPicture = new Bitmap(1000, 500, PixelFormat.Format24bppRgb))
using (Rectangle TextRectangle1 = new Rectangle(25, 25, 950, 200))
using (Rectangle TextRectangle2 = new Rectangle(25, 250, 950, 200))
using (Graphics graph = Graphics.FromImage(MainPicture))
using (Font font = new Font("Arial", 35, FontStyle.Regular))
{
    graph.FillRectangle(Brushes.Black, FillRectangle);

    Console.WriteLine("TEXT: " + text);
    // Draw text
    graph.DrawString("\"" + text + "\"", font, Brushes.White, TextRectangle1, StringFormat.GenericTypographic);
    graph.DrawString("Normal text", font, Brushes.White, TextRectangle2, StringFormat.GenericTypographic);

    MainPicture.Save("path/to/picture.png", System.Drawing.Imaging.ImageFormat.Png);
}```

Configuration

Linux (KDE neon) x64/

The application compiles and runs on Linux. Mono 6.12.0.122 is used to run.
IDE: MonoDevelop 7.4.8 (build 2)

I think this is because of the character encoding. Windows-1251.

I did not find any workarounds. Suggestions to use other fonts (like "Cambria Math"), but it didn't help.