Class PdfBoxGraphics2DFontTextDrawerDefaultFonts

    • Constructor Detail

      • PdfBoxGraphics2DFontTextDrawerDefaultFonts

        public PdfBoxGraphics2DFontTextDrawerDefaultFonts()
    • Method Detail

      • mapFont

        protected org.apache.pdfbox.pdmodel.font.PDFont mapFont​(java.awt.Font font,
                                                                IPdfBoxGraphics2DFontTextDrawer.IFontTextDrawerEnv env)
                                                         throws java.io.IOException,
                                                                java.awt.FontFormatException
        Description copied from class: PdfBoxGraphics2DFontTextDrawer
        Try to map the java.awt.Font to a PDFont.
        Overrides:
        mapFont in class PdfBoxGraphics2DFontTextDrawer
        Parameters:
        font - the java.awt.Font for which a mapping should be found
        env - environment of the font mapper
        Returns:
        the PDFont or null if none can be found.
        Throws:
        java.io.IOException - when the font can not be loaded
        java.awt.FontFormatException - when the font file can not be loaded
      • mapDefaultFonts

        public static org.apache.pdfbox.pdmodel.font.PDFont mapDefaultFonts​(java.awt.Font font)
        Find a PDFont for the given font object, which does not need to be embedded.
        Parameters:
        font - font for which to find a suitable default font
        Returns:
        null if no default font is found or a default font which does not need to be embedded.
      • fontNameEqualsAnyOf

        private static boolean fontNameEqualsAnyOf​(java.awt.Font font,
                                                   java.lang.String... names)
      • chooseMatchingTimes

        public static org.apache.pdfbox.pdmodel.font.PDFont chooseMatchingTimes​(java.awt.Font font)
        Get a PDType1Font.TIMES-variant, which matches the given font
        Parameters:
        font - Font to get the styles from
        Returns:
        a PDFont Times variant which matches the style in the given Font object.
      • chooseMatchingCourier

        public static org.apache.pdfbox.pdmodel.font.PDFont chooseMatchingCourier​(java.awt.Font font)
        Get a PDType1Font.COURIER-variant, which matches the given font
        Parameters:
        font - Font to get the styles from
        Returns:
        a PDFont Courier variant which matches the style in the given Font object.
      • chooseMatchingHelvetica

        public static org.apache.pdfbox.pdmodel.font.PDFont chooseMatchingHelvetica​(java.awt.Font font)
        Get a PDType1Font.HELVETICA-variant, which matches the given font
        Parameters:
        font - Font to get the styles from
        Returns:
        a PDFont Helvetica variant which matches the style in the given Font object.