aboutsummaryrefslogtreecommitdiffstats
path: root/poi/src/main
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2023-06-08 08:53:15 +0000
committerDominik Stadler <centic@apache.org>2023-06-08 08:53:15 +0000
commit6442dccab931efa6c29a5c40fb74a427e67bfcb2 (patch)
treeacf72ef0205234f0b27ae4ab5122a200afee9dc0 /poi/src/main
parentd3e35e740a593027a1105e6509c0aadaa54399b0 (diff)
downloadpoi-6442dccab931efa6c29a5c40fb74a427e67bfcb2.tar.gz
poi-6442dccab931efa6c29a5c40fb74a427e67bfcb2.zip
Bug 66632: Round char-width instead of cutting off
Otherwise we sometimes use a too low "default char width" which leads to autosizing of columns with too wide columns. We should propably return float instead of int here to not introduce rounding errors at this point at all, but it would need more API changes, so let's at least make it work better for now. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1910301 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/src/main')
-rw-r--r--poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java b/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java
index 62d4cab315..2ced5742b7 100644
--- a/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java
+++ b/poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java
@@ -299,7 +299,7 @@ public class SheetUtil {
copyAttributes(defaultFont, str, 0, 1);
try {
TextLayout layout = new TextLayout(str.getIterator(), fontRenderContext);
- return (int) layout.getAdvance();
+ return Math.round(layout.getAdvance());
} catch (UnsatisfiedLinkError | NoClassDefFoundError | InternalError e) {
if (ignoreMissingFontSystem) {
return DEFAULT_CHAR_WIDTH;