|
|
|
@ -86,7 +86,6 @@ public class FactoryProperties {
|
|
|
|
|
|
|
|
|
|
public Chunk createChunk(String text, ChainedProperties props) { |
|
|
|
|
Font font = getFont(props); |
|
|
|
|
dealHyperlinkfont( font, props); |
|
|
|
|
float size = font.getSize(); |
|
|
|
|
size /= 3; |
|
|
|
|
Chunk ck = new Chunk(text, font); |
|
|
|
@ -107,31 +106,6 @@ public class FactoryProperties {
|
|
|
|
|
return ck; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 处理超链接的字体颜色和下划线 |
|
|
|
|
* |
|
|
|
|
* @param font |
|
|
|
|
* @param props |
|
|
|
|
*/ |
|
|
|
|
private static void dealHyperlinkfont(Font font, ChainedProperties props) { |
|
|
|
|
String tagName = props.getLastTag(); |
|
|
|
|
if (null == tagName || tagName.equals("") || !tagName.equals(HtmlTags.ANCHOR)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
int style = font.getStyle(); |
|
|
|
|
if (props.hasKvInLastChain(CSS.Property.TEXT_DECORATION, CSS.Value.NONE)) { |
|
|
|
|
//含有 text-decoration 属性,且值为 none时,将下划线属性去掉
|
|
|
|
|
font.setStyle(style & (~Font.UNDERLINE)); |
|
|
|
|
} else { |
|
|
|
|
//默认是有需要有下划线的
|
|
|
|
|
font.setStyle(style | Font.UNDERLINE); |
|
|
|
|
} |
|
|
|
|
//没有指定颜色 or 是继承的颜色(<a>标签不需要继承颜色,只使用自身的颜色)时,使用默认的蓝色(超链接)
|
|
|
|
|
if (null == font.getColor() || (!font.getColor().equals(Color.BLUE) && null == props.getLastChainProperty(CSS.Property.COLOR))) { |
|
|
|
|
font.setColor(Color.BLUE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void setParagraphLeading(Paragraph p, String leading) { |
|
|
|
|
if (leading == null) { |
|
|
|
|
p.setLeading(0, 1.5f); |
|
|
|
|