Package com.helger.pdflayout.spec
Class PreloadFont
- java.lang.Object
-
- com.helger.pdflayout.spec.PreloadFont
-
- All Implemented Interfaces:
com.helger.commons.id.IHasID<String>,Serializable
@NotThreadSafe public final class PreloadFont extends Object implements com.helger.commons.id.IHasID<String>, Serializable
Represents an abstract font that is potentially not yet loaded and can be used in multiple documents.
Note:PDFontis not Serializable.- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static PreloadFontMONOSPACEPDF built-in font Courier regularstatic PreloadFontMONOSPACE_BOLDPDF built-in font Courier boldstatic PreloadFontMONOSPACE_BOLD_ITALICPDF built-in font Courier bold and italicstatic PreloadFontMONOSPACE_ITALICPDF built-in font Courier italicstatic PreloadFontREGULARPDF built-in font Helvetica regularstatic PreloadFontREGULAR_BOLDPDF built-in font Helvetica boldstatic PreloadFontREGULAR_BOLD_ITALICPDF built-in font Helvetica bold and italicstatic PreloadFontREGULAR_ITALICPDF built-in font Helvetica italicstatic PreloadFontSYMBOLPDF built-in font Symbolstatic PreloadFontTIMESPDF built-in font Times Roman regularstatic PreloadFontTIMES_BOLDPDF built-in font Times Roman boldstatic PreloadFontTIMES_BOLD_ITALICPDF built-in font Times Roman bold italicstatic PreloadFontTIMES_ITALICPDF built-in font Times Roman italicstatic PreloadFontZAPF_DINGBATSPDF built-in font Zapf Dingbats
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PreloadFontcreateEmbedding(com.helger.font.api.IFontResource aFontRes)Create a newPreloadFontfrom an existingIFontResourcewhere the subset can be embedded into the resulting PDF.static PreloadFontcreateNonEmbedding(com.helger.font.api.IFontResource aFontRes)Create a newPreloadFontfrom an existingIFontResourcewhere the subset cannot be embedded into the resulting PDF.booleanequals(Object o)static com.helger.commons.collection.impl.ICommonsOrderedMap<String,org.apache.pdfbox.pdmodel.font.PDType1Font>getAllStandard14Fonts()static com.helger.commons.collection.impl.ICommonsOrderedMap<String,PreloadFont>getAllStandard14PreloadFonts()intgetFallbackCodePoint()StringgetID()inthashCode()org.apache.pdfbox.pdmodel.font.PDFontloadPDFont(org.apache.pdfbox.pdmodel.PDDocument aDoc)Load thePDFontassociated to this preload font.StringtoString()
-
-
-
Field Detail
-
REGULAR
public static final PreloadFont REGULAR
PDF built-in font Helvetica regular
-
REGULAR_BOLD
public static final PreloadFont REGULAR_BOLD
PDF built-in font Helvetica bold
-
REGULAR_ITALIC
public static final PreloadFont REGULAR_ITALIC
PDF built-in font Helvetica italic
-
REGULAR_BOLD_ITALIC
public static final PreloadFont REGULAR_BOLD_ITALIC
PDF built-in font Helvetica bold and italic
-
MONOSPACE
public static final PreloadFont MONOSPACE
PDF built-in font Courier regular
-
MONOSPACE_BOLD
public static final PreloadFont MONOSPACE_BOLD
PDF built-in font Courier bold
-
MONOSPACE_ITALIC
public static final PreloadFont MONOSPACE_ITALIC
PDF built-in font Courier italic
-
MONOSPACE_BOLD_ITALIC
public static final PreloadFont MONOSPACE_BOLD_ITALIC
PDF built-in font Courier bold and italic
-
TIMES
public static final PreloadFont TIMES
PDF built-in font Times Roman regular
-
TIMES_BOLD
public static final PreloadFont TIMES_BOLD
PDF built-in font Times Roman bold
-
TIMES_ITALIC
public static final PreloadFont TIMES_ITALIC
PDF built-in font Times Roman italic
-
TIMES_BOLD_ITALIC
public static final PreloadFont TIMES_BOLD_ITALIC
PDF built-in font Times Roman bold italic
-
SYMBOL
public static final PreloadFont SYMBOL
PDF built-in font Symbol
-
ZAPF_DINGBATS
public static final PreloadFont ZAPF_DINGBATS
PDF built-in font Zapf Dingbats
-
-
Method Detail
-
getID
@Nonnull @Nonempty public String getID()
- Specified by:
getIDin interfacecom.helger.commons.id.IHasID<String>
-
loadPDFont
@Nonnull public org.apache.pdfbox.pdmodel.font.PDFont loadPDFont(@Nonnull org.apache.pdfbox.pdmodel.PDDocument aDoc) throws IOException
Load thePDFontassociated to this preload font. This class uses no caching!- Parameters:
aDoc- ThePDDocumentto which the font should be attached to. May not benull.- Returns:
- The loaded font.
- Throws:
IOException- In case loading the external file fails
-
getFallbackCodePoint
public int getFallbackCodePoint()
- Returns:
- The fallback code point to be used if a character is not contained in the font. Defaults to '?'.
-
createNonEmbedding
@Nonnull public static PreloadFont createNonEmbedding(@Nonnull com.helger.font.api.IFontResource aFontRes)
Create a newPreloadFontfrom an existingIFontResourcewhere the subset cannot be embedded into the resulting PDF.- Parameters:
aFontRes- The font resource to include. May not benull.- Returns:
- Never
null. - Throws:
IllegalArgumentException- If the font could not be loaded.
-
createEmbedding
@Nonnull public static PreloadFont createEmbedding(@Nonnull com.helger.font.api.IFontResource aFontRes)
Create a newPreloadFontfrom an existingIFontResourcewhere the subset can be embedded into the resulting PDF.- Parameters:
aFontRes- The font resource to include. May not benull.- Returns:
- Never
null. - Throws:
IllegalArgumentException- If the font could not be loaded.
-
getAllStandard14Fonts
@Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsOrderedMap<String,org.apache.pdfbox.pdmodel.font.PDType1Font> getAllStandard14Fonts()
-
getAllStandard14PreloadFonts
@Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsOrderedMap<String,PreloadFont> getAllStandard14PreloadFonts()
-
-