If I have System.Drawing.Bitmap with equal sizes e.g. 100x100, 50x50, and I wanted to use this code to draw a single character:
StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; font = new Font(_fontName, _fontSize, _fontStyle); GraphicsPath path = new GraphicsPath(); path.AddString("A", font.FontFamily, (int)font.Style, font.Size, rect, stringFormat);
How can I calculate the value for _fontSize so that it fits snugly into the image?
source share