Package com.helger.pdflayout.spec
Class LoadedFont
java.lang.Object
com.helger.pdflayout.spec.LoadedFont
This class represents a wrapper around a
PDFont that is uniquely
assigned to a PDDocument.- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionLoadedFont(org.apache.pdfbox.pdmodel.font.PDFont aFont, int nFallbackCodePoint) -
Method Summary
Modifier and TypeMethodDescriptionstatic com.helger.pdflayout.spec.LoadedFont.EncodedCodePointencodeCodepointWithFallback(org.apache.pdfbox.pdmodel.font.PDFont aFont, int nCodepoint, int nFallbackCodepoint) booleanfinal floatgetDescent(float fFontSize) byte[]A quick version to encode the passed text so that it can be written withCOSWriter.writeStringcom.helger.commons.collection.impl.ICommonsList<TextAndWidthSpec>getFitToWidth(String sText, float fFontSize, float fMaxWidth) final org.apache.pdfbox.pdmodel.font.PDFontgetFont()floatgetStringWidth(String sText, float fFontSize) final floatgetTextHeight(float fFontSize) inthashCode()toString()
-
Constructor Details
-
LoadedFont
-
-
Method Details
-
getFont
- Returns:
- The underlying font. Never
null.
-
getDescent
-
getTextHeight
-
encodeCodepointWithFallback
@Nonnull public static com.helger.pdflayout.spec.LoadedFont.EncodedCodePoint encodeCodepointWithFallback(@Nonnull org.apache.pdfbox.pdmodel.font.PDFont aFont, int nCodepoint, int nFallbackCodepoint) throws IOException - Throws:
IOException
-
getStringWidth
@Nonnegative public float getStringWidth(@Nonnull String sText, @Nonnegative float fFontSize) throws IOException - Throws:
IOException
-
getEncodedForPageContentStream
A quick version to encode the passed text so that it can be written withCOSWriter.writeString- Parameters:
sText- Text to be written.- Returns:
- The byte array that can be written with the COSWrite. Never
null. - Throws:
IOException- In case something goes wrong
-
getFitToWidth
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<TextAndWidthSpec> getFitToWidth(@Nullable String sText, @Nonnegative float fFontSize, @Nonnegative float fMaxWidth) throws IOException - Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-