←Select platform

SetFontName Method

Summary

Replaces the specific type of font used in the final document.

Syntax

C#
VB
Java
Objective-C
WinRT C#
C++
Sub SetFontName( _ 
   ByVal languageName As String, _ 
   ByVal fontType As Leadtools.Forms.Ocr.OcrDocumentFontType, _ 
   ByVal fontName As String _ 
)  
- (void)setFontName:(NSString *)fontName 
        forLanguage:(LTOcrLanguage)language 
           fontType:(LTOcrDocumentFontType)fontType 
              error:(NSError **)error 
             
public void setFontName(String languageName, OcrDocumentFontType fontType, String fontName) 
             
function Leadtools.Forms.Ocr.IOcrDocumentManager.SetFontName(  
   languageName , 
   fontType , 
   fontName  
) 

Parameters

languageName
The language name. See remarks for more information.

fontType
The type of font to replace.

fontName
The font name that will be used in final document.

Remarks

You can also use GetFontNames and SetFontNames to get or set the font names using an array.

Use GetFontName and SetFontName to get/set the fonts used in the final recognized document (PDF, DOC, HTML, etc). The fonts will not be used when the final document format is text.

The OCR engine uses six different fonts when creating the final output document as follows: description:

OcrDocumentFontType Description
OcrDocumentFontType.ProportionalSerif The font used with proportional serif characters
OcrDocumentFontType.ProportionalSansSerif The font used with proportional sans-serif characters
OcrDocumentFontType.FixedSerif The font used with monospaced serif characters
OcrDocumentFontType.FixedSansSerif The font used with monospaced sans-serif characters
OcrDocumentFontType.MICR The font used with MICR (check font) characters

The OcrCharacter.FontStyle member of each character returned in IOcrPage.GetRecognizedCharacters determines which font to use with the character. If the zone is ICR or MICR (the OcrZone.ZoneType member is OcrZoneType.Icr or OcrZoneType.Micrthen the character will use the ICR or MICR fonts accordingly.

The OCR engine keeps a list of fonts for some languages, for example all the Latin languages currently use the same font. So passing languageName equals to "en" for English or "de" for German will change the default Latin fonts used in the final document. This is the equivalent of passing null (Nothing in VB).

If the OCR engine supports Asian languages, then each language will have its own font sets and you can get/set these fonts individually. Currently, the LEADTOOLS OCR toolkits supports individual fonts for Latin (null), Japanese (ja), Korean (ko), Chinese (zh-Hans and zh-Hant) and Korean (ko). The following table lists the default fonts used for each language:

Language Fonts
Latin (all other languages) including languageName equals to null
Font Value
Proportional Serif Times New Roman
Proportional Sans-Serif Arial
Monospace Serif Courier New
Monospace Sans-Serif Arial
ICR Bookman Old Style
MICR Arial Unicode MS
Japanese (languageName equals to "ja")
Font Value
Proportional Serif MS PMincho
Proportional Sans-Serif MS PGothic
Monospace Serif MS Gothic
Monospace Sans-Serif SimSun
ICR MS Gothic
MICR SimSun
Chinese (languageName equals to "zh-Hans" or "zh-Hant")
Font Value
Proportional Serif SimSun
Proportional Sans-Serif SimHei
Monospace Serif Hei Simplified
Monospace Sans-Serif SimSun
ICR Hei Simplified
MICR SimSun
Korean (languageName equals to "ko")
Font Value
Proportional Serif Gungsuh
Proportional Sans-Serif Gulim
Monospace Serif Dotum
Monospace Sans-Serif Gungsuh
ICR Dotum
MICR Gungsuh
Font Value
Proportional Serif Times New Roman
Proportional Sans-Serif Arial
Monospace Serif Courier New
Monospace Sans-Serif Arial
ICR Bookman Old Style
MICR Arial Unicode MS
Font Value
Proportional Serif MS PMincho
Proportional Sans-Serif MS PGothic
Monospace Serif MS Gothic
Monospace Sans-Serif SimSun
ICR MS Gothic
MICR SimSun
Font Value
Proportional Serif SimSun
Proportional Sans-Serif SimHei
Monospace Serif Hei Simplified
Monospace Sans-Serif SimSun
ICR Hei Simplified
MICR SimSun
Font Value
Proportional Serif Gungsuh
Proportional Sans-Serif Gulim
Monospace Serif Dotum
Monospace Sans-Serif Gungsuh
ICR Dotum
MICR Gungsuh

Note that changing the fonts is not recommended in most cases, the character position and size is calculated based on the default fonts even if the user changes the fonts before the recognition process. After the changing the fonts, it might be required to use IOcrPage.GetRecognizedCharacters and IOcrPage.SetRecognizedCharacters to further change the character position and font size to create the final output document.

Example

For an example, refer to GetFontName.

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Forms.Ocr Assembly
Click or drag to resize