NumFonts Property
Returns the number of fonts in the recognized text. Read-only Long.
expression.NumFonts
*expression * Required. An expression that returns a Layout object.
Remarks
Fonts are differentiated not only by font family (for example, Times or Helvetica) but also by size, font face style (bold, italic, etc.), and serif style (sans, thin, etc.).
As a result of optical character recognition (OCR) preprocessing, the NumFonts property may return a number which is greater than the number of fonts identified in the recognized text. Check the FontId property of each word in the Words collection to determine the exact number of fonts actually found.
Example
The following example loads a document, performs OCR on the first page, and then displays information, including the number of fonts, about the page's OCR layout.
Sub TestLayoutProperties()
Dim miDoc As MODI.Document
Dim miLayout As MODI.Layout
Dim strLayoutInfo As String
Set miDoc = New MODI.Document
miDoc.Create "C:\document1.tif"
miDoc.Images(0).OCR
Set miLayout = miDoc.Images(0).Layout
strLayoutInfo = _
"Language: " & miLayout.Language & vbCrLf & _
"Number of characters: " & miLayout.NumChars & vbCrLf & _
"Number of fonts: " & miLayout.NumFonts & vbCrLf & _
"Number of words: " & miLayout.NumWords & vbCrLf & _
"Beginning of text: " & Left(miLayout.Text, 50) & vbCrLf & _
"First word of text: " & miLayout.Words(0).Text
MsgBox strLayoutInfo, vbInformation + vbOKOnly, _
"Layout Information"
Set miLayout = Nothing
Set miDoc = Nothing
End Sub
Applies to | Layout Object