*/
public static HTMLDocument createHtmlDocumentObject(
Map<String, Object> style, double scale)
{
// Applies the font settings
HTMLDocument document = new HTMLDocument();
StringBuffer rule = new StringBuffer("body {");
rule.append(" font-family: "
+ getString(style, mxConstants.STYLE_FONTFAMILY,
mxConstants.DEFAULT_FONTFAMILIES) + " ; ");
rule.append(" font-size: "
+ (int) (getInt(style, mxConstants.STYLE_FONTSIZE,
mxConstants.DEFAULT_FONTSIZE) * scale) + " pt ;");
String color = mxUtils.getString(style, mxConstants.STYLE_FONTCOLOR);
if (color != null)
{
rule.append("color: " + color + " ; ");
}
int fontStyle = mxUtils.getInt(style, mxConstants.STYLE_FONTSTYLE);
if ((fontStyle & mxConstants.FONT_BOLD) == mxConstants.FONT_BOLD)
{
rule.append(" font-weight: bold ; ");
}
if ((fontStyle & mxConstants.FONT_ITALIC) == mxConstants.FONT_ITALIC)
{
rule.append(" font-style: italic ; ");
}
if ((fontStyle & mxConstants.FONT_UNDERLINE) == mxConstants.FONT_UNDERLINE)
{
rule.append(" text-decoration: underline ; ");
}
String align = getString(style, mxConstants.STYLE_ALIGN,
mxConstants.ALIGN_LEFT);
if (align.equals(mxConstants.ALIGN_CENTER))
{
rule.append(" text-align: center ; ");
}
else if (align.equals(mxConstants.ALIGN_RIGHT))
{
rule.append(" text-align: right ; ");
}
rule.append(" } ");
document.getStyleSheet().addRule(rule.toString());
return document;
}