[RESOLVED] Font Size in MM
Hello,
I have a strange problem which I am really struggling with, im making a type of CAD program which the user needs to specify a font size in mm.
Everything seems to work ok but when I get the bounding box of the font it reports it as being less than the font height specified. I have pasted the code below. I hope someone here could help me.
vb.net Code:
Using G As Graphics = PictureBox1.CreateGraphics
G.PageUnit = GraphicsUnit.Millimeter
G.InterpolationMode = InterpolationMode.HighQualityBicubic
DPI = G.DpiY
Dim emSize As Single = txtHeight.Text.Replace("mm", "")
Using myPath2 As New GraphicsPath
Dim DrawPoint As PointF = New PointF(4, 5)
Dim myStringFormat As StringFormat = New StringFormat()
myPath2.AddString(txtText.Text, fntFont.Font.FontFamily, fntFont.Font.Style, emSize, DrawPoint, myStringFormat)
'Get all points
PointsArr.AddRange(myPath2.PathData.Points)
'Draw the text using coords
If loadXY5 = True Then
myPath2.AddLines(XY5Points.ToArray)
Else
myPath2.AddLines(PointsArr.ToArray)
End If
boundRect = myPath2.GetBounds()
PictureBox1.Invalidate()
End Using
End Using
lblBlankSize.Text = "Blank Size:- " & Math.Round(boundRect.Width) & " X " & Math.Round(boundRect.Height)