org.pz.platypus.plugin.html
Class HtmlFont

java.lang.Object
  extended by org.pz.platypus.plugin.html.HtmlFont

public class HtmlFont
extends java.lang.Object

Handles fonts for the PDF plugin

Author:
alb

Field Summary
private  boolean bold
          is font bold?
private  GDD gdd
           
private  boolean italics
          is fond italic?
private  com.lowagie.text.Font iTfont
          the iText font
private  HtmlData pdfData
           
private  float size
          font size
private  Source source
          file and line number of last change
private  java.lang.String typeface
          the font typeface in the form of a string used by iText
 
Constructor Summary
HtmlFont(HtmlData pdfData)
           
 
Method Summary
(package private)  int computeItextStyle()
          iText font style captures bold, italic, strikethru, underline.
(package private)  com.lowagie.text.Font createFont(HtmlFont f)
          Creates an iText Font object based on the class fields
(package private)  java.lang.String createItextFontName(HtmlFont f)
          Get the name by which iText refers to this font.
 java.lang.String getFace()
           
 com.lowagie.text.Font getItextFont()
          Get the iText font
 float getSize()
           
 Source getSource()
           
(package private)  boolean isBase14Font(java.lang.String fontName)
          Determines whehter the current font is one of the Base14 Acrobat fonts, built into every PDF reader.
 void setBold(boolean onOff, Source newSource)
          set bold on/off and re-create the iText font to record the change.
 void setFace(java.lang.String newFace, Source newSource)
           
 void setItalics(boolean onOff, Source newSource)
          set italics on/off and re-create the iText font to record the change.
 void setSize(float newSize, Source newSource)
           
 void setToDefault()
          Initializes all PdfFont fields to defaults, and sets line number to 0
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iTfont

private com.lowagie.text.Font iTfont
the iText font


typeface

private java.lang.String typeface
the font typeface in the form of a string used by iText


size

private float size
font size


bold

private boolean bold
is font bold?


italics

private boolean italics
is fond italic?


source

private Source source
file and line number of last change


gdd

private GDD gdd

pdfData

private HtmlData pdfData
Constructor Detail

HtmlFont

HtmlFont(HtmlData pdfData)
Method Detail

setToDefault

public void setToDefault()
Initializes all PdfFont fields to defaults, and sets line number to 0


createFont

com.lowagie.text.Font createFont(HtmlFont f)
Creates an iText Font object based on the class fields

Parameters:
f - the PdfFont containing the parameters for the font
Returns:
the iText Font object

isBase14Font

boolean isBase14Font(java.lang.String fontName)
Determines whehter the current font is one of the Base14 Acrobat fonts, built into every PDF reader. These fonts require special hanldling, and so this routine helps identify them, based on their font face name.

Parameters:
fontName - name of the font face
Returns:
true if it's a base14 font name, false otherwise.

createItextFontName

java.lang.String createItextFontName(HtmlFont f)
Get the name by which iText refers to this font. This routine is mostly occupied with the special handling of the base14 fonts. For all other fonts, this routine simply returns its existing name.

Parameters:
f - PdfFont whose iText name we're getting
Returns:
a string containing the iText usable name for this font.

computeItextStyle

int computeItextStyle()
iText font style captures bold, italic, strikethru, underline. Since we handle strikethrough and underline ourselves, we use it to communicate italic and bold only. This computation done here.

Returns:
the iText Style

getItextFont

public com.lowagie.text.Font getItextFont()
Get the iText font

Returns:
the iText font

getFace

public java.lang.String getFace()

getSize

public float getSize()

getSource

public Source getSource()

setBold

public void setBold(boolean onOff,
                    Source newSource)
set bold on/off and re-create the iText font to record the change.

Parameters:
onOff - the new value for the italics setting
newSource - the file and line # of the token that changed italics

setItalics

public void setItalics(boolean onOff,
                       Source newSource)
set italics on/off and re-create the iText font to record the change.

Parameters:
onOff - the new value for the italics setting
newSource - the file and line # of the token that changed italics

setSize

public void setSize(float newSize,
                    Source newSource)

setFace

public void setFace(java.lang.String newFace,
                    Source newSource)


Copyright © 2008-10 Pacific Data Works LLC