libgdiplus icon indicating copy to clipboard operation
libgdiplus copied to clipboard

Does not rendering some characters.

Open n08i40k opened this issue 3 years ago • 0 comments

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.

n08i40k avatar Sep 04 '21 16:09 n08i40k