|
|
@ -374,14 +374,7 @@ public class FactoryProperties { |
|
|
|
if (key.equals(Markup.CSS_KEY_FONTFAMILY)) { |
|
|
|
if (key.equals(Markup.CSS_KEY_FONTFAMILY)) { |
|
|
|
h.put(ElementTags.FACE, prop.getProperty(key)); |
|
|
|
h.put(ElementTags.FACE, prop.getProperty(key)); |
|
|
|
} else if (key.equals(Markup.CSS_KEY_FONTSIZE)) { |
|
|
|
} else if (key.equals(Markup.CSS_KEY_FONTSIZE)) { |
|
|
|
float actualFontSize = Markup.parseLength(cprops |
|
|
|
dealWithFontSizeOrTextIndent(h, cprops, prop, key); |
|
|
|
.getProperty(ElementTags.SIZE), |
|
|
|
|
|
|
|
Markup.DEFAULT_FONT_SIZE); |
|
|
|
|
|
|
|
if (actualFontSize <= 0f) |
|
|
|
|
|
|
|
actualFontSize = Markup.DEFAULT_FONT_SIZE; |
|
|
|
|
|
|
|
h.put(ElementTags.SIZE, Float.toString(Markup.parseLength(prop |
|
|
|
|
|
|
|
.getProperty(key), actualFontSize)) |
|
|
|
|
|
|
|
+ "pt"); |
|
|
|
|
|
|
|
} else if (key.equals(Markup.CSS_KEY_FONTSTYLE)) { |
|
|
|
} else if (key.equals(Markup.CSS_KEY_FONTSTYLE)) { |
|
|
|
String ss = prop.getProperty(key).trim().toLowerCase(); |
|
|
|
String ss = prop.getProperty(key).trim().toLowerCase(); |
|
|
|
if (ss.equals("italic") || ss.equals("oblique")) |
|
|
|
if (ss.equals("italic") || ss.equals("oblique")) |
|
|
@ -429,14 +422,34 @@ public class FactoryProperties { |
|
|
|
} else if (key.equals(Markup.CSS_KEY_BGCOLOR)) { |
|
|
|
} else if (key.equals(Markup.CSS_KEY_BGCOLOR)) { |
|
|
|
String ss = prop.getProperty(key).trim().toLowerCase(); |
|
|
|
String ss = prop.getProperty(key).trim().toLowerCase(); |
|
|
|
h.put("background", ss); |
|
|
|
h.put("background", ss); |
|
|
|
} |
|
|
|
} else if (key.equals(Markup.CSS_KEY_TEXTINDENT)) { |
|
|
|
else{ |
|
|
|
dealWithFontSizeOrTextIndent(h, cprops, prop, key); |
|
|
|
|
|
|
|
} else { |
|
|
|
String ss = prop.getProperty(key).trim(); |
|
|
|
String ss = prop.getProperty(key).trim(); |
|
|
|
h.put(key, ss); |
|
|
|
h.put(key, ss); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 处理下字号和文本缩进 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param h 当前标签内的属性Map |
|
|
|
|
|
|
|
* @param cprops 一个list , 从左到右保存着父到子标签中的属性 |
|
|
|
|
|
|
|
* @param prop 当前标签内的style 属性Map |
|
|
|
|
|
|
|
* @param key 当前 prop 中的 k |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static void dealWithFontSizeOrTextIndent(HashMap h, ChainedProperties cprops, Properties prop, String key) { |
|
|
|
|
|
|
|
float actualFontSize = Markup.parseLength(cprops |
|
|
|
|
|
|
|
.getProperty(ElementTags.SIZE), |
|
|
|
|
|
|
|
Markup.DEFAULT_FONT_SIZE); |
|
|
|
|
|
|
|
if (actualFontSize <= 0f) |
|
|
|
|
|
|
|
actualFontSize = Markup.DEFAULT_FONT_SIZE; |
|
|
|
|
|
|
|
h.put(key.equals(Markup.CSS_KEY_FONTSIZE) ? ElementTags.SIZE : key, Float.toString(Markup.parseLength(prop |
|
|
|
|
|
|
|
.getProperty(key), actualFontSize)) |
|
|
|
|
|
|
|
+ "pt"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public FontFactoryImp getFontImp() { |
|
|
|
public FontFactoryImp getFontImp() { |
|
|
|
return fontImp; |
|
|
|
return fontImp; |
|
|
|
} |
|
|
|
} |
|
|
|