1

I run this code:

graphics.DrawString("( پنج)", new Font(IranNastaliq, 77), ...);

which results in:
enter image description here
As you can see, circled parts are overlaid and turned transparent. Why those parts get transparent and how should I prevent it?

AmirSina Mashayekh
  • 498
  • 1
  • 5
  • 21
  • 1
    Looks like a Font error to me. - You could try `TextRenderer.DrawText(graphics, ...)` – TaW Sep 09 '20 at 19:31
  • @TaW Overlays are caused by font but there are no transparencies in other apps. Also, `TextRenderer` solved the problem but rendered text needs antialiasing. I can't find how should I enable antialiasing for `TextRenderer`. – AmirSina Mashayekh Sep 10 '20 at 05:11
  • Antialiasing . This ought to be done by setting the properties of the Graphics object it takes. I have a hunch that graphics.DrawString get confused and creates a wrong GraphicsPath in the process. Is it just the holes or is the whole shape wrong? GraphicsPath.AddText would be another option which would let you test tw o WindingMOdes. - TextRenderer is recommended for everything except(!!) printing.. – TaW Sep 10 '20 at 09:27
  • @TaW I set properties of Graphics object like [this post](https://stackoverflow.com/q/63720333/10600811). However, `TextRenderer` still generate jagged texts. – AmirSina Mashayekh Sep 11 '20 at 16:12
  • Maybe setting the [TextContrast](https://learn.microsoft.com/en-us/dotnet/api/system.drawing.graphics.textcontrast?view=dotnet-plat-ext-3.1) lower would help? – TaW Sep 11 '20 at 17:50
  • @TaW I changed many properties of my Graphics object but `TextRenderer` doesn't care at all! It always render the same. – AmirSina Mashayekh Sep 12 '20 at 03:13

0 Answers0