new ShapedText()
The class ShapedText.
A sequence of positioned glyphs -- the visual representation of a
given text string
Extends
Members
-
<static> FailureReason
-
Properties:
Name Type Description e_NoFailure
number e_UnsupportedFontType
number e_NotIndexEncoded
number e_FontDataNotFound
number -
<static> ShapingStatus
-
Properties:
Name Type Description e_FullShaping
number e_PartialShaping
number e_NoShaping
number
Methods
-
destroy()
-
Destructor
- Inherited From:
Returns:
- Type
- Promise.<void>
-
getFailureReason()
-
In the case where GetShapingStatus() returns something other than FullShaping, this method will return a more detailed reason behind the failure.
Returns:
A promise that resolves to .- Type
- Promise.<number>
Example
Return value enum: <pre> PDFNet.ShapedText.FailureReason = { e_NoFailure : 0 e_UnsupportedFontType : 1 e_NotIndexEncoded : 2 e_FontDataNotFound : 3 } </pre>
-
getGlyph(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:
Name Type Description index
number - the index of the glyph to be retrieved. Must be less than GetNumGlyphs(). Returns:
A promise that resolves to returns the glyph ID for the indicated place in the shaped result.- Type
- Promise.<number>
-
getGlyphXPos(index)
-
The X position of the glyph at the requested index. This number has been scaled by GetScale().
Parameters:
Name Type Description index
number - the index of the glyph position to be retrieved. Must be less than GetNumGlyphs(). Returns:
A promise that resolves to returns the X position for the glyph at the specified index.- Type
- Promise.<number>
-
getGlyphYPos(index)
-
The Y position of the glyph at the requested index. This number has been scaled by GetScale().
Parameters:
Name Type Description index
number - the index of the glyph position to be retrieved. Must be less than GetNumGlyphs(). Returns:
A promise that resolves to returns the Y position for the glyph at the specified index.- Type
- Promise.<number>
-
getNumGlyphs()
-
Number of glyphs present in the shaped text. Might be different from the .
Returns:
A promise that resolves to returns the number of utf32 codepoints in this shaped text.- Type
- Promise.<number>
-
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:
A promise that resolves to returns the scaling factor for the glyph positions.- Type
- Promise.<number>
-
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.
Returns:
A promise that resolves to .- Type
- Promise.<number>
Example
Return value enum: <pre> PDFNet.ShapedText.ShapingStatus = { e_FullShaping : 0 e_PartialShaping : 1 e_NoShaping : 2 } </pre>
-
getText()
-
The original source text string.
Returns:
A promise that resolves to returns the source text string.- Type
- Promise.<string>
-
takeOwnership()
-
Take the ownership of this object, so that PDFNet.runWithCleanup won't destroy this object.
- Inherited From:
Returns:
- Type
- void