Skip to content

Commit

Permalink
Optimization: Combine adjacent strings for PDF-Operator TJ
Browse files Browse the repository at this point in the history
Adjusted deltaX, deltaY in LayoutProcessor
Test of letters from the supplementary multilingual plane
  • Loading branch information
vk-github18 authored and asturio committed Apr 8, 2024
1 parent a17e0d2 commit 2547228
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions openpdf/src/main/java/com/lowagie/text/pdf/FontDetails.java
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ byte[] convertToBytes(final List<Integer> glyphCodes) {
throw new UnsupportedOperationException("Only supported for True Type Unicode fonts");
}
List<Integer> codePoints = new ArrayList<>();
for (int glyphCode: glyphCodes) {
for (int glyphCode : glyphCodes) {
if (glyphCode == 0xFFFE || glyphCode == 0xFFFF) {
// considered non-glyphs by AWT
return new byte[]{};
Expand All @@ -337,7 +337,7 @@ byte[] convertToBytes(final List<Integer> glyphCodes) {

private static byte[] getBytesFromCodePoints(List<Integer> codePoints) {
int[] codePointsArray = new int[codePoints.size()];
for (int i=0; i< codePoints.size(); i++) {
for (int i = 0; i < codePoints.size(); i++) {
codePointsArray[i] = codePoints.get(i);
}
String s = new String(codePointsArray, 0, codePointsArray.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2760,7 +2760,7 @@ public void showText(PdfGlyphArray glyphs) {
throw new NullPointerException(
MessageLocalization.getComposedMessage("font.and.size.must.be.set.before.writing.any.text"));
}
if(glyphs.isEmpty()) {
if (glyphs.isEmpty()) {
return;
}
content.append("[");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
*/
public class PdfGlyphArray {

public static class GlyphSubList extends ArrayList<Integer>{}
private final LinkedList<Object> list = new LinkedList<>();

public void add(float displacement) {
Expand Down Expand Up @@ -79,4 +78,8 @@ public void clear() {
public boolean isEmpty() {
return list.isEmpty();
}

public static class GlyphSubList extends ArrayList<Integer> {

}
}

0 comments on commit 2547228

Please sign in to comment.