如何在输出PDF中更改嵌入MathML的字体样式?

时间:2017-04-07 12:10:19

标签: apache-fop mathml

我是Apache FOP的新手,我需要将FOP的PDF输出中的默认字体样式更改为时间字体

我的fop.xconf

    <fop version="1.0"> 
    <renderers>
       <renderer mime="application/pdf">
            <fonts>

                <font embed-url="file:///C:/Windows/Fonts/Times New Roman/times.ttf" name="Times New Roman">
                    <font-triplet name="Times New Roman" style="roman" weight="normal"/>
                </font>

                <font embed-url="file:///C:/Windows/Fonts/Times New Roman/timesbd.ttf" name="Times New Roman">
                    <font-triplet name="Times New Roman" style="normal" weight="bold"/>
                </font>

                <font embed-url="file:///C:/Windows/Fonts/Times New Roman/timesi.ttf" name="Times New Roman">
                    <font-triplet name="Times New Roman" style="italic" weight="normal"/>
                </font>

                <font embed-url="file:///C:/Windows/Fonts/Times New Roman/timesbi.ttf" name="Times New Roman">
                    <font-triplet name="Times New Roman" style="italic" weight="bold"/>
                </font>

            </fonts>
       </renderer>
    </renderers>
    </fop>

我要测试的FO文件:

<?xml version="1.0" encoding="iso-8859-1"?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns="http://www.w3.org/1998/Math/MathML">
    <fo:layout-master-set>
        <fo:simple-page-master master-name="my-page">
            <fo:region-body margin="1in"/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="my-page">
        <fo:flow flow-name="xsl-region-body">
            <fo:wrapper>
            <fo:block font-family="Times New Roman">
                <fo:instream-foreign-object>
                    <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline">
                        <msub>
                            <mi>σ</mi>
                            <mrow>
                                <mi>z</mi>
                            </mrow>
                        </msub>
                        <mo>=</mo>
                        <munder>
                            <mrow>
                                <munder>
                                    <mrow>
                                        <mi mathvariant="normal">l</mi>
                                        <mi mathvariant="normal">i</mi>
                                        <mi mathvariant="normal">m</mi>
                                    </mrow>
                                    <mrow/>
                                </munder>
                            </mrow>
                            <mrow>
                                <mo>Δ</mo>
                                <mi>A</mi>
                                <mo rspace="0.25pt" lspace="0.25pt">→</mo>
                                <mn>0</mn>
                            </mrow>
                        </munder>
                        <mspace width="0.33em"/>
                        <mfrac>
                            <mrow>
                                <mo>Δ</mo>
                                <msub>
                                    <mi>F</mi>
                                    <mrow>
                                        <mi>z</mi>
                                    </mrow>
                                </msub>
                            </mrow>
                            <mrow>
                                <mo>Δ</mo>
                                <mi>A</mi>
                            </mrow>
                        </mfrac>
                    </math>
                </fo:instream-foreign-object>
            </fo:block>
            </fo:wrapper>
        </fo:flow>
    </fo:page-sequence>
</fo:root>

所以这些是我用来以Times New Roman字体输出PDF的文件,但输出中的字体没有变化.pdf

请建议任何方法来完成此任务

我在命令行中运行的代码是:fop -fo test.fo -c fop.xconf -pdf 1233.pdf

0 个答案:

没有答案