Class PDFFont
java.lang.Object
org.apache.fop.pdf.PDFObject
org.apache.fop.pdf.PDFDictionary
org.apache.fop.pdf.PDFFont
- All Implemented Interfaces:
CompressedObject, PDFWritable
- Direct Known Subclasses:
PDFFontNonBase14, PDFFontType0
Class representing a /Font object.
A more complete object expressing the base font name and encoding of a font along with an internal name for the font used within streams of content.
Fonts are specified on page 198 and onwards of the PDF 1.3 spec.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringInternal F-number for each font (it is not written to the font dict)Fields inherited from class PDFDictionary
entries, order -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PDFFontcreateFont(String fontname, FontType subtype, String basefont, Object encoding) factory method with the basic parametersReturns the name of the BaseFont.getName()Get the internal name used for this font.protected PDFNamegetPDFNameForFontType(FontType fontType) Returns the PDF name for a certain font type.intoutput(OutputStream stream) Write the PDF represention of this objectvoidsetEncoding(String encoding) Sets the Encoding value of the font.voidsetEncoding(PDFEncoding encoding) Sets the Encoding value of the font.voidsetToUnicode(PDFCMap cmap) Sets a ToUnicode CMap.protected voidvalidate()Validates the PDF object prior to serialization.Methods inherited from class PDFDictionary
containsKey, get, getChildren, getChildren, keySet, put, put, remove, writeDictionaryMethods inherited from class PDFObject
contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent, supportsObjectStream, toPDF, toPDFString
-
Field Details
-
fontname
Internal F-number for each font (it is not written to the font dict)
-
-
Constructor Details
-
PDFFont
-
-
Method Details
-
setEncoding
Sets the Encoding value of the font.- Parameters:
encoding- the encoding
-
setEncoding
Sets the Encoding value of the font.- Parameters:
encoding- the encoding
-
setToUnicode
Sets a ToUnicode CMap.- Parameters:
cmap- the ToUnicode character map
-
createFont
public static PDFFont createFont(String fontname, FontType subtype, String basefont, Object encoding) factory method with the basic parameters- Parameters:
fontname- the internal name for the fontsubtype- the font's subtypebasefont- the base font nameencoding- the character encoding schema used by the font- Returns:
- the generated PDFFont object
-
getName
-
getBaseFont
-
getPDFNameForFontType
-
validate
protected void validate()Validates the PDF object prior to serialization. -
output
Write the PDF represention of this object- Specified by:
outputin interfaceCompressedObject- Overrides:
outputin classPDFDictionary- Parameters:
stream- the stream to write the PDF to- Returns:
- the number of bytes written
- Throws:
IOException- if there is an error writing to the stream
-