简体   繁体   中英

BIRT PDF UTF-8 encoding

I have some trouble with BIRT 4.3.1, I want to create some PDF with BIRT . This works all fine, but I have some problems with the encoding of my font.

For my font I am using Arial Narrow. This isn't a standard font which BIRT support. So I know that I must edit the fontsConfig_pdf.xml file in the JAR org.eclipse.birt.runtime_4.3.1.v20130918-1142.jar file. Here look at my config file:

<?xml version="1.0" encoding="UTF-8"?>
<font>
    <composite-font name="all-fonts" font-family="Arial Narrow">
    </composite-font>
    <!-- define used Fonts -->
    <font-paths>
        <path path="/etc/fonts/ARIALN.TTF" />
    </font-paths>

    <!-- Encoding -->
    <font-encodings>
        <encoding font-family="Arial Narrow" encoding="UTF-8" />
    </font-encodings>     
</font>

I have put my font TTF file inside the location. All works fine, but the encoding is wrong for special signs.

Some hint to you, the encoding works well in my Windows-Machine but on my Linux-System it doesn't work. Maybe someone could give me a tip.

As the comment in the default fontsConfig.xml file says, usually you don't have to add an entry to the <font-encodings> element at all. However, for Linux and the Tahoma font (which I think is comparable to your case), I had to add

 <encoding font-family="Tahoma" encoding="Cp1252" />

AFAIK the encoding attribute tells BIRT how the glyphs are mapped to numbers inside the font file, I think. So UTF-8 definitely cannot be correct. I guess that on Windows it works anyway because the encoding attribute isn't considered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM