|
PDF Clown 0.0.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.stefanochizzolini.clown.objects.PdfObjectWrapper<PdfDictionary> it.stefanochizzolini.clown.documents.contents.fonts.Font
public abstract class Font
Abstract font [PDF:1.6:5.4].
Nested Class Summary | |
---|---|
static class |
Font.FlagsEnum
Font descriptor flags [PDF:1.6:5.7.1]. |
Field Summary | |
---|---|
protected BiMap<ByteArray,Integer> |
codes
Unicodes by character code. |
protected int |
defaultGlyphWidth
Default glyph width. |
protected Map<Integer,Integer> |
glyphIndexes
Glyph indexes by unicode. |
protected Map<Integer,Integer> |
glyphKernings
Glyph kernings by (left-right) glyph index pairs. |
protected Map<Integer,Integer> |
glyphWidths
Glyph widths by glyph index. |
protected boolean |
symbolic
Whether the font encoding is custom (that is non-Unicode). |
Constructor Summary | |
---|---|
protected |
Font(Document context)
Creates a new font structure within the given document context. |
protected |
Font(PdfDirectObject baseObject)
Loads an existing font structure. |
Method Summary | |
---|---|
String |
decode(byte[] code)
Gets the text from the given internal representation. |
byte[] |
encode(String text)
Gets the internal representation of the given text. |
boolean |
equals(Font object)
|
static Font |
get(Document context,
File file)
Creates the representation of a font. |
static Font |
get(Document context,
IInputStream fontData)
Creates the representation of a font. |
static Font |
get(Document context,
String path)
Creates the representation of a font. |
double |
getAscent()
Gets the unscaled vertical offset from the baseline to the ascender line (ascent). |
double |
getAscent(double size)
Gets the vertical offset from the baseline to the ascender line (ascent), scaled to the given font size. |
double |
getDescent()
Gets the unscaled vertical offset from the baseline to the descender line (descent). |
double |
getDescent(double size)
Gets the vertical offset from the baseline to the descender line (descent), scaled to the given font size. |
protected abstract PdfDictionary |
getDescriptor()
Gets the font descriptor. |
EnumSet<Font.FlagsEnum> |
getFlags()
Gets the font descriptor flags. |
double |
getHeight(char textChar)
Gets the unscaled height of the given character. |
double |
getHeight(char textChar,
double size)
Gets the height of the given character, scaled to the given font size. |
double |
getHeight(String text)
Gets the unscaled height of the given text. |
double |
getHeight(String text,
double size)
Gets the height of the given text, scaled to the given font size. |
double |
getKernedWidth(String text,
double size)
Gets the width (kerning inclusive) of the given text, scaled to the given font size. |
int |
getKerning(char textChar1,
char textChar2)
Gets the unscaled kerning width between two given characters. |
int |
getKerning(String text)
Gets the unscaled kerning width inside the given text. |
double |
getKerning(String text,
double size)
Gets the kerning width inside the given text, scaled to the given font size. |
double |
getLineHeight()
Gets the unscaled line height. |
double |
getLineHeight(double size)
Gets the line height, scaled to the given font size. |
String |
getName()
Gets the PostScript name of the font. |
static double |
getScalingFactor(double size)
Gets the scaling factor to be applied to unscaled metrics to get actual measures. |
String |
getType()
Gets the font type. |
int |
getWidth(char textChar)
Gets the unscaled width of the given character. |
double |
getWidth(char textChar,
double size)
Gets the width of the given character, scaled to the given font size. |
int |
getWidth(String text)
Gets the unscaled width (kerning exclusive) of the given text. |
double |
getWidth(String text,
double size)
Gets the width (kerning exclusive) of the given text, scaled to the given font size. |
boolean |
isSymbolic()
Gets whether the font encoding is custom (that is non-Unicode). |
protected void |
load()
Loads font information from existing PDF font structure. |
protected abstract void |
onLoad()
Notifies the loading of font information from an existing PDF font structure. |
static Font |
wrap(PdfReference reference)
Wraps a font reference into a font object. |
Methods inherited from class it.stefanochizzolini.clown.objects.PdfObjectWrapper |
---|
clone, delete, getBaseDataObject, getBaseObject, getContainer, getDocument, getFile, setBaseObject, setContainer, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected BiMap<ByteArray,Integer> codes
When this map is populated, symbolic
variable shall accordingly be set.
protected int defaultGlyphWidth
protected Map<Integer,Integer> glyphIndexes
protected Map<Integer,Integer> glyphKernings
protected Map<Integer,Integer> glyphWidths
protected boolean symbolic
Constructor Detail |
---|
protected Font(Document context)
protected Font(PdfDirectObject baseObject)
Method Detail |
---|
public static Font get(Document context, String path)
public static Font get(Document context, File file)
public static Font get(Document context, IInputStream fontData)
public static final double getScalingFactor(double size)
public static final Font wrap(PdfReference reference)
reference
- Reference to a font object.
public final String decode(byte[] code)
code
- Internal representation to decode.public final byte[] encode(String text)
text
- Text to encode.public final boolean equals(Font object)
public double getAscent()
public final double getAscent(double size)
size
- Font size.public double getDescent()
public final double getDescent(double size)
size
- Font size.public EnumSet<Font.FlagsEnum> getFlags()
public final double getHeight(char textChar)
textChar
- Character whose height has to be calculated.public final double getHeight(char textChar, double size)
textChar
- Character whose height has to be calculated.size
- Font size.public final double getHeight(String text)
text
- Text whose height has to be calculated.public final double getHeight(String text, double size)
text
- Text whose height has to be calculated.size
- Font size.public final double getKernedWidth(String text, double size)
text
- Text whose width has to be calculated.size
- Font size.public final int getKerning(char textChar1, char textChar2)
textChar1
- Left character.textChar2
- Right character,public final int getKerning(String text)
text
- Text whose kerning has to be calculated.public final double getKerning(String text, double size)
text
- Text whose kerning has to be calculated.size
- Font size.public double getLineHeight()
public final double getLineHeight(double size)
size
- Font size.public final String getName()
public final String getType()
public int getWidth(char textChar)
textChar
- Character whose width has to be calculated.public final double getWidth(char textChar, double size)
textChar
- Character whose height has to be calculated.size
- Font size.public int getWidth(String text)
text
- Text whose width has to be calculated.public final double getWidth(String text, double size)
text
- Text whose width has to be calculated.size
- Font size.public boolean isSymbolic()
protected abstract PdfDictionary getDescriptor()
protected void load()
protected abstract void onLoad()
|
PDF Clown 0.0.8 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |