You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2019/03/17 10:33:01 UTC
svn commit: r1855688 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java
Author: tilman
Date: Sun Mar 17 10:33:01 2019
New Revision: 1855688
URL: http://svn.apache.org/viewvc?rev=1855688&view=rev
Log:
PDFBOX-4480: if ascent and descent are not 0, and if either the height is 0 or the height is larger than (ascent - descent) / 2, then use that one
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java?rev=1855688&r1=1855687&r2=1855688&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/LegacyPDFStreamEngine.java Sun Mar 17 10:33:01 2019
@@ -180,6 +180,14 @@ class LegacyPDFStreamEngine extends PDFS
{
glyphHeight = capHeight;
}
+ // PDFBOX-3464, PDFBOX-448:
+ // sometimes even CapHeight has very high value, but Ascent and Descent are ok
+ float ascent = fontDescriptor.getAscent();
+ float descent = fontDescriptor.getDescent();
+ if (ascent > 0 && descent < 0 && ((ascent - descent) / 2 < glyphHeight || glyphHeight == 0))
+ {
+ glyphHeight = (ascent - descent) / 2;
+ }
}
// transformPoint from glyph space -> text space