aboutsummaryrefslogtreecommitdiffstats
path: root/src/scratchpad
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2020-11-08 21:30:54 +0000
committerAndreas Beeker <kiwiwings@apache.org>2020-11-08 21:30:54 +0000
commit1d3ef4d81bcf5542ba4d2bb38fb0bb5c404b62f9 (patch)
tree0ed6a1e4eeac97c0558cc10530041e8b47efa5ac /src/scratchpad
parent578b71b127aa2da6f0f051973342790804aa705f (diff)
downloadpoi-1d3ef4d81bcf5542ba4d2bb38fb0bb5c404b62f9.tar.gz
poi-1d3ef4d81bcf5542ba4d2bb38fb0bb5c404b62f9.zip
#64867 - Provide PDF rendering with PPTX2PNG
render text as text, i.e. not as shapes git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1883212 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad')
-rw-r--r--src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java17
-rw-r--r--src/scratchpad/testcases/commons-logging.properties17
-rw-r--r--src/scratchpad/testcases/log4j.properties4
3 files changed, 31 insertions, 7 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java b/src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java
index b849a55bfb..48790f8e0a 100644
--- a/src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java
+++ b/src/scratchpad/src/org/apache/poi/hwmf/draw/HwmfGraphics.java
@@ -575,16 +575,18 @@ public class HwmfGraphics implements HwmfCharsetAware {
}
private void addAttributes(BiConsumer<TextAttribute,Object> attributes, HwmfFont font, String typeface) {
- attributes.accept(TextAttribute.FAMILY, typeface);
- attributes.accept(TextAttribute.SIZE, getFontHeight(font));
+ Map<TextAttribute,Object> att = new HashMap<>();
+ att.put(TextAttribute.FAMILY, typeface);
+ att.put(TextAttribute.SIZE, getFontHeight(font));
+
if (font.isStrikeOut()) {
- attributes.accept(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON);
+ att.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON);
}
if (font.isUnderline()) {
- attributes.accept(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
+ att.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
}
if (font.isItalic()) {
- attributes.accept(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
+ att.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
}
// convert font weight to awt font weight - usually a font weight of 400 is regarded as regular
final int fw = font.getWeight();
@@ -595,7 +597,10 @@ public class HwmfGraphics implements HwmfCharsetAware {
break;
}
}
- attributes.accept(TextAttribute.WEIGHT, awtFW);
+ att.put(TextAttribute.WEIGHT, awtFW);
+ att.put(TextAttribute.FONT, new Font(att));
+
+ att.forEach(attributes);
}
private double getFontHeight(HwmfFont font) {
diff --git a/src/scratchpad/testcases/commons-logging.properties b/src/scratchpad/testcases/commons-logging.properties
new file mode 100644
index 0000000000..3b4d40d05e
--- /dev/null
+++ b/src/scratchpad/testcases/commons-logging.properties
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
+log4j.configuration=log4j.properties \ No newline at end of file
diff --git a/src/scratchpad/testcases/log4j.properties b/src/scratchpad/testcases/log4j.properties
index ac2be68500..23d316d79c 100644
--- a/src/scratchpad/testcases/log4j.properties
+++ b/src/scratchpad/testcases/log4j.properties
@@ -18,4 +18,6 @@ log4j.rootLogger=ALL,CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.target=System.out
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{dd.MM HH:mm:ss} %-30.30c %5p %m%n
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %c %5p %m%n
+
+log4j.logger.org.apache.fontbox.ttf=INFO