ElegantJ PDF Library Java API Specification v1.1

com.elegantj.pdf
Class TrueTypeFont

java.lang.Object
  extended bycom.elegantj.pdf.PDFObject
      extended bycom.elegantj.pdf.PDFFont
          extended bycom.elegantj.pdf.TrueTypeFont
Direct Known Subclasses:
TrueTypeCJKFont

public class TrueTypeFont
extends PDFFont

Provides the TrueTypeFont for the PDF


Field Summary
 
Fields inherited from class com.elegantj.pdf.PDFFont
BOLD, BOLDITALIC, IDENTITY_H, IDENTITY_V, ITALIC, MACROMAN, REGULAR, WINANSI
 
Constructor Summary
protected TrueTypeFont()
          Default constructor
  TrueTypeFont(java.lang.String filePath, int style, java.lang.String encoding, boolean embedded, boolean subset)
          Constructs the TrueTypeFont from the specified filePath, style, encoding and option to subset
 
Method Summary
 float getAscender(float fontSize)
          Returns the maximum height above the baseline reached by characters in this font
 float getBBoxLowerLeftX(float fontSize)
          Returns the fontís bounding box's lower left X coordinate
 float getBBoxLowerLeftY(float fontSize)
          Returns the fontís bounding box's lower left Y coordinate
 float getBBoxUpperRightX(float fontSize)
          Returns the fontís bounding box's upper right X coordinate
 float getBBoxUpperRightY(float fontSize)
          Returns the fontís bounding box's upper right Y coordinate
 float getCapHeight(float fontSize)
          Returns the Y-coordinate of the top of flat capital letters, measured from the baseline
 float getDescender(float fontSize)
          Returns the maximum depth below the baseline reached by characters in this font Descent is a negative number
 int getGlyphWidth(int glyph)
          Returns the glyph width at the specified glyph
 float getItalicAngle()
          Returns the angle in degrees counterclockwise from the vertical of the dominant vertical strokes of the font.
 float getLeading()
          Returns the desired spacing between lines of text
 boolean isEmbedded()
          Returns wheather font is embedded or not
 boolean isSubset()
          Returns wheather embedded font file is subset or not subset means the characters which are used in pdf only included to the pdf
 
Methods inherited from class com.elegantj.pdf.PDFFont
getCharWidth, getCharWidth, getStringWidth, getStringWidth
 
Methods inherited from class com.elegantj.pdf.PDFObject
getPDFObjectID, getPDFObjectRefStr, getPDFObjectType, setPDFObjectID, setPDFObjectType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrueTypeFont

protected TrueTypeFont()
Default constructor


TrueTypeFont

public TrueTypeFont(java.lang.String filePath,
                    int style,
                    java.lang.String encoding,
                    boolean embedded,
                    boolean subset)
             throws java.lang.Exception,
                    java.io.IOException
Constructs the TrueTypeFont from the specified filePath, style, encoding and option to subset

Parameters:
filePath - The specified TrueType font file path
style - The specified style Possible vlaues are REGULAR, BOLD, ITALIC, BOLDITALIC If the font is embedded then the style is not working
encoding - The specified encoding
embedded - Option to wheather font is embedded to the PDF or not, If the embedded value is true then Font is embedded to the PDF file otherwise to see proper font into PDF, font must on end system
Method Detail

getGlyphWidth

public int getGlyphWidth(int glyph)
Returns the glyph width at the specified glyph

Parameters:
glyph - The specified glyph
Returns:
The width for the specified glyph

isSubset

public boolean isSubset()
Returns wheather embedded font file is subset or not subset means the characters which are used in pdf only included to the pdf


isEmbedded

public boolean isEmbedded()
Returns wheather font is embedded or not


getAscender

public float getAscender(float fontSize)
Returns the maximum height above the baseline reached by characters in this font

Overrides:
getAscender in class PDFFont
Parameters:
fontSize - The specified font size
Returns:
Ascender for the specified font size

getCapHeight

public float getCapHeight(float fontSize)
Returns the Y-coordinate of the top of flat capital letters, measured from the baseline

Overrides:
getCapHeight in class PDFFont
Parameters:
fontSize - The specified font size
Returns:
CapHeight for the specified font size

getDescender

public float getDescender(float fontSize)
Returns the maximum depth below the baseline reached by characters in this font Descent is a negative number

Overrides:
getDescender in class PDFFont
Parameters:
fontSize - The specified font size
Returns:
Descender for the specified font size

getItalicAngle

public float getItalicAngle()
Returns the angle in degrees counterclockwise from the vertical of the dominant vertical strokes of the font. ItalicAngle is negative for fonts that slope to the right, as almost all italic fonts do

Overrides:
getItalicAngle in class PDFFont

getBBoxLowerLeftX

public float getBBoxLowerLeftX(float fontSize)
Returns the fontís bounding box's lower left X coordinate

Overrides:
getBBoxLowerLeftX in class PDFFont
Parameters:
fontSize - The specified font size
Returns:
Font Bounding box's lower left X for the specified font size

getBBoxLowerLeftY

public float getBBoxLowerLeftY(float fontSize)
Returns the fontís bounding box's lower left Y coordinate

Overrides:
getBBoxLowerLeftY in class PDFFont
Parameters:
fontSize - The specified font size
Returns:
Font Bounding box's lower left Y for the specified font size

getBBoxUpperRightX

public float getBBoxUpperRightX(float fontSize)
Returns the fontís bounding box's upper right X coordinate

Overrides:
getBBoxUpperRightX in class PDFFont
Parameters:
fontSize - The specified font size
Returns:
Font Bounding box's upper right X for the specified font size

getBBoxUpperRightY

public float getBBoxUpperRightY(float fontSize)
Returns the fontís bounding box's upper right Y coordinate

Overrides:
getBBoxUpperRightY in class PDFFont
Parameters:
fontSize - The specified font size
Returns:
Font Bounding box's upper right Y for the specified font size

getLeading

public float getLeading()
Returns the desired spacing between lines of text

Overrides:
getLeading in class PDFFont

ElegantJ PDF Library Java API Specification v1.1

For any feedback, suggestion, or query, please revert back to support@elegantjpdf.com

Copyright(c)
Elegant Microweb Technologies Pvt. Ltd.
www.elegantmicroweb.com
www.elegantjpdf.com
All Rights Reserved.