org.foray.pdf.object
Class PDFFont

java.lang.Object
  extended by org.foray.pdf.object.PDFObject
      extended by org.foray.pdf.object.PDFFont
All Implemented Interfaces:
org.axsl.pdf.PdfFont
Direct Known Subclasses:
PDFFontType0

public class PDFFont
extends PDFObject
implements org.axsl.pdf.PdfFont

A /Font object in PDF. This class wraps an instance of FontPdf (a font from the font system), providing additional services to the PDF processor. Fonts are specified on page 198 and onwards of the PDF 1.3 spec.


Nested Class Summary
static class PDFFont.SubType
          Enumeration of the various font subtypes possible in a PDF document.
 
Field Summary
 
Fields inherited from class org.foray.pdf.object.PDFObject
EOL, MSG_EOL, XREF_EOL
 
Constructor Summary
PDFFont(PDFDocument doc, org.axsl.font.output.FontPdf fsFont)
          Create the /Font object.
 
Method Summary
 String getBaseFont()
          Return the PostScript name for this font.
protected  PDFCIDFont getDescendantFonts()
          Returns the descendant fonts.
 PDFFontDescriptor getDescriptor()
          Returs the font descriptor for this font.
 org.axsl.font.output.FontPdf getFont()
          Return the underlying font instance.
 PDFFont.SubType getFontSubtype()
          Returns the subtype for this font.
static PDFFont.SubType getFontSubtype(org.axsl.font.output.FontPdf font)
          Return the font subtype.
 org.axsl.font.FontUse getFsFont()
          Return the font-system font wrapped by this PDF font.
 String getName()
           
protected  PDFToUnicodeCMap getToUnicodeCMAP()
          Returns the ToUnicode CMap for this font.
static PDFFont makeFont(PDFDocument pdfDoc, org.axsl.font.output.FontPdf fsFont)
          Create a PDFFont with the next object number and add it to the list of objects.
 String toPDF()
          Generates the PDF text necessary to represent the object, returning it as a String.
protected  void writeFirstChar(StringBuilder buffer)
          Write the /FirstChar component of the font entry.
protected  void writeFontDescriptor(StringBuilder buffer)
          Write the /FontDescriptor component of the font entry.
protected  void writeLastChar(StringBuilder buffer)
          Write the /LastChar component of the font entry.
protected  void writeWidths(StringBuilder buffer)
          Write the /Widths component of the font entry.
 
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

PDFFont

public PDFFont(PDFDocument doc,
               org.axsl.font.output.FontPdf fsFont)
Create the /Font object.

Parameters:
doc - The parent PDF document.
fsFont - The FreeStandingFont which is the basis for this PDF Font.
Method Detail

makeFont

public static PDFFont makeFont(PDFDocument pdfDoc,
                               org.axsl.font.output.FontPdf fsFont)
Create a PDFFont with the next object number and add it to the list of objects.

Parameters:
pdfDoc - The parent PDF document.
fsFont - The FreeStandingFont to be added
Returns:
the created /Font object

getName

public String getName()
Specified by:
getName in interface org.axsl.pdf.PdfFont

getBaseFont

public String getBaseFont()
Return the PostScript name for this font.

Returns:
The PostScript name for this 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.

writeFirstChar

protected void writeFirstChar(StringBuilder buffer)
Write the /FirstChar component of the font entry.

Parameters:
buffer - The buffer into which the component should be written.

writeLastChar

protected void writeLastChar(StringBuilder buffer)
Write the /LastChar component of the font entry.

Parameters:
buffer - The buffer into which the component should be written.

writeWidths

protected void writeWidths(StringBuilder buffer)
Write the /Widths component of the font entry.

Parameters:
buffer - The buffer into which the component should be written.

writeFontDescriptor

protected void writeFontDescriptor(StringBuilder buffer)
Write the /FontDescriptor component of the font entry.

Parameters:
buffer - The buffer into which the component should be written.

getToUnicodeCMAP

protected PDFToUnicodeCMap getToUnicodeCMAP()
Returns the ToUnicode CMap for this font.

Returns:
The ToUnicode CMap for this font.

getDescendantFonts

protected PDFCIDFont getDescendantFonts()
Returns the descendant fonts.

Returns:
The descendant fonts.

getFontSubtype

public static PDFFont.SubType getFontSubtype(org.axsl.font.output.FontPdf font)
Return the font subtype.

Parameters:
font - The Font whose PDF subtype is needed.
Returns:
The font subtype.

getFontSubtype

public PDFFont.SubType getFontSubtype()
Returns the subtype for this font.

Returns:
The subtype for this font.

getFsFont

public org.axsl.font.FontUse getFsFont()
Return the font-system font wrapped by this PDF font.

Returns:
Returns the font-system font.

getFont

public org.axsl.font.output.FontPdf getFont()
Return the underlying font instance.

Specified by:
getFont in interface org.axsl.pdf.PdfFont
Returns:
The underlying font instance.

getDescriptor

public PDFFontDescriptor getDescriptor()
Returs the font descriptor for this font.

Returns:
Returns the descriptor.


Copyright © 2017. All rights reserved.