public class

ShapedText

extends Object
implements AutoCloseable
java.lang.Object
   ↳ com.pdftron.pdf.ShapedText

Class Overview

The class ShapedText. A sequence of positioned glyphs -- the visual representation of a given text string

Summary

Nested Classes
class ShapedText.FailureReason  
class ShapedText.ShapingStatus  
Public Constructors
ShapedText(long impl_ptr)
Public Methods
long __GetHandle()
void close()
Frees the native memory of the object.
void destroy()
Frees the native memory of the object.
int getFailureReason()
In the case where GetShapingStatus() returns something other than FullShaping, this method will return a more detailed reason behind the failure.
int getGlyph(int index)
Get the glyph ID at the indicated place in the shaped sequence.
double getGlyphXPos(int index)
The X position of the glyph at the requested index.
double getGlyphYPos(int index)
The Y position of the glyph at the requested index.
int getNumGlyphs()
Number of glyphs present in the shaped text.
double getScale()
Scaling factor of this shaped text relative to the em size.
int getShapingStatus()
Get the state of the shaping operation.
String getText()
The original source text string.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.AutoCloseable

Public Constructors

public ShapedText (long impl_ptr)

Public Methods

public long __GetHandle ()

public void close ()

Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.

public void destroy ()

Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.

public int getFailureReason ()

In the case where GetShapingStatus() returns something other than FullShaping, this method will return a more detailed reason behind the failure.

public int getGlyph (int index)

Get the glyph ID at the indicated place in the shaped sequence. This number is specific to the font file used to generate the shaping results, and does not always have a clean mapping to a particular Unicode codepoint in the original string.

Parameters
index -- the index of the glyph to be retrieved. Must be less than GetNumGlyphs()
Returns
  • returns the glyph ID for the indicated place in the shaped result

public double getGlyphXPos (int index)

The X position of the glyph at the requested index. This number has been scaled by GetScale().

Parameters
index -- the index of the glyph position to be retrieved. Must be less than GetNumGlyphs()
Returns
  • returns the X position for the glyph at the specified index

public double getGlyphYPos (int index)

The Y position of the glyph at the requested index. This number has been scaled by GetScale().

Parameters
index -- the index of the glyph position to be retrieved. Must be less than GetNumGlyphs()
Returns
  • returns the Y position for the glyph at the specified index

public int getNumGlyphs ()

Number of glyphs present in the shaped text. Might be different from the .

Returns
  • returns the number of utf32 codepoints in this shaped text

public double getScale ()

Scaling factor of this shaped text relative to the em size. A scaling factor of 1 means that all units are relative to the em size. PDF scaling is typically 1000 units per em.

Returns
  • returns the scaling factor for the glyph positions

public int getShapingStatus ()

Get the state of the shaping operation. Even if the shaping did not fully succeed, this object can be added to an elementbuilder, and will fallback to placing unshped text. See GetFailureReason() in the case this method returns something other than FullShaping.

public String getText ()

The original source text string.

Returns
  • returns the source text string