org.faceless.pdf2
Class StandardFont

java.lang.Object
  extended byorg.faceless.pdf2.PDFObject
      extended byorg.faceless.pdf2.PDFMap
          extended byorg.faceless.pdf2.PDFFont
              extended byorg.faceless.pdf2.StandardFont
All Implemented Interfaces:
Cloneable

public final class StandardFont
extends PDFFont

A concrete subclass of PDFFont representing the standard 14 fonts guaranteed to exist in all PDF readers.

Since:
1.0

Field Summary
static int COURIER
          Represents the "Courier" font
static int COURIERBOLD
          Represents the "Courier-Bold" font
static int COURIERBOLDOBLIQUE
          Represents the "Courier-BoldOblique" font
static int COURIEROBLIQUE
          Represents the "Courier-Oblique" font
static int HELVETICA
          Represents the "Helvetica" font
static int HELVETICABOLD
          Represents the "Helvetica-Bold" font
static int HELVETICABOLDOBLIQUE
          Represents the "Helvetica-BoldOblique" font
static int HELVETICAOBLIQUE
          Represents the "Helvetica-Oblique" font
static int SYMBOL
          Represents the "Symbol" font
static int TIMES
          Represents the "Times-Roman" font
static int TIMESBOLD
          Represents the "Times-Bold" font
static int TIMESBOLDITALIC
          Represents the "Times-BoldItalic" font
static int TIMESITALIC
          Represents the "Times-Italic" font
static int ZAPFDINGBATS
          Represents the "ZapfDingbats" font.
 
Constructor Summary
StandardFont(int type)
          Create a new font of the specified type.
 
Method Summary
 float getAscender()
          Get the Ascender for the font (the maximum height above the baseline the font extends), as a proportion of the point size.
 float getDefaultLeading()
           Get the default leading for this font - the preferred distance between two successive baselines of text.
 float getDescender()
          Get the Descender for the font (the maximum height below the baseline the font extends), as a proportion of the point size.
 int getKerning(int i1, int i2)
          Get the horizontal character-to-character (or "pair-wise") kerning in this font for the specified characters, in millipoints.
 float getStrikeoutPosition()
          Get the strikeout position, as a proportion of the font size.
 float getStrikeoutThickness()
          Get the strikeout thickness, as a proportion of the font size.
 float getSubscriptPosition()
           Get the recommended position of a sub-script version of this font, as a proportion of the sub-scripted font size.
 float getSubscriptSize()
           Get the recommended size of a super/sub script version of this font, as a proportion of the normal font size.
 float getSuperscriptPosition()
           Get the recommended position of a super-script version of this font, as a proportion of the sub-scripted font size.
 float getUnderlinePosition()
          Get the underline position, as a proportion of the font size.
 float getUnderlineThickness()
          Get the underline thickness, as a proportion of the font size.
 int hashCode()
           
 boolean isMonospace()
          Return true if every character has the same width (like Courier), false if every character is potentially a different width (like Times-Roman)
 PDFFont versionBold()
          Return a bold version of this font if it exists, or the current font if it doesn't.
 PDFFont versionItalic()
          Return an italic version of this font if it exists, or the current font if it doesn't.
 PDFFont versionRegular()
          Return a regular (non-bold, non-italic) version of this font if it exists, or the current font if it doesn't.
 
Methods inherited from class org.faceless.pdf2.PDFFont
equals, getBaseName, getBottom, getCharWidth, getCharWidth, getKerning, getLeft, getRight, getTop, isDefined, isDefined, isHorizontal, ligaturize, ligaturize, requote, requote, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TIMES

public static final int TIMES
Represents the "Times-Roman" font

See Also:
Constant Field Values

TIMESBOLD

public static final int TIMESBOLD
Represents the "Times-Bold" font

See Also:
Constant Field Values

TIMESITALIC

public static final int TIMESITALIC
Represents the "Times-Italic" font

See Also:
Constant Field Values

TIMESBOLDITALIC

public static final int TIMESBOLDITALIC
Represents the "Times-BoldItalic" font

See Also:
Constant Field Values

HELVETICA

public static final int HELVETICA
Represents the "Helvetica" font

See Also:
Constant Field Values

HELVETICABOLD

public static final int HELVETICABOLD
Represents the "Helvetica-Bold" font

See Also:
Constant Field Values

HELVETICAOBLIQUE

public static final int HELVETICAOBLIQUE
Represents the "Helvetica-Oblique" font

See Also:
Constant Field Values

HELVETICABOLDOBLIQUE

public static final int HELVETICABOLDOBLIQUE
Represents the "Helvetica-BoldOblique" font

See Also:
Constant Field Values

COURIER

public static final int COURIER
Represents the "Courier" font

See Also:
Constant Field Values

COURIERBOLD

public static final int COURIERBOLD
Represents the "Courier-Bold" font

See Also:
Constant Field Values

COURIEROBLIQUE

public static final int COURIEROBLIQUE
Represents the "Courier-Oblique" font

See Also:
Constant Field Values

COURIERBOLDOBLIQUE

public static final int COURIERBOLDOBLIQUE
Represents the "Courier-BoldOblique" font

See Also:
Constant Field Values

SYMBOL

public static final int SYMBOL
Represents the "Symbol" font

See Also:
Constant Field Values

ZAPFDINGBATS

public static final int ZAPFDINGBATS
Represents the "ZapfDingbats" font. Note that the characters in the font are defined by the correct Unicode codepoints, rather than just numbers 1 to 255. See the file docs/map-zapf.pdf that came with the distribution to see what these codepoints are.

See Also:
Constant Field Values
Constructor Detail

StandardFont

public StandardFont(int type)
Create a new font of the specified type.

Parameters:
type - Which font to create. One of TIMES, COURIERBOLD etc.
Method Detail

getKerning

public int getKerning(int i1,
                      int i2)
Description copied from class: PDFFont
Get the horizontal character-to-character (or "pair-wise") kerning in this font for the specified characters, in millipoints. This method is identical to PDFFont.getKerning(char,char) but takes ints, to handle the new Unicode 4.0 characters defined in Java 1.5

Specified by:
getKerning in class PDFFont
Parameters:
i1 - a Unicode codepoint between U+0000 and U+10FFFD
i2 - a Unicode codepoint between U+0000 and U+10FFFD

getDefaultLeading

public float getDefaultLeading()
Description copied from class: PDFFont

Get the default leading for this font - the preferred distance between two successive baselines of text. Values are a ratio of the font size, and are typically between 1 and 1.3

Note that the values of the different spacing-between-lines methods have changed - in versions 1.0.4 and earlier this routine normally returned 1 and the spacing was set by the PDFStyle.setTextLineSpacing(float) method. Since 1.1, the values for these two methods are effectively reversed. See the relevant method comments in the PDFStyle class for more information.

Specified by:
getDefaultLeading in class PDFFont

getStrikeoutThickness

public float getStrikeoutThickness()
Description copied from class: PDFFont
Get the strikeout thickness, as a proportion of the font size.

Specified by:
getStrikeoutThickness in class PDFFont

getStrikeoutPosition

public float getStrikeoutPosition()
Description copied from class: PDFFont
Get the strikeout position, as a proportion of the font size.

Specified by:
getStrikeoutPosition in class PDFFont

getSubscriptSize

public float getSubscriptSize()
Description copied from class: PDFFont

Get the recommended size of a super/sub script version of this font, as a proportion of the normal font size. Typical value is around 0.6.

For some fonts (like CJK or barcode fonts) where there is no concept of super or subscript, this value is entirely arbitrary.

Specified by:
getSubscriptSize in class PDFFont

getSuperscriptPosition

public float getSuperscriptPosition()
Description copied from class: PDFFont

Get the recommended position of a super-script version of this font, as a proportion of the sub-scripted font size. Value is always positive.

For some fonts (like CJK or barcode fonts) where there is no concept of super or subscript, this value is entirely arbitrary.

Specified by:
getSuperscriptPosition in class PDFFont

getSubscriptPosition

public float getSubscriptPosition()
Description copied from class: PDFFont

Get the recommended position of a sub-script version of this font, as a proportion of the sub-scripted font size. Value is almost always zero or negative.

For some fonts (like CJK or barcode fonts) where there is no concept of super or subscript, this value is entirely arbitrary.

Specified by:
getSubscriptPosition in class PDFFont

getUnderlineThickness

public float getUnderlineThickness()
Description copied from class: PDFFont
Get the underline thickness, as a proportion of the font size.

Specified by:
getUnderlineThickness in class PDFFont

getUnderlinePosition

public float getUnderlinePosition()
Description copied from class: PDFFont
Get the underline position, as a proportion of the font size. Like the getDescender() method, the returned value is almost always negative, indicating below the baseline.

Specified by:
getUnderlinePosition in class PDFFont

getAscender

public float getAscender()
Description copied from class: PDFFont
Get the Ascender for the font (the maximum height above the baseline the font extends), as a proportion of the point size.

Specified by:
getAscender in class PDFFont

getDescender

public float getDescender()
Description copied from class: PDFFont
Get the Descender for the font (the maximum height below the baseline the font extends), as a proportion of the point size. The returned value is usually negative.

Specified by:
getDescender in class PDFFont

isMonospace

public boolean isMonospace()
Description copied from class: PDFFont
Return true if every character has the same width (like Courier), false if every character is potentially a different width (like Times-Roman)

Specified by:
isMonospace in class PDFFont

versionItalic

public PDFFont versionItalic()
Return an italic version of this font if it exists, or the current font if it doesn't.

Since:
1.1

versionBold

public PDFFont versionBold()
Return a bold version of this font if it exists, or the current font if it doesn't.

Since:
1.1

versionRegular

public PDFFont versionRegular()
Return a regular (non-bold, non-italic) version of this font if it exists, or the current font if it doesn't.

Since:
1.1

hashCode

public int hashCode()


Copyright © 2001-2004 Big Faceless Organization