public class Font
extends java.lang.Object
| Constructor and Description |
|---|
Font(java.lang.String fontName)
Find a font with the specified name, and construct a Font object from it.
|
Font(java.lang.String fontName,
java.util.EnumSet<FontCreateFlags> createFlags)
Find a font with the specified name, and construct a Font object from it.
|
Font(java.lang.String fontName,
java.util.EnumSet<FontCreateFlags> createFlags,
WritingMode wrMode)
Find a font with the specified name, and construct a Font object from it.
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete()
Destructor.
|
void |
embedNow(Document doc)
Embeds the Font.
|
long |
findIndexOfFirstUnrepresentableChar(java.lang.String text)
Find the index of the first character that cannot be represented in this font.
|
double |
getAscent() |
double |
getAvgWidth() |
double |
getCapHeight() |
java.lang.String |
getCidFontType() |
double |
getDescent() |
boolean |
getEmbedded()
Tests that Font is embedded in the document it was created for returns true if the font is embedded and returns false if it is not
|
java.lang.String |
getEncoding()
Return the encoding of the font.
|
EncodingInfo |
getEncodingInfo()
Get the populated CEncoding object.
|
java.util.EnumSet<FontFlags> |
getFlags()
Get the font flags for a font.
|
static java.util.List<Font> |
getFontList()
Get a list of available fonts.
|
java.lang.String |
getFullName()
Get the Full Name of the font.
|
double |
getItalicAngle() |
double |
getLeading() |
double |
getMaxWidth() |
double |
getMissingWidth() |
java.lang.String |
getName()
Get the name of the font.
|
PDFDict |
getPDFDict()
Retrieve the PDFDict representation of this object
|
double |
getStemH() |
double |
getStemV() |
java.lang.String |
getType()
Get the type of the font.
|
WritingMode |
getWritingMode() |
double |
getXHeight() |
boolean |
isFromDoc() |
boolean |
isTextRepresentable(java.lang.String text)
Is this text representable in this font?
|
double |
measureTextWidth(java.lang.String text,
double fontSize)
Measures the width of the specified text in points, using the Font at the specified size.
|
public Font(java.lang.String fontName)
When setting text, it checks to see if the text is representable in the font's encoding. If it is not, then DLE makes a "unicode font" with an Identity-H encoding and uses that to set the text. For non-Type0 fonts, this may result in two versions of a font in the output document.
PDFL enforces the following requirements on fonts:
TrueTypes used as CID fonts must be embedded.
All CID fonts that are embedded must be subsetted.
CID fonts that are marked as embedded get their DoNotEmbed flag turned off (or else PDFL won't make a PDEFont from the SysFont).
public Font(java.lang.String fontName,
java.util.EnumSet<FontCreateFlags> createFlags)
When setting text, it checks to see if the text is representable in the font's encoding. If it is not, then DLE makes a "unicode font" with an Identity-H encoding and uses that to set the text. For non-Type0 fonts, this may result in two versions of a font in the output document.
PDFL enforces the following requirements on fonts:
TrueTypes used as CID fonts must be embedded.
All CID fonts that are embedded must be subsetted.
CID fonts that are marked as embedded get their DoNotEmbed flag turned off (or else PDFL won't make a PDEFont from the SysFont).
fontName - the name of the font to createcreateFlags - flags specifying embedding and other options for the use of a font in the documentpublic Font(java.lang.String fontName,
java.util.EnumSet<FontCreateFlags> createFlags,
WritingMode wrMode)
When setting text, it checks to see if the text is representable in the font's encoding. If it is not, then DLE makes a "unicode font" with an Identity-H or Identity-V encoding and uses that to set the text. For non-Type0 fonts, this may result in two versions of a font in the output document.
PDFL enforces the following requirements on fonts:
TrueTypes used as CID fonts must be embedded.
All CID fonts that are embedded must be subsetted.
CID fonts that are marked as embedded get their DoNotEmbed flag turned off (or else PDFL won't make a PDEFont from the SysFont).
fontName - the name of the font to createcreateFlags - flags specifying embedding and other options for the use of a font in the documentwrMode - determines whether text will be printed horizontally or verticallypublic void delete()
public static java.util.List<Font> getFontList()
public double getAscent()
public double getAvgWidth()
public double getCapHeight()
public double getDescent()
public java.lang.String getEncoding()
WinAnsiEncoding
MacRomanEncoding
public double getItalicAngle()
public double getLeading()
public double getMaxWidth()
public double getMissingWidth()
public java.lang.String getName()
public java.lang.String getFullName()
public double getStemH()
public double getStemV()
public java.lang.String getType()
Type0
Type1
MMType1
TrueType
public java.lang.String getCidFontType()
public double getXHeight()
public java.util.EnumSet<FontFlags> getFlags()
public EncodingInfo getEncodingInfo()
public WritingMode getWritingMode()
public boolean isTextRepresentable(java.lang.String text)
text - the text to checkpublic long findIndexOfFirstUnrepresentableChar(java.lang.String text)
text - the text to checkpublic PDFDict getPDFDict()
public boolean isFromDoc()
public boolean getEmbedded()
public void embedNow(Document doc)
doc - the Document the Font is embedded intopublic double measureTextWidth(java.lang.String text,
double fontSize)
text - the Text to be measuredfontSize - the Font size to be used