TextPosition.java (pdfbox-2.0.23-src) | : | TextPosition.java (pdfbox-2.0.24-src) | ||
---|---|---|---|---|
skipping to change at line 94 | skipping to change at line 94 | |||
public TextPosition(int pageRotation, float pageWidth, float pageHeight, Mat rix textMatrix, | public TextPosition(int pageRotation, float pageWidth, float pageHeight, Mat rix textMatrix, | |||
float endX, float endY, float maxHeight, float individua lWidth, | float endX, float endY, float maxHeight, float individua lWidth, | |||
float spaceWidth, String unicode, int[] charCodes, PDFon t font, | float spaceWidth, String unicode, int[] charCodes, PDFon t font, | |||
float fontSize, int fontSizeInPt) | float fontSize, int fontSizeInPt) | |||
{ | { | |||
this.textMatrix = textMatrix; | this.textMatrix = textMatrix; | |||
this.endX = endX; | this.endX = endX; | |||
this.endY = endY; | this.endY = endY; | |||
int rotationAngle = pageRotation; | this.rotation = pageRotation; | |||
this.rotation = rotationAngle; | ||||
this.maxHeight = maxHeight; | this.maxHeight = maxHeight; | |||
this.pageHeight = pageHeight; | this.pageHeight = pageHeight; | |||
this.pageWidth = pageWidth; | this.pageWidth = pageWidth; | |||
this.widths = new float[] { individualWidth }; | this.widths = new float[] { individualWidth }; | |||
this.widthOfSpace = spaceWidth; | this.widthOfSpace = spaceWidth; | |||
this.unicode = unicode; | this.unicode = unicode; | |||
this.charCodes = charCodes; | this.charCodes = charCodes; | |||
this.font = font; | this.font = font; | |||
this.fontSize = fontSize; | this.fontSize = fontSize; | |||
this.fontSizePt = fontSizeInPt; | this.fontSizePt = fontSizeInPt; | |||
x = getXRot(rotationAngle); | x = getXRot(rotation); | |||
if (rotationAngle == 0 || rotationAngle == 180) | if (rotation == 0 || rotation == 180) | |||
{ | { | |||
y = this.pageHeight - getYLowerLeftRot(rotationAngle); | y = this.pageHeight - getYLowerLeftRot(rotation); | |||
} | } | |||
else | else | |||
{ | { | |||
y = this.pageWidth - getYLowerLeftRot(rotationAngle); | y = this.pageWidth - getYLowerLeftRot(rotation); | |||
} | } | |||
} | } | |||
// Adds non-decomposing diacritics to the hash with their related combining character. | // Adds non-decomposing diacritics to the hash with their related combining character. | |||
// These are values that the unicode spec claims are equivalent but are not mapped in the form | // These are values that the unicode spec claims are equivalent but are not mapped in the form | |||
// NFKC normalization method. Determined by going through the Combining Diac ritical Marks | // NFKC normalization method. Determined by going through the Combining Diac ritical Marks | |||
// section of the Unicode spec and identifying which characters are not map ped to by the | // section of the Unicode spec and identifying which characters are not map ped to by the | |||
// normalization. | // normalization. | |||
private static Map<Integer, String> createDiacritics() | private static Map<Integer, String> createDiacritics() | |||
{ | { | |||
skipping to change at line 671 | skipping to change at line 670 | |||
/** | /** | |||
* Inserts the diacritic TextPosition to the str of this TextPosition and up dates the widths | * Inserts the diacritic TextPosition to the str of this TextPosition and up dates the widths | |||
* array to include the extra character width. | * array to include the extra character width. | |||
* | * | |||
* @param i current character | * @param i current character | |||
* @param diacritic The diacritic TextPosition | * @param diacritic The diacritic TextPosition | |||
*/ | */ | |||
private void insertDiacritic(int i, TextPosition diacritic) | private void insertDiacritic(int i, TextPosition diacritic) | |||
{ | { | |||
StringBuilder sb = new StringBuilder(); | StringBuilder sb = new StringBuilder(); | |||
sb.append(unicode.substring(0, i)); | sb.append(unicode, 0, i); | |||
float[] widths2 = new float[widths.length + 1]; | float[] widths2 = new float[widths.length + 1]; | |||
System.arraycopy(widths, 0, widths2, 0, i); | System.arraycopy(widths, 0, widths2, 0, i); | |||
// Unicode combining diacritics always go after the base character, rega rdless of whether | // Unicode combining diacritics always go after the base character, rega rdless of whether | |||
// the string is in presentation order or logical order | // the string is in presentation order or logical order | |||
sb.append(unicode.charAt(i)); | sb.append(unicode.charAt(i)); | |||
widths2[i] = widths[i]; | widths2[i] = widths[i]; | |||
sb.append(combineDiacritic(diacritic.getUnicode())); | sb.append(combineDiacritic(diacritic.getUnicode())); | |||
widths2[i + 1] = 0; | widths2[i + 1] = 0; | |||
// get the rest of the string | // get the rest of the string | |||
sb.append(unicode.substring(i + 1, unicode.length())); | sb.append(unicode.substring(i + 1)); | |||
System.arraycopy(widths, i + 1, widths2, i + 2, widths.length - i - 1); | System.arraycopy(widths, i + 1, widths2, i + 2, widths.length - i - 1); | |||
unicode = sb.toString(); | unicode = sb.toString(); | |||
widths = widths2; | widths = widths2; | |||
} | } | |||
/** | /** | |||
* Combine the diacritic, for example, convert non-combining diacritic chara cters to their | * Combine the diacritic, for example, convert non-combining diacritic chara cters to their | |||
* combining counterparts. | * combining counterparts. | |||
* | * | |||
End of changes. 6 change blocks. | ||||
8 lines changed or deleted | 7 lines changed or added |