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:
      Constant Field Values
  • Constructor Details

    • BestMatchingMapper

      public BestMatchingMapper()
  • Method Details

    • getMsFontsFilenames

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

      public void populateFontMappings​(java.util.Set<java.lang.String> documentFontNames, Fonts wmlFonts) throws java.lang.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:
      java.lang.Exception
    • main

      public static void main​(java.lang.String[] args) throws java.lang.Exception
      Throws:
      java.lang.Exception