Class Glyph

java.lang.Object
com.itextpdf.io.font.otf.Glyph

public class Glyph extends Object
  • 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 characters
    Glyph(Glyph glyph, int xAdvance, int yAdvance)
    Copy a Glyph and assign new advance offsets.
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object obj)
    Two Glyphs are equal if their unicode characters, code and normalized width are equal.
    short
    Gets the index delta to base glyph.
    int[]
     
    char[]
     
    int
     
    int
     
    char[]
    Gets Unicode char sequence corresponding to this glyph.
    Gets a Unicode string corresponding to this glyph.
    int
     
    short
     
    short
     
    short
     
    short
     
    boolean
    Checks whether the glyph has advance offsets: either for X axis or Y axis or both at the same time.
    int
     
    boolean
    Checks whether the glyph has any offsets either own or advance or both at the same time.
    boolean
    Checks whether the glyph has own offsets: either for X axis or Y axis or both at the same time.
    boolean
     
    boolean
    isMark()
     
    void
    setAnchorDelta(short anchorDelta)
    Sets the index delta to base glyph.
    void
    setChars(char[] chars)
     
    void
    setUnicode(int unicode)
     
    void
    setXAdvance(short xAdvance)
     
    void
    setXPlacement(short xPlacement)
     
    void
    setYAdvance(short yAdvance)
     
    void
    setYPlacement(short yPlacement)
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • 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 file
      width - normalized width of the glyph
      unicode - 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 file
      width - normalized width of the glyph
      chars - 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 file
      width - normalized width of the glyph
      unicode - utf-32 representation of glyph if appears. Correct value is > -1
      bbox - 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 glyph
      unicode - 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 file
      width - normalized width of the glyph
      unicode - utf-32 representation of glyph if appears. Correct value is > -1
      chars - 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 xAdvance, int yAdvance)
      Copy a Glyph and assign new advance offsets.
      Parameters:
      glyph - Glyph to copy
      xAdvance - x - advance offset
      yAdvance - y - advance offset
    • 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 copy
      xPlacement - x - placement offset
      yPlacement - y - placement offset
      xAdvance - x - advance offset
      yAdvance - y - advance offset
      anchorDelta - 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 copy
      unicode - new unicode point
  • Method Details

    • 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()
      Gets the index delta to base glyph.
      Returns:
      the index delta to base glyph
    • setAnchorDelta

      public void setAnchorDelta (short anchorDelta)
      Sets the index delta to base glyph.
      Parameters:
      anchorDelta - the index delta to base glyph to be set
    • hasOffsets

      public boolean hasOffsets()
      Checks whether the glyph has any offsets either own or advance or both at the same time.

      See hasPlacement() and hasAdvance().

      Returns:
      true if glyph has any offsets, false otherwise
    • hasPlacement

      public boolean hasPlacement()
      Checks whether the glyph has own offsets: either for X axis or Y axis or both at the same time.
      Returns:
      true if glyph has any own offsets, false otherwise
    • hasAdvance

      public boolean hasAdvance()
      Checks whether the glyph has advance offsets: either for X axis or Y axis or both at the same time.
      Returns:
      true if glyph has any advance offsets, false otherwise
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals (Object obj)
      Two Glyphs are equal if their unicode characters, code and normalized width are equal.
      Overrides:
      equals in class Object
      Parameters:
      obj - еhe object
      Returns:
      true if this equals obj cast to Glyph, false otherwise
    • getUnicodeString

      public 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 String toString()
      Overrides:
      toString in class Object