Class FontInfoFinder


  • public class FontInfoFinder
    extends java.lang.Object
    Attempts to determine correct FontInfo
    • Field Detail

      • log

        private final org.apache.commons.logging.Log log
        logging instance
      • quotePattern

        private final java.util.regex.Pattern quotePattern
    • Constructor Detail

      • FontInfoFinder

        public FontInfoFinder()
    • Method Detail

      • setEventListener

        public void setEventListener​(FontEventListener listener)
        Sets the font event listener that can be used to receive events about particular events in this class.
        Parameters:
        listener - the font event listener
      • generateTripletsFromFont

        private void generateTripletsFromFont​(CustomFont customFont,
                                              java.util.Collection<FontTriplet> triplets)
        Attempts to determine FontTriplets from a given CustomFont. It seems to be fairly accurate but will probably require some tweaking over time
        Parameters:
        customFont - CustomFont
        triplets - Collection that will take the generated triplets
      • stripQuotes

        private java.lang.String stripQuotes​(java.lang.String name)
      • guessStyle

        private java.lang.String guessStyle​(CustomFont customFont,
                                            java.lang.String fontName)
      • getFontInfoFromCustomFont

        private EmbedFontInfo getFontInfoFromCustomFont​(java.net.URI fontUri,
                                                        CustomFont customFont,
                                                        FontCache fontCache,
                                                        InternalResourceResolver resourceResolver)
        Attempts to determine FontInfo from a given custom font
        Parameters:
        fontUri - the font URI
        customFont - the custom font
        fontCache - font cache (may be null)
        Returns:
        FontInfo from the given custom font
      • find

        public EmbedFontInfo[] find​(java.net.URI fontURI,
                                    InternalResourceResolver resourceResolver,
                                    FontCache fontCache)
        Attempts to determine EmbedFontInfo from a given font file.
        Parameters:
        fontURI - the URI of the font resource
        resourceResolver - font resolver used to resolve font
        fontCache - font cache (may be null)
        Returns:
        an array of newly created embed font info. Generally, this array will have only one entry, unless the fontUrl is a TrueType Collection