Per esempio la 'A' scritta col Carattere "Sans Serif" di dimensione "8" in grassetto, ha come misure del rettangolo circoscritto 10 x 8 (misure date a caso). Per ora mi sono fatto un algoritmino io ma, se esistesse un metodo migliore...
Codice PHP:
Function fitChar(ByVal imgChar As BitmapByVal BackColor As Color) As Bitmap
        Dim x 
As IntegerAs Integer
        Dim xBlank 
As Integer imgChar.WidthyBlank As Integer imgChar.Height
        Dim Blank 
As Boolean True
        Dim retBmp 
As Bitmap
        
For imgChar.Width 1 To 0 Step -1
            
For imgChar.Height 1 To 0 Step -1
                
If imgChar.GetPixel(xy).BackColor.And imgChar.GetPixel(xy).BackColor.And imgChar.GetPixel(xy).BackColor.And imgChar.GetPixel(xy).BackColor.B Then
                    Blank 
Blank And True
                
Else
                    
Blank Blank And False
                End 
If
            
Next
            
If Blank True Then
                xBlank 
x
            
Else
                Exit For
            
End If
        
Next
        Blank 
True

        
For imgChar.Height 1 To 0 Step -1
            
For imgChar.Width 1 To 0 Step -1
                
If imgChar.GetPixel(xy).BackColor.And imgChar.GetPixel(xy).BackColor.And imgChar.GetPixel(xy).BackColor.And imgChar.GetPixel(xy).BackColor.B Then
                    Blank 
Blank And True
                
Else
                    
Blank Blank And False
                End 
If
            
Next
            
If Blank True Then
                yBlank 
y
            
Else
                Exit For
            
End If
        
Next
        
If xBlank 0 Then
            xBlank 
imgChar.Width
        End 
If
        If 
yBlank 0 Then
            yBlank 
imgChar.Height
        End 
If

        
retBmp = New Bitmap(xBlankyBlank)
        For 
0 To xBlank 1
            
For 0 To yBlank 1
                retBmp
.SetPixel(xyimgChar.GetPixel(xy))

            
Next
        Next
        
Return retBmp
    End 
Function 
per esempio


Immagine dove stampo : 48 x 48 pixel (scelti per caso)

Risulta:

Ma se esistesse un metodo dove possa sapere a priori la dimensione del carattere....