Author: tilman
Date: Sat Jul 4 12:57:17 2026
New Revision: 1935879
Log:
PDFBOX-4951: remove check for adjustment, is almost always true
Modified:
pdfbox/trunk/pdfbox-layout-awt/src/main/java/org/apache/pdfbox/glyphlayout/GlyphLayoutProcessorAwt.java
Modified:
pdfbox/trunk/pdfbox-layout-awt/src/main/java/org/apache/pdfbox/glyphlayout/GlyphLayoutProcessorAwt.java
==============================================================================
---
pdfbox/trunk/pdfbox-layout-awt/src/main/java/org/apache/pdfbox/glyphlayout/GlyphLayoutProcessorAwt.java
Sat Jul 4 12:45:03 2026 (r1935878)
+++
pdfbox/trunk/pdfbox-layout-awt/src/main/java/org/apache/pdfbox/glyphlayout/GlyphLayoutProcessorAwt.java
Sat Jul 4 12:57:17 2026 (r1935879)
@@ -16,7 +16,6 @@
*/
package org.apache.pdfbox.glyphlayout;
-import static java.awt.font.GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS;
import java.awt.Font;
import java.awt.FontFormatException;
@@ -59,17 +58,6 @@ public class GlyphLayoutProcessorAwt imp
}
/**
- * Checks if the glyphVector contains adjustments that make advanced
layout necessary
- *
- * @param glyphVector glyph vector containing the positions
- * @return true if the glyphVector contains adjustments
- */
- protected static boolean hasAdjustments(GlyphVector glyphVector)
- {
- return (glyphVector.getLayoutFlags() & FLAG_HAS_POSITION_ADJUSTMENTS)
!= 0;
- }
-
- /**
* Checks if glyphs needed for text are missing in awtFont
*
* @param text text to be checked
@@ -279,12 +267,10 @@ public class GlyphLayoutProcessorAwt imp
Objects.requireNonNull(contentStream, "contentStream must be set");
GlyphVector glyphVector = computeGlyphVector(font, fontSize, text,
bidiLevel);
-
- if (!hasAdjustments(glyphVector))
- {
- showGlyphVector(contentStream, glyphVector);
- return;
- }
+
+ // check for adjustment not needed:
+ // glyphVector.getLayoutFlags() & FLAG_HAS_POSITION_ADJUSTMENTS is
always true
+ // because of horizontal adjustments in every string except one
character string
final float delta = 1e-5f;
final float factorX = 1000f / fontSize;
@@ -333,20 +319,4 @@ public class GlyphLayoutProcessorAwt imp
contentStream.showGlyphsWithPositioning(ga);
ga.clear();
}
-
- /**
- * Shows the glyphs for the given glyphVector
- *
- * @param contentStream the content stream
- * @param glyphVector the glyphVector to be shown
- * @throws IOException if an I/O exception occurs
- */
- protected void showGlyphVector(ContentStreamForGlyphLayoutInterface
contentStream, GlyphVector glyphVector) throws IOException
- {
- Objects.requireNonNull(glyphVector, "glyphVector must be set");
- Objects.requireNonNull(contentStream, "contentStream must be set");
-
- int[] glyphCodes = glyphVector.getGlyphCodes(0,
glyphVector.getNumGlyphs(), new int[glyphVector.getNumGlyphs()]);
- contentStream.showGlyphCodes(glyphCodes);
- }
}