/** * Provides detail useful if a listener needs access to the position of each individual glyph in the text render operation * @return A list of {@link TextRenderInfo} objects that represent each glyph used in the draw operation. The next effect is if there was a separate Tj opertion for each character in the rendered string * @since 5.3.3 */ public List<TextRenderInfo> getCharacterRenderInfos(){ List<TextRenderInfo> rslt = new ArrayList<TextRenderInfo>(string.length()); PdfString[] strings = splitString(string); float totalWidth = 0; for (int i = 0; i < strings.length; i++) { float[] widthAndWordSpacing = getWidthAndWordSpacing(strings[i], true); TextRenderInfo subInfo = new TextRenderInfo(this, strings[i], totalWidth); rslt.add(subInfo); totalWidth += (widthAndWordSpacing[0] * gs.fontSize + gs.characterSpacing + widthAndWordSpacing[1]) * gs.horizontalScaling; } for (TextRenderInfo tri : rslt) tri.getUnscaledWidth(); return rslt; }
/** * Provides detail useful if a listener needs access to the position of each individual glyph in the text render operation * @return A list of {@link TextRenderInfo} objects that represent each glyph used in the draw operation. The next effect is if there was a separate Tj opertion for each character in the rendered string * @since 5.3.3 */ public List<TextRenderInfo> getCharacterRenderInfos(){ List<TextRenderInfo> rslt = new ArrayList<TextRenderInfo>(string.length()); PdfString[] strings = splitString(string); float totalWidth = 0; for (int i = 0; i < strings.length; i++) { float[] widthAndWordSpacing = getWidthAndWordSpacing(strings[i], true); TextRenderInfo subInfo = new TextRenderInfo(this, strings[i], totalWidth); rslt.add(subInfo); totalWidth += (widthAndWordSpacing[0] * gs.fontSize + gs.characterSpacing + widthAndWordSpacing[1]) * gs.horizontalScaling; } for (TextRenderInfo tri : rslt) tri.getUnscaledWidth(); return rslt; }