public class PointFontDescriptor extends PropertyList
Modifier and Type | Class and Description |
---|---|
static class |
PointFontDescriptor.AfmFileSpecs |
PropertyList.NullPropertyList
Modifier and Type | Field and Description |
---|---|
static double |
defaultFontCorrectionConstant
When calculating the widths of characters a standard FontMetrics is
used and the value returned is multiplied by fontCorrectionFactor and then
this is added to that.
|
static double |
defaultFontCorrectionFactor
When calculating the widths of characters a standard FontMetrics is
used and the value returned is multiplied by this value and then
fontCorrectionConstant is added to that.
|
static boolean |
disableType1
Set this true to disable Type1 fonts completely.
|
static int |
FLAG_ALL_CAP |
static int |
FLAG_FIXED_PITCH |
static int |
FLAG_FORCE_BOLD |
static int |
FLAG_ITALIC |
static int |
FLAG_NON_SYMBOLIC |
static int |
FLAG_PDF_FLAGS_MASK |
static int |
FLAG_SCRIPT |
static int |
FLAG_SERIF |
static int |
FLAG_SMALL_CAP |
static int |
FLAG_SYMBOLIC |
static int |
FLAG_TYPE_1
If this flag value is not specified, the font is specified as a TrueType
font.
|
PointFont |
font |
double |
fontCorrectionConstant
When calculating the widths of characters a standard FontMetrics is
used and the value returned is multiplied by fontCorrectionFactor and then
this is added to that.
|
double |
fontCorrectionFactor
When calculating the widths of characters a standard FontMetrics is
used and the value returned is multiplied by this value and then
fontCorrectionConstant is added to that.
|
protected boolean |
resolved |
nullPropertyList
capacityIncrement, elementCount, elementData
serialVersionUID
Constructor and Description |
---|
PointFontDescriptor(BufferedReader afmFile,
PointFontDescriptor.AfmFileSpecs specs)
Create a PointFontDescriptor from an afmFile.
|
PointFontDescriptor(PointFont baseFont) |
PointFontDescriptor(PointFont baseFont,
int flags,
String optionalBaseName)
Create a PointFontDescriptor from a PointFont and setup the initial
values of Ascent, Descent, Leading, CapHeight, ItalicAngle etc.
|
PointFontDescriptor(String name,
int fontStyle,
int firstChar,
int lastChar) |
Modifier and Type | Method and Description |
---|---|
double |
getAscent(double forSize) |
double |
getCharWidth(char c,
double forSize) |
double |
getDescent(double forSize) |
double |
getLeading(double forSize) |
double |
getTextWidth(char[] data,
int offset,
int length,
double forSize) |
double |
getTextWidth(String s,
double forSize) |
static String |
getUnspacedName(String name) |
void |
resolve()
Resolve the PointFontDescriptor before actual use.
|
protected void |
resolve(BufferedReader afmFile,
PointFontDescriptor.AfmFileSpecs specs) |
void |
resolve(int firstChar,
int lastChar)
Resolve the PointFontDescriptor before actual use.
|
protected void |
resolve(PointFont baseFont,
int flags,
String optionalBaseName) |
void |
setFontWidthCorrection(double factor,
double constant)
Call this before calling setWidths().
|
void |
setWidths(int first,
int last)
Tell the PointFontDescriptor to calculate and set the widths for
the specified character range.
|
void |
setWidths(int first,
int last,
int[] values,
int missingWidth)
Set or calculate the values for the character widths of the specified
range of characters.
|
String |
toString()
Return a String representation of this object.
|
_getSetField, add, add, add, add, defaultTo, defaultTo, fromHashtable, fromStrings, get, get, getBoolean, getBoolean, getDouble, getDouble, getInt, getInt, getLong, getNames, getProperties, getProperties, getProperties, getPropertyValues, getSetProperties, getString, getString, getStrings, getValue, getValue, getValue, getValue, getValue, make, readConfigFile, remove, set, set, set, set, setBoolean, setClassValue, setDouble, setInt, setLong, setStrings, toHashtable, toPropertyList
add, add, addAll, addAll, addAll, addAll, addCopiesFrom, cacheAllElements, clear, compareTo, copied, copyCopiesFrom, copyFrom, copyInto, copyInto, del, find, get, getCopy, getCount, getFullCopy, getNew, insert, iterator, newVector, pop, push, size, toArray, toArray, toArray, toArray, toArray, toObjectArray
add, addAll, addAll, addElement, capacity, clone, contains, containsAll, elementAt, elements, ensureCapacity, firstElement, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, setElementAt, setSize, size, trimToSize
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode
public static final int FLAG_FIXED_PITCH
public static final int FLAG_SERIF
public static final int FLAG_SYMBOLIC
public static final int FLAG_SCRIPT
public static final int FLAG_NON_SYMBOLIC
public static final int FLAG_ITALIC
public static final int FLAG_ALL_CAP
public static final int FLAG_SMALL_CAP
public static final int FLAG_FORCE_BOLD
public static final int FLAG_PDF_FLAGS_MASK
public static final int FLAG_TYPE_1
public static boolean disableType1
public PointFont font
protected boolean resolved
public static double defaultFontCorrectionFactor
public static double defaultFontCorrectionConstant
public double fontCorrectionFactor
public double fontCorrectionConstant
public PointFontDescriptor(String name, int fontStyle, int firstChar, int lastChar)
public PointFontDescriptor(PointFont baseFont)
public PointFontDescriptor(PointFont baseFont, int flags, String optionalBaseName)
baseFont
- the PointFont specifying the name and style of the Font.flags
- additional Flags.optionalBaseName
- Normally the name is taken from the baseFont name
(with spaces removed)
with "Bold"/"Italic"/"BoldItalic" added as necessary, (preceded by a comma).
However if this is not null it will be used instead as is, with no modifications
for Bold/Italic.public PointFontDescriptor(BufferedReader afmFile, PointFontDescriptor.AfmFileSpecs specs) throws IOException
afmFile
- the afmFile.specs
- an optional AfmFileSpecs used to fill in data
that may be missing in the afmFile.IOException
public void setFontWidthCorrection(double factor, double constant)
factor
- the new fontCorrectionFactor.constant
- the new fontCorrectionConstant.public double getAscent(double forSize)
public double getDescent(double forSize)
public double getLeading(double forSize)
public double getTextWidth(String s, double forSize)
public double getTextWidth(char[] data, int offset, int length, double forSize)
public double getCharWidth(char c, double forSize)
public void setWidths(int first, int last)
first
- the first character in the range inclusive.last
- the last character in the range inclusive.public void setWidths(int first, int last, int[] values, int missingWidth)
first
- the first character in the range inclusive.last
- the last character in the range inclusive.values
- an int array with an entry for each item, or null
to calculate the widths.missingWidth
- the value to assign to missing widths. If it is -1
then a default value will be used.protected void resolve(BufferedReader afmFile, PointFontDescriptor.AfmFileSpecs specs) throws IOException
IOException
public String toString()
Object
public void resolve(int firstChar, int lastChar)
firstChar
- the first character to calculate widths for if necessary.lastChar
- the last character to calculate widths for if necessary.IOException
public void resolve()
IOException