#include "ltocr.h"
L_LTOCR_API L_INT EXT_FUNCTION L_OcrDocumentManager_SetFontName(documentManager, language, documentFontType, value)
Replaces the specific type of font used in the final document.
Handle to the OCR engine document manager.
language ID
The type of font to replace.
The font name that will be used in final document.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Use L_OcrDocumentManager_GetFontName and L_OcrDocumentManager_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. For more information, refer to L_OcrDocumentFontType.
The L_OcrCharacter.FontStyles member of each character returned in L_OcrPage_GetRecognizedCharacters determines which font to use with the character. If the zone is MICR (the L_OcrZone.ZoneType member is L_OcrZoneType.MICR) then the character will use the 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 language equals to L_OcrLanguage_EN for English or L_OcrLanguage_DE for German will change the default Latin fonts used in the final document.
If the OCR engine has Asian languages enabled, 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, Japanese, Korean and Chinese (zh-Hans and zh-Hant). The following table lists the default fonts used for each language:
Latin (all other languages) including language equals to L_OcrLanguage_None
.
Font | Value |
---|---|
Proportional Serif | Times New Roman |
Proportional Sans-Serif | Arial |
Monospace Serif | Courier New |
Monospace Sans-Serif | Courier New |
ICR | Bookman Old Style |
MICR | Arial Unicode MS |
Japanese (language equals to L_OcrLanguage_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 (language equals to L_OcrLanguage_ZH_HANS
or L_OcrLanguage_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 (language equals to L_OcrLanguage_KO)
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 L_OcrPage_GetRecognizedCharacters and L_OcrPage_SetRecognizedCharacters to further change the character position and font size to create the final output document.
Required DLLs and Libraries
For an example, refer to L_OcrDocumentManager_GetFontName