Package com.itextpdf.io.font.otf
Class Glyph
- java.lang.Object
-
- com.itextpdf.io.font.otf.Glyph
-
- Direct Known Subclasses:
GidAwareGlyph
public class Glyph extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description (package private) shortanchorDeltaprivate int[]bboxprivate char[]charsprivate intcodeprivate booleanisMarkprivate static charREPLACEMENT_CHARACTERprivate static java.lang.StringREPLACEMENT_CHARACTER_STRINGprivate static char[]REPLACEMENT_CHARACTERSprivate intunicodeprivate intwidth(package private) shortxAdvance(package private) shortxPlacement(package private) shortyAdvance(package private) shortyPlacement
-
Constructor Summary
Constructors Constructor Description Glyph(int width, int unicode)Construct a non-mark Glyph object with id -1 and characters retrieved from unicode.Glyph(int code, int width, char[] chars)Construct a non-mark Glyph, using the codepoint of the characters as unicode point.Glyph(int code, int width, int unicode)Construct a non-mark Glyph, retrieving characters from unicode.Glyph(int code, int width, int unicode, char[] chars, boolean IsMark)Construct a glyph object form the passed arguments.Glyph(int code, int width, int unicode, int[] bbox)Construct a non-mark Glyph, retrieving characters from unicode.Glyph(Glyph glyph)Copy a Glyph.Glyph(Glyph glyph, int unicode)Copy a glyph and assign the copied glyph a new unicode point and charactersGlyph(Glyph glyph, int xPlacement, int yPlacement, int xAdvance, int yAdvance, int anchorDelta)Copy a Glyph and assign new placement and advance offsets and a new index delta to base glyph
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static intcodePoint(char[] a)booleanequals(java.lang.Object obj)Two Glyphs are equal if their unicode characters, code and normalized width are equal.shortgetAnchorDelta()int[]getBbox()char[]getChars()private static char[]getChars(int unicode)intgetCode()intgetUnicode()char[]getUnicodeChars()Gets Unicode char sequence corresponding to this glyph.java.lang.StringgetUnicodeString()Gets a Unicode string corresponding to this glyph.intgetWidth()shortgetXAdvance()shortgetXPlacement()shortgetYAdvance()shortgetYPlacement()booleanhasAdvance()inthashCode()booleanhasOffsets()booleanhasPlacement()booleanhasValidUnicode()booleanisMark()voidsetAnchorDelta(short anchorDelta)voidsetChars(char[] chars)voidsetUnicode(int unicode)voidsetXAdvance(short xAdvance)voidsetXPlacement(short xPlacement)voidsetYAdvance(short yAdvance)voidsetYPlacement(short yPlacement)private static java.lang.StringtoHex(int ch)java.lang.StringtoString()
-
-
-
Field Detail
-
REPLACEMENT_CHARACTER
private static final char REPLACEMENT_CHARACTER
- See Also:
- Constant Field Values
-
REPLACEMENT_CHARACTERS
private static final char[] REPLACEMENT_CHARACTERS
-
REPLACEMENT_CHARACTER_STRING
private static final java.lang.String REPLACEMENT_CHARACTER_STRING
-
code
private final int code
-
width
private final int width
-
bbox
private int[] bbox
-
unicode
private int unicode
-
chars
private char[] chars
-
isMark
private final boolean isMark
-
xPlacement
short xPlacement
-
yPlacement
short yPlacement
-
xAdvance
short xAdvance
-
yAdvance
short yAdvance
-
anchorDelta
short anchorDelta
-
-
Constructor Detail
-
Glyph
public Glyph(int code, int width, int unicode)Construct a non-mark Glyph, retrieving characters from unicode.- Parameters:
code- code representation of the glyph in the font filewidth- normalized width of the glyphunicode- utf-32 representation of glyph if appears. Correct value is > -1
-
Glyph
public Glyph(int code, int width, char[] chars)Construct a non-mark Glyph, using the codepoint of the characters as unicode point.- Parameters:
code- code representation of the glyph in the font filewidth- normalized width of the glyphchars- The Unicode text represented by this Glyph.
-
Glyph
public Glyph(int code, int width, int unicode, int[] bbox)Construct a non-mark Glyph, retrieving characters from unicode.- Parameters:
code- code representation of the glyph in the font filewidth- normalized width of the glyphunicode- utf-32 representation of glyph if appears. Correct value is > -1bbox- The normalized bounding box of this Glyph.
-
Glyph
public Glyph(int width, int unicode)Construct a non-mark Glyph object with id -1 and characters retrieved from unicode.- Parameters:
width- normalized width of the glyphunicode- utf-32 representation of glyph if appears. Correct value is > -1
-
Glyph
public Glyph(int code, int width, int unicode, char[] chars, boolean IsMark)Construct a glyph object form the passed arguments.- Parameters:
code- code representation of the glyph in the font filewidth- normalized width of the glyphunicode- utf-32 representation of glyph if appears. Correct value is > -1chars- The Unicode text represented by this Glyph. if null is passed, the unicode value is used to retrieve the chars.IsMark- True if the glyph is a Mark
-
Glyph
public Glyph(Glyph glyph)
Copy a Glyph.- Parameters:
glyph- Glyph to copy
-
Glyph
public Glyph(Glyph glyph, int xPlacement, int yPlacement, int xAdvance, int yAdvance, int anchorDelta)
Copy a Glyph and assign new placement and advance offsets and a new index delta to base glyph- Parameters:
glyph- Glyph to copyxPlacement- x - placement offsetyPlacement- y - placement offsetxAdvance- x - advance offsetyAdvance- y - advance offsetanchorDelta- Index delta to base glyph. If after a glyph there are several anchored glyphs we should know we to find base glyph.
-
Glyph
public Glyph(Glyph glyph, int unicode)
Copy a glyph and assign the copied glyph a new unicode point and characters- Parameters:
glyph- glyph to copyunicode- new unicode point
-
-
Method Detail
-
getCode
public int getCode()
-
getWidth
public int getWidth()
-
getBbox
public int[] getBbox()
-
hasValidUnicode
public boolean hasValidUnicode()
-
getUnicode
public int getUnicode()
-
setUnicode
public void setUnicode(int unicode)
-
getChars
public char[] getChars()
-
setChars
public void setChars(char[] chars)
-
isMark
public boolean isMark()
-
getXPlacement
public short getXPlacement()
-
setXPlacement
public void setXPlacement(short xPlacement)
-
getYPlacement
public short getYPlacement()
-
setYPlacement
public void setYPlacement(short yPlacement)
-
getXAdvance
public short getXAdvance()
-
setXAdvance
public void setXAdvance(short xAdvance)
-
getYAdvance
public short getYAdvance()
-
setYAdvance
public void setYAdvance(short yAdvance)
-
getAnchorDelta
public short getAnchorDelta()
-
setAnchorDelta
public void setAnchorDelta(short anchorDelta)
-
hasOffsets
public boolean hasOffsets()
-
hasPlacement
public boolean hasPlacement()
-
hasAdvance
public boolean hasAdvance()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Two Glyphs are equal if their unicode characters, code and normalized width are equal.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The object- Returns:
- True if this equals obj cast to Glyph, false otherwise.
-
getUnicodeString
public java.lang.String getUnicodeString()
Gets a Unicode string corresponding to this glyph. In general case it might consist of many characters. If this glyph does not have a valid unicode (hasValidUnicode()), then a string consisting of a special Unicode '�' character is returned.- Returns:
- the Unicode string that corresponds to this glyph
-
getUnicodeChars
public char[] getUnicodeChars()
Gets Unicode char sequence corresponding to this glyph. In general case it might consist of many characters. If this glyph does not have a valid unicode (hasValidUnicode()), then a special Unicode '�' character is returned.- Returns:
- the Unicode char sequence that corresponds to this glyph
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toHex
private static java.lang.String toHex(int ch)
-
codePoint
private static int codePoint(char[] a)
-
getChars
private static char[] getChars(int unicode)
-
-