Class DefaultFontProvider

java.lang.Object
com.itextpdf.layout.font.FontProvider
com.itextpdf.styledxmlparser.resolver.font.BasicFontProvider
com.itextpdf.html2pdf.resolver.font.DefaultFontProvider

public class DefaultFontProvider extends com.itextpdf.styledxmlparser.resolver.font.BasicFontProvider
The default BasicFontProvider for pdfHTML, that, as opposed to the font provider in iText's styled-xml-parser, also includes a series of fonts that are shipped with the add-on.
  • Field Summary

    Fields inherited from class com.itextpdf.layout.font.FontProvider

    defaultFontFamily, pdfFonts
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new DefaultFontProvider instance.
    DefaultFontProvider(boolean registerStandardPdfFonts, boolean registerShippedFonts, boolean registerSystemFonts)
    Creates a new DefaultFontProvider instance.
    DefaultFontProvider(boolean registerStandardPdfFonts, boolean registerShippedFonts, boolean registerSystemFonts, String defaultFontFamily)
    Creates a new DefaultFontProvider instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.itextpdf.layout.font.Range
    This method loads a list of noto fonts from pdfCalligraph (if present in the classpath!) into FontProvider.

    Methods inherited from class com.itextpdf.layout.font.FontProvider

    addDirectory, addFont, addFont, addFont, addFont, addFont, addFont, addFont, addFont, addFont, addStandardPdfFonts, addSystemFonts, createFontSelector, createFontSelectorStrategy, getDefaultCacheFlag, getDefaultEmbeddingFlag, getDefaultEncoding, getDefaultFontFamily, getFontSelector, getFontSelector, getFontSet, getPdfFont, getPdfFont, getStrategy, getStrategy, getStrategy, reset, setFontSelectorStrategyFactory

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultFontProvider

      public DefaultFontProvider()
      Creates a new DefaultFontProvider instance.
    • DefaultFontProvider

      public DefaultFontProvider (boolean registerStandardPdfFonts, boolean registerShippedFonts, boolean registerSystemFonts)
      Creates a new DefaultFontProvider instance.
      Parameters:
      registerStandardPdfFonts - use true if you want to register the standard Type 1 fonts (can't be embedded)
      registerShippedFonts - use true if you want to register the shipped fonts (can be embedded)
      registerSystemFonts - use true if you want to register the system fonts (can require quite some resources)
    • DefaultFontProvider

      public DefaultFontProvider (boolean registerStandardPdfFonts, boolean registerShippedFonts, boolean registerSystemFonts, String defaultFontFamily)
      Creates a new DefaultFontProvider instance.
      Parameters:
      registerStandardPdfFonts - use true if you want to register the standard Type 1 fonts (can't be embedded)
      registerShippedFonts - use true if you want to register the shipped fonts (can be embedded)
      registerSystemFonts - use true if you want to register the system fonts (can require quite some resources)
      defaultFontFamily - default font family
  • Method Details

    • addCalligraphFonts

      protected com.itextpdf.layout.font.Range addCalligraphFonts()
      This method loads a list of noto fonts from pdfCalligraph (if present in the classpath!) into FontProvider. The list is the following (each font is represented in regular and bold types): NotoSansArabic, NotoSansGurmukhi, NotoSansOriya, NotoSerifBengali, NotoSerifDevanagari, NotoSerifGujarati, NotoSerifHebrew, NotoSerifKannada, NotoSerifKhmer, NotoSerifMalayalam, NotoSerifTamil, NotoSerifTelugu, NotoSerifThai. If it's needed to have a DefaultFontProvider without typography fonts loaded, create an extension of DefaultFontProvider and override this method so it does nothing and only returns null.
      Returns:
      a unicode Range that excludes the loaded from pdfCalligraph fonts, i.e. the unicode range that is to be rendered with any other font contained in this FontProvider