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:
Note:
PDFont is not Serializable.- Author:
- Philip Helger
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PreloadFontPDF built-in font Courier regularstatic final PreloadFontPDF built-in font Courier boldstatic final PreloadFontPDF built-in font Courier bold and italicstatic final PreloadFontPDF built-in font Courier italicstatic final PreloadFontPDF built-in font Helvetica regularstatic final PreloadFontPDF built-in font Helvetica boldstatic final PreloadFontPDF built-in font Helvetica bold and italicstatic final PreloadFontPDF built-in font Helvetica italicstatic final PreloadFontPDF built-in font Symbolstatic final PreloadFontPDF built-in font Times Roman regularstatic final PreloadFontPDF built-in font Times Roman boldstatic final PreloadFontPDF built-in font Times Roman bold italicstatic final PreloadFontPDF built-in font Times Roman italicstatic final PreloadFontPDF built-in font Zapf Dingbats -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.booleanstatic com.helger.commons.collection.impl.ICommonsOrderedMap<String,org.apache.pdfbox.pdmodel.font.PDType1Font> static com.helger.commons.collection.impl.ICommonsOrderedMap<String,PreloadFont> intgetID()inthashCode()org.apache.pdfbox.pdmodel.font.PDFontloadPDFont(org.apache.pdfbox.pdmodel.PDDocument aDoc) Load thePDFontassociated to this preload font.toString()
-
Field Details
-
REGULAR
PDF built-in font Helvetica regular -
REGULAR_BOLD
PDF built-in font Helvetica bold -
REGULAR_ITALIC
PDF built-in font Helvetica italic -
REGULAR_BOLD_ITALIC
PDF built-in font Helvetica bold and italic -
MONOSPACE
PDF built-in font Courier regular -
MONOSPACE_BOLD
PDF built-in font Courier bold -
MONOSPACE_ITALIC
PDF built-in font Courier italic -
MONOSPACE_BOLD_ITALIC
PDF built-in font Courier bold and italic -
TIMES
PDF built-in font Times Roman regular -
TIMES_BOLD
PDF built-in font Times Roman bold -
TIMES_ITALIC
PDF built-in font Times Roman italic -
TIMES_BOLD_ITALIC
PDF built-in font Times Roman bold italic -
SYMBOL
PDF built-in font Symbol -
ZAPF_DINGBATS
PDF built-in font Zapf Dingbats
-
-
Method Details
-
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 '?'.
-
equals
-
hashCode
public int hashCode() -
toString
-
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
-
getAllStandard14PreloadFonts
@Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsOrderedMap<String,PreloadFont> getAllStandard14PreloadFonts()
-