|
aXSL API 0.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The FontUse interface exposes a font resource to the client application.
It encapsulates a Font
as it is used by a specific
FontConsumer
, for a specific Encoding
and for a specific
font family. It is possible for a FontConsumer
to use the same
Font
instance in more than one way, due to more than one encoding or
the font being configured in more than one font family.
Method Summary | |
int |
encodeCharacter(int codePoint)
Retrieve the font glyph index for a specified Unicode character. |
Encoding |
getEncoding()
Get the Encoding scheme that is used to encode characters in this Font. |
Font |
getFont()
Return the parent Font. |
FontConsumer |
getFontConsumer()
Returns the FontConsumer for whom this FontUse exists. |
FontOutput |
getFontOutput(java.lang.String mimeType)
Provide a FontOutput implementation for a given mime type. |
java.lang.String |
getPostscriptName()
Returns the PostScript name of the font. |
boolean |
glyphAvailable(int codePoint)
Reports whether a glyph can be encoded for a given character. |
FontUse |
nextBolderFont()
Returns the next bolder font in this font's font-family, if one exists, or null if this is the boldest font. |
short |
nextBolderWeight()
Returns the weight of the next bolder font in this font's font-family, if one exists. |
FontUse |
nextLighterFont()
Returns the next lighter font in this font's font-family, if one exists, or null if this is the lightest font. |
short |
nextLighterWeight()
Returns the weight of the next lighter font in this font's font-family, if one exists. |
void |
registerCharsUsed(java.lang.CharSequence charSequence)
Convenience method that provides the equivalent of running registerCharUsed(int) for each char in a given
String, StringBuffer or other CharSequence . |
void |
registerCharUsed(int codePoint)
Records the fact that a FontConsumer is using a particular character. |
float |
simulateBackslant()
If this font has been configured to simulate the "backslant" font-style, return the percentage of 90 degrees that should be used to compute the angle at which the characters should be skewed to obtain that effect. |
float |
simulateCondensed()
If this font has been configured to simulate the "condensed" font-stretch, return the percentage that should be applied to the width of characters in this font to achieve that effect. |
float |
simulateExpanded()
If this font has been configured to simulate the "expanded" font-stretch, return the percentage that should be applied to the width of characters in this font to achieve that effect. |
float |
simulateExtraCondensed()
If this font has been configured to simulate the "extra-condensed" font-stretch, return the percentage that should be applied to the width of characters in this font to achieve that effect. |
float |
simulateExtraExpanded()
If this font has been configured to simulate the "extra-expanded" font-stretch, return the percentage that should be applied to the width of characters in this font to achieve that effect. |
float |
simulateOblique()
If this font has been configured to simulate the "oblique" font-style, return the percentage of 90 degrees that should be used to compute the angle at which the characters should be skewed to obtain that effect. |
float |
simulateSemiCondensed()
If this font has been configured to simulate the "semi-condensed" font-stretch, return the percentage that should be applied to the width of characters in this font to achieve that effect. |
float |
simulateSemiExpanded()
If this font has been configured to simulate the "semi-expanded" font-stretch, return the percentage that should be applied to the width of characters in this font to achieve that effect. |
float |
simulateUltraCondensed()
If this font has been configured to simulate the "ultra-condensed" font-stretch, return the percentage that should be applied to the width of characters in this font to achieve that effect. |
float |
simulateUltraExpanded()
If this font has been configured to simulate the "ultra-expanded" font-stretch, return the percentage that should be applied to the width of characters in this font to achieve that effect. |
int |
smallCapsSize(int fontSize)
Computes the size, in millipoints, which should be used for the intrinsically lowercase characters in this font. |
int |
unavailableChar(java.lang.CharSequence chars,
int beginIndex)
Examines each character in a specified portion of a String or other CharSequence to determine whether a glyph can be encoded for that character. |
int[] |
unavailableChars(java.lang.CharSequence chars,
int beginIndex)
Examines each character in a specified portion of a String or other CharSequence to determine whether a glyph can be encoded for that character. |
boolean |
wasUsed()
Indicates whether any characters registered use. |
Methods inherited from interface java.lang.Comparable |
compareTo |
Method Detail |
public Font getFont()
public int encodeCharacter(int codePoint)
Retrieve the font glyph index for a specified Unicode character. Note that if the font is subsetted, the glyph index returned is that for the subsetted font, not for the original font. This is needed to properly build and retrieve font subset information and to ensure that the right encoding is used.
Design Note: This method returns an int (instead of a char) because it is conceivable that some fonts will need more than 16 bits to express their glyph indexes.
codePoint
- The Unicode character for which the glyph index is
desired.
codePoint
. This is normally the
code that is written to an output document (such as PDF or PostScript).public Encoding getEncoding()
Font.getInternalEncoding()
public short nextBolderWeight()
Font.FONT_WEIGHT_900
, then returns that value.
Font.FONT_WEIGHT_100
,
Font.FONT_WEIGHT_200
,
Font.FONT_WEIGHT_300
, Font.FONT_WEIGHT_400
,
Font.FONT_WEIGHT_500
, Font.FONT_WEIGHT_600
,
Font.FONT_WEIGHT_700
, Font.FONT_WEIGHT_800
,
Font.FONT_WEIGHT_900
public short nextLighterWeight()
Font.FONT_WEIGHT_100
, then returns that value.
Font.FONT_WEIGHT_100
,
Font.FONT_WEIGHT_200
,
Font.FONT_WEIGHT_300
, Font.FONT_WEIGHT_400
,
Font.FONT_WEIGHT_500
, Font.FONT_WEIGHT_600
,
Font.FONT_WEIGHT_700
, Font.FONT_WEIGHT_800
,
Font.FONT_WEIGHT_900
public FontUse nextBolderFont()
public FontUse nextLighterFont()
public int unavailableChar(java.lang.CharSequence chars, int beginIndex)
Examines each character in a specified portion of a String or other CharSequence to determine whether a glyph can be encoded for that character. If a glyph cannot be encoded, either because the Font does not have a glyph for the character, or because the FontUse encoding cannot encode the character, the character's index in the CharSequence is returned.
chars
- The String, StringBuffer or other CharSequence to be
examined.beginIndex
- The first index in chars
to be examined.
chars
at or after
beginIndex
which contains an unencodable character.
If all characters in chars
can be encoded, -1 is returned.public int[] unavailableChars(java.lang.CharSequence chars, int beginIndex)
Examines each character in a specified portion of a String or other CharSequence to determine whether a glyph can be encoded for that character. If a glyph cannot be encoded, either because the Font does not have a glyph for the character, or because the FontUse encoding cannot encode the character, it is included in an array of indexes that is returned.
chars
- The String, StringBuffer or other CharSequence to be
examined.beginIndex
- The first index in chars
to be examined.
chars
for which no glyph can be encoded.
If all characters in chars
can be encoded, null is returned.public boolean glyphAvailable(int codePoint)
Reports whether a glyph can be encoded for a given character.
Note that, even if the Font has a glyph for the character, this method will return false if the character cannot be encoded with this FontUse's encoding.
codePoint
- The Unicode character to be tested.
public int smallCapsSize(int fontSize)
Computes the size, in millipoints, which should be used for the intrinsically lowercase characters in this font. If the font has true small-caps glyphs or is unable to simulate small-caps, the value returned will be the same as the value passed. In other words, no scaling is implied. Only if the font is capable of simulating small-caps will the value returned be different from the value passed.
Not all font-families have a small-caps variant, but small-caps can be simulated by the client application. To do so, 1) convert all text to uppercase characters, and 2) switch back and forth between a larger font size (for characters originally in uppercase) and a smaller font size (for characters originally in lowercase). If the requested font size is 12 points, and the lowercase characters should be scaled at 80%, then the font size to use for the lowercase characters is 9.6 points.
Note that the simulation of small-caps is done entirely outside of the font system. As far as the font system is concerned, the same font is being used regardless of whether it is being used at the size for uppercase characters or the size for lowercase characters. All that is being reported in this method is the computation of what has been configured for the font.
fontSize
- The size, in millipoints, of the font at normal size.
In other words, the size that will be used to create the uppercase
glyphs.
public float simulateOblique()
public float simulateBackslant()
public float simulateUltraCondensed()
public float simulateExtraCondensed()
public float simulateCondensed()
public float simulateSemiCondensed()
public float simulateSemiExpanded()
public float simulateExpanded()
public float simulateExtraExpanded()
public float simulateUltraExpanded()
public java.lang.String getPostscriptName()
public FontConsumer getFontConsumer()
public void registerCharUsed(int codePoint)
codePoint
- The Unicode character to be registered.public void registerCharsUsed(java.lang.CharSequence charSequence)
registerCharUsed(int)
for each char in a given
String, StringBuffer or other CharSequence
.
charSequence
- The CharSequence
whose contents should be
registered.public FontOutput getFontOutput(java.lang.String mimeType)
FontOutput
implementation for a given mime type.
mimeType
- The mime type for which the FontOutput instance should
be obtained.
for details
on registering {@link FontOutputFactory} instances.
public boolean wasUsed()
registerCharUsed(int)
and
registerCharsUsed(CharSequence)
.
|
aXSL API 0.1 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This documentation was created September 6 2006 by The aXSL Group and may be freely copied. See license for details.