From 9c1af33023d080ffa7c0135674af924bded32642 Mon Sep 17 00:00:00 2001 From: "Hugh.C" Date: Tue, 16 Jun 2020 18:01:47 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-33780=20font-weight=E7=AD=89=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E4=B8=8E=E7=AD=89=E6=A0=87=E7=AD=BE=E4=B9=8B?= =?UTF-8?q?=E9=97=B4=E7=9A=84=E4=BC=98=E5=85=88=E7=BA=A7=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../text/html/simpleparser/FactoryProperties.java | 14 ++++++++++++-- .../lowagie/text/html/simpleparser/HTMLWorker.java | 8 ++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java index 28deb3e61..39b06af14 100644 --- a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java +++ b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java @@ -462,20 +462,30 @@ public class FactoryProperties { dealWithFontSizeOrTextIndent(h, cprops, prop, key); } else if (key.equals(Markup.CSS_KEY_FONTSTYLE)) { String ss = prop.getProperty(key).trim().toLowerCase(); - if (ss.equals("italic") || ss.equals("oblique")) + if (ss.equals("italic") || ss.equals("oblique")) { h.put("i", null); + } else { + h.remove("i"); + } } else if (key.equals(Markup.CSS_KEY_FONTWEIGHT)) { String ss = prop.getProperty(key).trim().toLowerCase(); if (ss.equals("bold") || ss.equals("700") || ss.equals("800") - || ss.equals("900")) + || ss.equals("900")){ h.put("b", null); + }else { + h.remove("b"); + } } else if (key.equals(Markup.CSS_KEY_TEXTDECORATION)) { String ss = prop.getProperty(key).trim().toLowerCase(); if (ss.equals(Markup.CSS_VALUE_UNDERLINE)) { + h.remove("s"); h.put("u", null); } else if (ss.equals(Markup.CSS_VALUE_LINETHROUGH)) { + h.remove("u"); h.put("s", null); } else { + h.remove("u"); + h.remove("s"); h.put(key, ss); } } else if (key.equals(Markup.CSS_KEY_COLOR)) { diff --git a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java index 18f5b59eb..a1a9da464 100644 --- a/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java +++ b/fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java @@ -215,12 +215,15 @@ public class HTMLWorker implements SimpleXMLDocHandler, DocListener { h.put(Markup.CSS_KEY_MARGINTOP, "16px"); h.put(Markup.CSS_KEY_MARGINBOTTOM, "16px"); } + if (tag.equals("th")) { + h.put("b", null); + } String follow = (String) FactoryProperties.followTags.get(tag); if (follow != null) { HashMap prop = new HashMap(); prop.put(follow, null); - FactoryProperties.insertStyle(h, this.cprops); prop.putAll(h); + FactoryProperties.insertStyle(prop, this.cprops); cprops.addToChain(follow, prop); return; } @@ -491,9 +494,6 @@ public class HTMLWorker implements SimpleXMLDocHandler, DocListener { endElement(tag); skipText = false; pendingTD = true; - if (tag.equals("th")) { - h.put("b", null); - } cprops.addToChain("td", h); stack.push(new IncCell(tag, cprops)); return;