飞碟字体重量不显示

时间:2013-10-22 10:30:19

标签: java css swing xhtml flying-saucer

我刚刚开始使用Flying Saucer来显示将由我正在创建的解决方案填充的html报告。

基本上,我试图让飞碟的XHTMLPanel显示为粗体,但到目前为止还没有。我尝试过使用<b></b>代码,以及<span class="b"></span>使用.b {font-weight:bold;}和其他几种方法,但到目前为止还没有成功。下面是我正在使用的修剪过的java代码和下面的xhtml。

public class HALReportViewMain extends JFrame {

XHTMLPanel panel;
FSScrollPane scroll;

public HALReportViewMain() throws Exception{    
    panel = new XHTMLPanel();
    scroll = new FSScrollPane(panel);

    panel.setDocument(new File("C:\\Users\\rudi.kershaw\\Desktop\\Report.html"));

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    add(scroll);
    setSize((int)new PageFormat().getImageableWidth(), (int)new PageFormat().getImageableHeight());
    setVisible(true);        
}

public static void main(String[] args) throws Exception {
    HALReportViewMain derp = new HALReportViewMain();
}
}

来自xhtml Report.html的一节;

<html>
<head>
<style type="text/css">
    body {font:10px arial,sans-serif;}
    p {margin-left:5px;}
    .b {font-weight:800;display:inline;margin:0;}
    #address {position:absolute;top:0px;right:5px;text-align:right}
    #picture {position:absolute;top:85px;right:20px;height:120px;width:240px;background-color:#E6E6E6}
    .sitecontactswrapper {display:inline-block;margin:0px 10px;}
    .sitecontacts {margin:0;}
</style>
</head>
<body>
    <div class="sitecontactswrapper">
        <p class="sitecontacts"><span class="b">Description: </span>Example</p>
        <p class="sitecontacts"><span class="b">Full Name/s: </span>Example</p>
        <p class="sitecontacts"><span class="b">Office Phone: </span>Example</p>
        <p class="sitecontacts"><span class="b">Mobile Phone: </span>Example</p>
        <p class="sitecontacts"><span class="b">Email Address: </span>Example</p>
    </div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

似乎Flying Saucer在某些字体变体方面存在问题。我改变了

font:10px arial,sans-serif;

font-size:10px;font-family:"Trebuchet MS";

我已经单独声明了字体大小的事实是无关紧要的。我只是把它分开来进行测试。我检查了其他字体,似乎Arial,Helvetica,sans-serif和其他一些字体在XHTMLPanel中不会变得粗体。为什么这是我不知道的。我将直接向他们报告,以防它是某些描述的错误。