Class BestMatchingMapper

java.lang.Object
org.docx4j.fonts.Mapper
org.docx4j.fonts.BestMatchingMapper

public class BestMatchingMapper extends Mapper
This mapper uses Panose to guess the physical font which is a closest fit for the font used in the document. It is most likely to be suitable on Linux or OSX systems which don't have Microsoft's fonts installed.
Author:
jharrop
  • Field Details

    • log

      protected static org.slf4j.Logger log
    • MATCH_THRESHOLD

      public static final int MATCH_THRESHOLD
      Max difference for it to be considered an acceptable match. Note that this value will depend on the weights in the difference function.
      See Also:
  • Constructor Details

    • BestMatchingMapper

      public BestMatchingMapper()
  • Method Details

    • getMsFontsFilenames

      public static final Map<String,MicrosoftFonts.Font> getMsFontsFilenames()
    • populateFontMappings

      public void populateFontMappings(Set<String> documentFontNames, Fonts wmlFonts) throws Exception
      Populate the fontMappings object. We make an entry for each of the documentFontNames.
      Specified by:
      populateFontMappings in class Mapper
      Parameters:
      documentFontNames - - the fonts used in the document
      wmlFonts - - the content model for the fonts part
      Throws:
      Exception
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception