Top Description Constructors Methods
de.rototor.pdfbox.graphics2d

public Class PdfBoxGraphics2DFontTextDrawerDefaultFonts

extends PdfBoxGraphics2DFontTextDrawer
Class Inheritance
Known Direct Subclasses
de.rototor.pdfbox.graphics2d.PdfBoxGraphics2DFontTextForcedDrawer
Imports
org.apache.pdfbox.pdmodel.font.PDFont, .PDType1Font, java.awt.*, java.io.IOException

Like PdfBoxGraphics2DFontTextDrawer, but tries to use default fonts whenever possible. Default fonts are not embedded. You can register additional font files. If no font mapping is found, Helvetica is used. This will fallback to vectorized text if any kind of RTL text is rendered and/or any other not supported feature is used.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static PDFont

Returns:

a PDFont Courier variant which matches the style in the given Font object.
chooseMatchingCourier
(Font
Font to get the styles from
font
)

Get a PDType1Font.COURIER-variant, which matches the given font

public static PDFont

Returns:

a PDFont Helvetica variant which matches the style in the given Font object.
chooseMatchingHelvetica
(Font
Font to get the styles from
font
)

Get a PDType1Font.HELVETICA-variant, which matches the given font

public static PDFont

Returns:

a PDFont Times variant which matches the style in the given Font object.
chooseMatchingTimes
(Font
Font to get the styles from
font
)

Get a PDType1Font.TIMES-variant, which matches the given font

private static boolean
public static PDFont

Returns:

null if no default font is found or a default font which does not need to be embedded.
mapDefaultFonts
(Font
font for which to find a suitable default font
font
)

Find a PDFont for the given font object, which does not need to be embedded.

protected PDFont
mapFont(Font
the java.awt.Font for which a mapping should be found
font
,
IPdfBoxGraphics2DFontTextDrawer.IFontTextDrawerEnv
environment of the font mapper
env
)

Overrides de.rototor.pdfbox.graphics2d.PdfBoxGraphics2DFontTextDrawer.mapFont.

Try to map the java.awt.Font to a PDFont.

Inherited from de.rototor.pdfbox.graphics2d.PdfBoxGraphics2DFontTextDrawer:
canDrawTextclosedrawTextgetFontMetricshasDynamicFontMappingregisterFontregisterFontregisterFontregisterFontregisterFont

Constructor Detail

PdfBoxGraphics2DFontTextDrawerDefaultFontsback to summary
public PdfBoxGraphics2DFontTextDrawerDefaultFonts()

Method Detail

chooseMatchingCourierback to summary
public static PDFont chooseMatchingCourier(Font font)

Get a PDType1Font.COURIER-variant, which matches the given font

Parameters
font:Font

Font to get the styles from

Returns:PDFont

a PDFont Courier variant which matches the style in the given Font object.

chooseMatchingHelveticaback to summary
public static PDFont chooseMatchingHelvetica(Font font)

Get a PDType1Font.HELVETICA-variant, which matches the given font

Parameters
font:Font

Font to get the styles from

Returns:PDFont

a PDFont Helvetica variant which matches the style in the given Font object.

chooseMatchingTimesback to summary
public static PDFont chooseMatchingTimes(Font font)

Get a PDType1Font.TIMES-variant, which matches the given font

Parameters
font:Font

Font to get the styles from

Returns:PDFont

a PDFont Times variant which matches the style in the given Font object.

fontNameEqualsAnyOfback to summary
private static boolean fontNameEqualsAnyOf(Font font, String... names)
mapDefaultFontsback to summary
public static PDFont mapDefaultFonts(Font font)

Find a PDFont for the given font object, which does not need to be embedded.

Parameters
font:Font

font for which to find a suitable default font

Returns:PDFont

null if no default font is found or a default font which does not need to be embedded.

mapFontback to summary
protected PDFont mapFont(Font font, IPdfBoxGraphics2DFontTextDrawer.IFontTextDrawerEnv env) throws IOException, FontFormatException

Overrides de.rototor.pdfbox.graphics2d.PdfBoxGraphics2DFontTextDrawer.mapFont.

Doc from de.rototor.pdfbox.graphics2d.PdfBoxGraphics2DFontTextDrawer.mapFont.

Try to map the java.awt.Font to a PDFont.

Parameters
font:Font

the java.awt.Font for which a mapping should be found

env:IPdfBoxGraphics2DFontTextDrawer.IFontTextDrawerEnv

environment of the font mapper

Returns:PDFont

the PDFont or null if none can be found.

Annotations
@Override
Exceptions
IOException:
when the font can not be loaded
FontFormatException:
when the font file can not be loaded