2

When I call Graphics.MeasureString("?\u200d") I get an ExternalException "A generic error occurred in GDI+".

\u200d is the unicode "zero width joiner", and I guess it is being used incorrectly, but I cannot control the data my users supply, and yet I want to measure it for display. It also throws the exception when it draws.

I guess I just have to work around this, though it surprises me.

I note that Visual Studio can render the string, perhaps because it is not built on top of GDI+?

Any suggestions?

Oliver Bock
  • 4,829
  • 5
  • 38
  • 62

1 Answers1

2

Use TextRenderer.MeasureText(), and see the excellent (long) answer in Graphics.DrawString vs TextRenderer.DrawText?Which can Deliver Better Quality

Oliver Bock
  • 4,829
  • 5
  • 38
  • 62