|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.PDFFont
public abstract class PDFFont
The PDFFont is the abstract superclass for all Fonts in a PDF document. It defines properties which are common to all fonts, regardless of writing direction.
PDFStyle
,
LayoutBox
Method Summary | |
---|---|
abstract float |
getAscender()
Get the Ascender for the font (the maximum height above the baseline the font extends), as a proportion of the point size. |
String[] |
getAvailableFeatures()
Return the list of available features for this font. |
String |
getBaseName()
Return the Base Font Name for this font. |
float |
getBottom(String s)
Get the bottom-most Y co-ordinate if this String was rendered in 1 point high text at position (0,0) |
int |
getCharWidth(char c)
Return the width of the specified character in millipoints if the font size was 1 point. |
int |
getCharWidth(int codepoint)
Return the width of the specified character in millipoints if the font size was 1 point. |
abstract float |
getDefaultLeading()
Get the default leading for this font - the preferred distance between two successive baselines of text. |
abstract float |
getDescender()
Get the Descender for the font (the maximum height below the baseline the font extends), as a proportion of the point size. |
boolean |
getFeature(String feature)
Returns whether the specified feature is currently set |
int |
getKerning(char c1,
char c2)
Get the horizontal character-to-character (or "pair-wise") kerning in this font for the specified characters, in millipoints. |
int |
getKerning(int codepoint1,
int codepoint2)
Get the horizontal character-to-character (or "pair-wise") kerning in this font for the specified characters, in millipoints. |
float |
getLeft(String s)
Get the left-most X co-ordinate if this String was rendered in 1 point high text at position (0,0) |
float |
getRight(String s)
Get the right-most X co-ordinate if this String was rendered in 1 point high text at position (0,0) |
abstract float |
getStrikeoutPosition()
Get the strikeout position, as a proportion of the font size. |
abstract float |
getStrikeoutThickness()
Get the strikeout thickness, as a proportion of the font size. |
abstract float |
getSubscriptPosition()
Get the recommended position of a sub-script version of this font, as a proportion of the sub-scripted font size. |
abstract float |
getSubscriptSize()
Get the recommended size of a super/sub script version of this font, as a proportion of the normal font size. |
abstract float |
getSuperscriptPosition()
Get the recommended position of a super-script version of this font, as a proportion of the sub-scripted font size. |
float |
getTop(String s)
Get the top-most Y co-ordinate if this String was rendered in 1 point high text at position (0,0) |
abstract float |
getUnderlinePosition()
Get the underline position, as a proportion of the font size. |
abstract float |
getUnderlineThickness()
Get the underline thickness, as a proportion of the font size. |
abstract float |
getXHeight()
Get the X-Height of the font - normally the height of a lower-case 'x' character |
boolean |
isDefined(char c)
Return true if the specified Unicode character is defined in the font. |
boolean |
isDefined(int codepoint)
Return true if the specified Unicode character is defined in the font. |
boolean |
isHorizontal()
Return true if the specified font is written Left-to-Right or Right-to-Left. |
abstract 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) |
int |
ligaturize(char[] buf,
int off,
int len,
Locale locale)
Substitute ligatures into the specified character array where appropriate. |
String |
ligaturize(String s,
Locale locale)
Return the specified string with ligatures substituted where appropriate. |
boolean |
requote(char[] buf,
int off,
int len,
Locale locale)
Substitute "curly-quotes" into the specified buffer where appropriate. |
String |
requote(String s,
Locale l)
Substitute curly quotes into the document. |
void |
setFeature(String feature,
boolean on)
Set or clear an optional feature on a font. |
String |
toString()
|
PDFFont |
versionBold()
Return a bold version of the current font, if available. |
PDFFont |
versionItalic()
Return an italic version of the current font, if available. |
PDFFont |
versionNonBold()
Return a non-bold version of the current font, if available. |
PDFFont |
versionNonItalic()
Return a non-italic version of the current font, if available. |
PDFFont |
versionRegular()
Return a non-bold, non-italic version of the current font, if available. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public final float getLeft(String s)
public final float getTop(String s)
public final float getBottom(String s)
public final float getRight(String s)
public final boolean isDefined(char c)
public final boolean isDefined(int codepoint)
isDefined(char)
but takes an int
,
to cater for the new Unicode 4.0 codepoints added in Java 1.5.
codepoint
- a Unicode codepoint between U+0000 and U+10FFFDpublic final int getCharWidth(char c)
public int getCharWidth(int codepoint)
getCharWidth(char)
method but takes an int
to cater
for the new Unicode 4.0 codepoints added in Java 1.5.
codepoint
- a Unicode codepoint between U+0000 and U+10FFFDpublic String getBaseName()
public final int getKerning(char c1, char c2)
c1
in order to correctly position
character c2
. For many fonts and combinations of characters, this returns zero.
PDFStyle.setTrackKerning(float)
public int getKerning(int codepoint1, int codepoint2)
getKerning(char,char)
but takes ints, to handle the new Unicode 4.0
characters defined in Java 1.5
codepoint1
- a Unicode codepoint between U+0000 and U+10FFFDcodepoint2
- a Unicode codepoint between U+0000 and U+10FFFDpublic final boolean isHorizontal()
public abstract boolean isMonospace()
public abstract float getAscender()
public abstract float getDescender()
public abstract float getDefaultLeading()
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.
public abstract float getUnderlineThickness()
public abstract float getUnderlinePosition()
getDescender()
method, the returned value is almost
always negative, indicating below the baseline.
public abstract float getStrikeoutThickness()
public abstract float getStrikeoutPosition()
public abstract float getSubscriptSize()
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.
public abstract float getSuperscriptPosition()
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.
public abstract float getSubscriptPosition()
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.
public abstract float getXHeight()
public void setFeature(String feature, boolean on)
more
to choose from.
feature
- the feature nameon
- whether to set or clear the featurepublic String[] getAvailableFeatures()
setFeature(java.lang.String, boolean)
setFeature(java.lang.String, boolean)
public boolean getFeature(String feature)
feature
- the feature namepublic int ligaturize(char[] buf, int off, int len, Locale locale)
buf
- the buffer to modifyoff
- the offset into the buffer for the start of the datalen
- the length of the data in the bufferlocale
- controls which language the buffer is in. Currently not used.
public boolean requote(char[] buf, int off, int len, Locale locale)
buf
- the buffer to modifyoff
- the offset into the buffer to the start of the datalen
- the length of the data in the bufferlocale
- determines which style of quote is substituted. Recognized languages are english, dutch, italian, spanish, portuguese, catalan, turkish, czech, german, slovak, danish, swedish, norwegian, finnish, polish and hungarian
public String requote(String s, Locale l)
requote(char[],int,int,Locale)
but returns the end result as a (possibly) new String. Obviously not as efficient, but
more convenient
public String ligaturize(String s, Locale locale)
Return the specified string with ligatures substituted where appropriate. As
for the ligaturize(char[],int,int,Locale)
method, but returns an
entirely new String. Obviously not as efficient as the other method, but more
convenient.
s
- the string to ligaturizelocale
- controls which language the buffer is in. Currently not used.public PDFFont versionItalic()
public PDFFont versionBold()
public PDFFont versionNonBold()
public PDFFont versionNonItalic()
public PDFFont versionRegular()
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |