org.foray.pdf.object
Class PDFFontDescriptor

java.lang.Object
  extended by org.foray.pdf.object.PDFObject
      extended by org.foray.pdf.object.PDFFontDescriptor
Direct Known Subclasses:
PDFCIDFontDescriptor

public class PDFFontDescriptor
extends PDFObject

Class representing a PDF Font Descriptor. Font descriptors are specified in Section 5.7 of the PDF 1.3 spec.


Field Summary
 
Fields inherited from class org.foray.pdf.object.PDFObject
EOL, MSG_EOL, XREF_EOL
 
Constructor Summary
PDFFontDescriptor(PDFDocument doc, PDFFont font)
          Constructor for the /FontDescriptor object.
 
Method Summary
protected  void embedFont()
          Sets this font up so that it will be embedded in the PDF document.
protected  void fillInPDF(StringBuilder begin)
          Fill in the specifics for the font's descriptor.
static PDFFontDescriptor makeFontDescriptor(PDFDocument pdfDoc, PDFFont font)
          Factory method to create an appropriate font descriptor.
 void setFontFile(PDFFont.SubType subtype, PDFFontFileStream fontfile)
          Set the optional font file stream.
 void setMetrics(int avgWidth, int maxWidth, int missingWidth, int leading, int stemH, int xHeight)
          Set the optional metrics.
 String toPDF()
          Generates the PDF text necessary to represent the object, returning it as a String.
 
Methods inherited from class org.foray.pdf.object.PDFObject
bufferToByteArray, byteArrayToStream, getCharsPerLine, getGeneration, getLogger, getNumber, getPDFDocument, output, pdfID, pdfReference, setNumber, stringToByteArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFFontDescriptor

public PDFFontDescriptor(PDFDocument doc,
                         PDFFont font)
Constructor for the /FontDescriptor object.

Parameters:
doc - The parent PDFDocument.
font - The PDF Font which this descriptor describes.
Method Detail

makeFontDescriptor

public static PDFFontDescriptor makeFontDescriptor(PDFDocument pdfDoc,
                                                   PDFFont font)
Factory method to create an appropriate font descriptor.

Parameters:
pdfDoc - The parent PDF document.
font - The font to be encapsulated.
Returns:
The newly-created font descriptor.

setMetrics

public void setMetrics(int avgWidth,
                       int maxWidth,
                       int missingWidth,
                       int leading,
                       int stemH,
                       int xHeight)
Set the optional metrics.

Parameters:
avgWidth - The average width of glyphs in the font, in millipoints.
maxWidth - The maximum width of glyphs in the font, in millipoints.
missingWidth - The default width of glypys in the font, in millipoints.
leading - The leading for this font, in millipoints.
stemH - The horizontal stem weight for this font.
xHeight - The x-height of this font, in millipoints.

setFontFile

public void setFontFile(PDFFont.SubType subtype,
                        PDFFontFileStream fontfile)
Set the optional font file stream.

Parameters:
subtype - The font type defined in the font stream
fontfile - The stream containing an embedded font

toPDF

public String toPDF()
Description copied from class: PDFObject
Generates the PDF text necessary to represent the object, returning it as a String.

Returns:
The PDF text necessary to represent the object.

fillInPDF

protected void fillInPDF(StringBuilder begin)
Fill in the specifics for the font's descriptor. The given buffer already contains the fields common to all descriptors.

Parameters:
begin - The buffer to be completed with the specific fields

embedFont

protected void embedFont()
Sets this font up so that it will be embedded in the PDF document.



Copyright © 2017. All rights reserved.