JaroslavTulach commented on code in PR #909:
URL: https://github.com/apache/poi/pull/909#discussion_r2389874483
##########
poi/src/main/java/org/apache/poi/ss/util/SheetUtil.java:
##########
@@ -456,22 +481,16 @@ private static double getColumnWidthForRow(
public static boolean canComputeColumnWidth(Font font) {
// not sure what is the best value sample-here, only "1" did not work
on some platforms...
AttributedString str = new AttributedString("1w");
- copyAttributes(font, str, 0, "1w".length());
-
- TextLayout layout = new TextLayout(str.getIterator(),
fontRenderContext);
- return (layout.getBounds().getWidth() > 0);
+ try {
+ return WithJavaDesktop.canComputeColumnWidth(font, str);
+ } catch (Throwable t) {
+ if (shouldIgnoreMissingFontSystem(t)) {
+ return false;
+ }
+ throw t;
+ }
}
- /**
- * Copy text attributes from the supplied Font to Java2D AttributedString
- */
- private static void copyAttributes(Font font, AttributedString str,
@SuppressWarnings("SameParameterValue") int startIdx, int endIdx) {
Review Comment:
This is the original version of `copyAttributes` that have been [move to
innerclass](https://github.com/apache/poi/pull/909/files#r2388939736)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]