From 97ae4e60713a2a2bbeb98c3f9b1f9fc05f9c07e4 Mon Sep 17 00:00:00 2001 From: magnww Date: Fri, 18 Aug 2023 23:53:35 +0800 Subject: [PATCH] Fix the problem that getHeight() is smaller than the actual value `+ getLeading()` was removed in this commit: https://github.com/apache/poi/commit/5a18307eb051603509c8b8147f4dfdf0e8fe56b2#diff-4cd687c3da36fff3b21d074a27f7bac176c2845b43d37eca3af37fb920baf32cL73 I can't find a reason for the removal. Due to the lack of leading height, the height obtained by this method is much smaller than the actual height (Test with Chinese characters). --- poi/src/main/java/org/apache/poi/sl/draw/DrawTextFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poi/src/main/java/org/apache/poi/sl/draw/DrawTextFragment.java b/poi/src/main/java/org/apache/poi/sl/draw/DrawTextFragment.java index e0e3bfe7d5c..e89b8c779a6 100644 --- a/poi/src/main/java/org/apache/poi/sl/draw/DrawTextFragment.java +++ b/poi/src/main/java/org/apache/poi/sl/draw/DrawTextFragment.java @@ -89,7 +89,7 @@ public AttributedString getAttributedString() { * @return full height of this text run which is sum of ascent, descent and leading */ public float getHeight(){ - double h = layout.getAscent() + layout.getDescent(); + double h = layout.getAscent() + layout.getDescent() + getLeading(); return (float)h; }