MeasureString does not return exact width after rotation <p>I'm using <code>MeasureString</code> method to calculate the width of text but the returned value is not exact. I'm using the following code for calculating text width</p> <pre><code>Size sz = g.MeasureString(text, font); g.DrawString(text, font, brush, new Rectangle(0, 0, (int)sz.Width, (int)sz.Height), stringFormat); g.DrawRectangle(Pens.Red, new Rectangle(0, 0, (int)sz.Width, (int)sz.Height)); </code></pre> <p>This works fine without rotation. I'm using the following code to draw rotated text</p> <pre><code>g.RotateTransform(angle); Size sz = g.MeasureString(text, font); g.DrawString(text, font, brush, new Rectangle(0, 0, (int)sz.Width, (int)sz.Height), stringFormat); g.DrawRectangle(Pens.Red, new Rectangle(0, 0, (int)sz.Width, (int)sz.Height)); </code></pre> <p>The width value returned for second code snippet is different from first one and also it's not correct. See the following image</p> <p><img src="https://i.stack.imgur.com/ADUmJ.png" alt="Additional space"></p> <p>At the bottom of the rectangle there is some additional space after text. The rectangle was drawn based on the width and height of the string so I think this has something to do with <code>MeasureString</code> method. </p> <p>Please share your thoughts on avoiding this</p> <p>Edit:</p> <p>More space can be seen if text length is long (say 30 or more characters) .Rotation works fine for angles 0, 90, 180 and 270. Attached a screenshot</p> <p><img src="https://i.stack.imgur.com/ZNVcC.png" alt="At 90 degree"></p>