Arial font required in PDF (BIRT pdf renderer, Linux)

后端 未结 5 1711
北海茫月
北海茫月 2021-01-12 15:16

I\'ve created a rptdesign file using BIRT IDE. This file contents are in Arial font, when I export the report to PDF in windows it works fine.

I uses the default vie

相关标签:
5条回答
  • 2021-01-12 15:54

    I spent hours searching for this:

    export BIRT_FONT_PATH=/usr/share/fonts/truetype
    

    Execute this and done!

    0 讨论(0)
  • 2021-01-12 15:55

    Here is my fontsConfig_pdf.xml file

    <font>
    <font-aliases>
        <mapping name="sans-serif" font-family="Arial" />
        <mapping name="serif" font-family="Times-Roman" />
        <mapping name="monospace" font-family="Courier" />
    </font-aliases>
    <font-encodings>
        <encoding font-family="Times-Roman" encoding="Cp1252" />
        <encoding font-family="Helvetica" encoding="Cp1252" />
        <encoding font-family="Courier" encoding="Cp1252" />
        <encoding font-family="Zapfdingbats" encoding="Cp1252" />
        <encoding font-family="Symbol" encoding="Cp1252" />
        <encoding font-family="STSong-Light" encoding="UniGB-UCS2-H" />
        <encoding font-family="STSongStd-Light" encoding="UniGB-UCS2-H" />
        <encoding font-family="MHei-Medium" encoding="UniCNS-UCS2-H" />
        <encoding font-family="MSung-Light" encoding="UniCNS-UCS2-H" />
        <encoding font-family="MSungStd-Light" encoding="UniCNS-UCS2-H" />
        <encoding font-family="HeiseiMin-W3" encoding="UniJIS-UCS2-H" />
        <encoding font-family="HeiseiKakuGo-W5" encoding="UniJIS-UCS2-H" />
        <encoding font-family="KozMinPro-Regular" encoding="UniJIS-UCS2-H" />
        <encoding font-family="HYGoThic-Medium" encoding="UniKS-UCS2-H" />
        <encoding font-family="HYSMyeongJo-Medium" encoding="UniKS-UCS2-H" />
        <encoding font-family="HYSMyeongJoStd" encoding="UniKS-UCS2-H" />
    </font-encodings>
    <font-paths>
            <path path="/var/fonts/truetype"/>
    </font-paths>
    <composite-font name="all-fonts">
        <font font-family="Times-Roman" catalog="Western" />
        <font font-family="MSung-Light" catalog="Chinese" />
        <font font-family="HeiseiKakuGo-W5" catalog="Japanese" />
        <font font-family="HYGoThic-Medium" catalog="Korean" />
    </composite-font>
    </font>
    
    0 讨论(0)
  • 2021-01-12 15:58

    Then I copied the Arial.ttf file to /var/font/truetype

    Arial.ttf only contains the plain version of the font. For bold, italic and italic-bold there are different files (arialbd.ttf etc). Just copy these, too.

    0 讨论(0)
  • 2021-01-12 16:08

    Can any one tell me if there is any issue with Arial font in linux, if the characters are set as bold

    Everything works fine for us. Below is my patch for fontsConfig.xml:

    <font-aliases>
        <mapping name="sans-serif" font-family="Arial" />
        ...
    </font-aliases>
    <font-paths>
        <path path="fonts"/>
    </font-paths>
    

    Put in fonts folder arial.ttf and arial.xml files.

    0 讨论(0)
  • 2021-01-12 16:15

    Try explicitly stating your path to the font like this:

    <font-paths>
       <path path="/var/font/truetype/arial.ttf" />
    </font-paths>
    

    Setting this property (font-paths) cause the default fonts directory to be ignored in favor of only the paths in this set. This will make Arial the only available font for your PDF. To include the default fonts (TNR, Courier, etc...) add the default path (org.eclipse.birt.report.engine.fonts) under the eclipse plug-ins to you font-paths entries as well.

    You can also choose to just add Arial.ttf to the default directory and REMOVE ALL ENTRIES from font-paths and pick up the Arial type that way. Either way should work.

    Good Luck.

    0 讨论(0)
提交回复
热议问题