Jasper reports 如何在jasper report中使用令人敬畏的字体图标?

Jasper reports 如何在jasper report中使用令人敬畏的字体图标?,jasper-reports,Jasper Reports,我想在我的报告中使用令人敬畏的字体图标,比如带有人名的用户图标。我用Unicode试过,甚至我可以用Unicode打印一些图标,但不是所有的图标 是否可以在报告中加载字体图标?要使用您首先需要的字体下载它并将其作为一个文件包含在内 这就是我对它们的定义 fa-regular-400.ttf为常规,而fa-solid-900.ttf为粗体 现在,您可以开始在文本字段中的报告中使用它们,请注意,它将不在静态文本字段中工作(因为它不会被计算)。要知道正确的unicode签出,单击图标后将显示unic

我想在我的报告中使用令人敬畏的字体图标,比如带有人名的用户图标。我用Unicode试过,甚至我可以用Unicode打印一些图标,但不是所有的图标


是否可以在报告中加载字体图标?

要使用您首先需要的字体下载它并将其作为一个文件包含在内

这就是我对它们的定义

fa-regular-400.ttf
为常规,而
fa-solid-900.ttf
为粗体

现在,您可以开始在文本字段中的报告中使用它们,请注意,它将静态文本字段中工作(因为它不会被计算)。要知道正确的unicode签出,单击图标后将显示unicode

一个带有一些图表的简单示例 jrxml

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="FontAwsome" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="570800da-28d0-4e48-a0f5-806208bd875e">
    <queryString>
        <![CDATA[]]>
    </queryString>
    <title>
        <band height="65" splitType="Stretch">
            <textField>
                <reportElement x="10" y="10" width="300" height="40" uuid="641fe55c-008a-4d90-a7c8-076a03488299"/>
                <textElement>
                    <font fontName="FontAwesome" size="20" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["\uf080 \uf1fe \uf200"]]></textFieldExpression>
            </textField>
        </band>
    </title>
</jasperReport>

您需要将
fontName
设置为与您在字体扩展和注意(免费版)中定义的相同。所有符号均不以常规和纯色(粗体)显示。事实上,在我的例子中,我必须将文本字段设置为粗体,因为符号仅出现在
fa-solid-900.ttf

输出


要使用该字体,首先需要下载该字体并将其作为一种格式

这就是我对它们的定义

fa-regular-400.ttf
为常规,而
fa-solid-900.ttf
为粗体

现在,您可以开始在文本字段中的报告中使用它们,请注意,它将静态文本字段中工作(因为它不会被计算)。要知道正确的unicode签出,单击图标后将显示unicode

一个带有一些图表的简单示例 jrxml

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="FontAwsome" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="570800da-28d0-4e48-a0f5-806208bd875e">
    <queryString>
        <![CDATA[]]>
    </queryString>
    <title>
        <band height="65" splitType="Stretch">
            <textField>
                <reportElement x="10" y="10" width="300" height="40" uuid="641fe55c-008a-4d90-a7c8-076a03488299"/>
                <textElement>
                    <font fontName="FontAwesome" size="20" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["\uf080 \uf1fe \uf200"]]></textFieldExpression>
            </textField>
        </band>
    </title>
</jasperReport>

您需要将
fontName
设置为与您在字体扩展和注意(免费版)中定义的相同。所有符号均不以常规和纯色(粗体)显示。事实上,在我的例子中,我必须将文本字段设置为粗体,因为符号仅出现在
fa-solid-900.ttf

输出