- java.lang.Object
-
- com.uddernetworks.newocr.configuration.HOCONFontConfiguration
-
- All Implemented Interfaces:
FontConfiguration
public class HOCONFontConfiguration extends java.lang.Object implements FontConfiguration
Reads a HOCON Configuration file and derives options from it.- Since:
- April 25, 2019
-
-
Constructor Summary
Constructors Constructor Description HOCONFontConfiguration(java.lang.String fileName, ReflectionCacher reflectionCacher, SimilarityManager similarityManager)Creates aHOCONFontConfigurationwith a given file name andReflectionCacher(Which should be global across all instances of this current class)HOCONFontConfiguration(java.lang.String fileName, ReflectionCacher reflectionCacher, SimilarityManager similarityManager, MergenceManager mergenceManager)Creates aHOCONFontConfigurationwith a given file name andReflectionCacher(Which should be global across all instances of this current class).
-
Method Summary
Modifier and Type Method Description voidfetchAndApplyMergeRules(MergenceManager mergenceManager)Fetches the mergence rules' settings from the configuration and applies them to the givenMergenceManager.voidfetchAndApplySimilarities()Fetches the similarities' settings from the configuration and applies them to the givenSimilarityManager.OCROptionsfetchOptions()Generates and returns theOCROptionsfrom the file configuration.java.lang.StringgetFileName()Gets the file name theHOCONFontConfigurationwas generated from.java.lang.StringgetFriendlyName()The friendly version of the font name that should be displayed in messages/options.java.lang.StringgetSystemName()Gets the font name used by the OS to define it.java.util.Optional<java.lang.Class<MergeRule>>loadMergeClass(java.lang.String className)Loads a class that's an instance ofMergeRulefrom the given fully qualified name .
-
-
-
Constructor Detail
-
HOCONFontConfiguration
public HOCONFontConfiguration(java.lang.String fileName, ReflectionCacher reflectionCacher, SimilarityManager similarityManager, MergenceManager mergenceManager)Creates aHOCONFontConfigurationwith a given file name andReflectionCacher(Which should be global across all instances of this current class). This also includes aSimilarityManagerand aMergenceManagerto automatically invoke the methodsFontConfiguration.fetchAndApplySimilarities()andFontConfiguration.fetchAndApplyMergeRules(MergenceManager)in their respective order.- Parameters:
fileName- The name of the filereflectionCacher- TheReflectionCacherto usesimilarityManager- TheSimilarityManagerto usemergenceManager- TheMergenceManagerto invokeFontConfiguration.fetchAndApplyMergeRules(MergenceManager)on
-
HOCONFontConfiguration
public HOCONFontConfiguration(java.lang.String fileName, ReflectionCacher reflectionCacher, SimilarityManager similarityManager)Creates aHOCONFontConfigurationwith a given file name andReflectionCacher(Which should be global across all instances of this current class)- Parameters:
fileName- The name of the filereflectionCacher- TheReflectionCacherto usesimilarityManager- TheSimilarityManagerto use
-
-
Method Detail
-
getFileName
public java.lang.String getFileName()
Description copied from interface:FontConfigurationGets the file name theHOCONFontConfigurationwas generated from.- Specified by:
getFileNamein interfaceFontConfiguration- Returns:
- The file name
-
getFriendlyName
public java.lang.String getFriendlyName()
Description copied from interface:FontConfigurationThe friendly version of the font name that should be displayed in messages/options.- Specified by:
getFriendlyNamein interfaceFontConfiguration- Returns:
- The friendly font name
-
getSystemName
public java.lang.String getSystemName()
Description copied from interface:FontConfigurationGets the font name used by the OS to define it. This shouldn't really be displayed to the user, unless the specific application requires it.- Specified by:
getSystemNamein interfaceFontConfiguration- Returns:
- The font name by the OS
-
fetchOptions
public OCROptions fetchOptions()
Description copied from interface:FontConfigurationGenerates and returns theOCROptionsfrom the file configuration.- Specified by:
fetchOptionsin interfaceFontConfiguration- Returns:
- The
OCROptionsfrom the settings
-
fetchAndApplySimilarities
public void fetchAndApplySimilarities()
Description copied from interface:FontConfigurationFetches the similarities' settings from the configuration and applies them to the givenSimilarityManager. All similarities will be an instance ofBasicSimilarityRule.- Specified by:
fetchAndApplySimilaritiesin interfaceFontConfiguration
-
fetchAndApplyMergeRules
public void fetchAndApplyMergeRules(MergenceManager mergenceManager)
Description copied from interface:FontConfigurationFetches the mergence rules' settings from the configuration and applies them to the givenMergenceManager.- Specified by:
fetchAndApplyMergeRulesin interfaceFontConfiguration- Parameters:
mergenceManager- TheMergenceManagerto apply all mergence rules to.
-
loadMergeClass
public java.util.Optional<java.lang.Class<MergeRule>> loadMergeClass(java.lang.String className)
Description copied from interface:FontConfigurationLoads a class that's an instance ofMergeRulefrom the given fully qualified name .- Specified by:
loadMergeClassin interfaceFontConfiguration- Parameters:
className- The fully qualified name of the class to load- Returns:
- The class, if found
-
-