Browse Source

Pull request #472: REPORT-33780 font-weight等属性与<b>等标签之间的优先级存在问题

Merge in CORE/base-third from ~HUGH.C/base-third:release/10.0 to release/10.0

* commit '9c1af33023d080ffa7c0135674af924bded32642':
  REPORT-33780 font-weight等属性与<b>等标签之间的优先级存在问题
release/10.0
Hugh.C 4 years ago
parent
commit
d10ffdc352
  1. 14
      fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/FactoryProperties.java
  2. 8
      fine-itext/src/main/java/com/fr/third/v2/lowagie/text/html/simpleparser/HTMLWorker.java

14
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)) {

8
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;

Loading…
Cancel
Save