Saturday, February 8, 2014

Setting subversion ignore files for Eclipse project





Eclipse and other IDE has its configuration files that are kept together with the project. This configuration files and directory are hidden and has dot prefix at the root of project directory.
     .setting
     .classpath
     .project

Some framework like a Maven also generate output directory in the root of project directory.
     target

All this files or directories should not be committed in to subversion so that other developers in the team can use shared source without conflict configuration.

To configure subversion to ignore project configuration files , do the following steps

     $ cd project_directory
     $ svn propedit svn:ignore .

For Ubuntu linux this command bring nano editor for adding the list of file or directories, just add all files that need not to be committed with your source codes.

     .settings
     .classpath
     .project
     target
     bin

Save file and then commit this list.

     $ svn commit -m "update ignore list"

Delete ignored files from subversion repository so that source code are none of ignored files but it still remember which files are not need to be uploaded from developer's machine.

Delete eclipse project and pretend to be a new member of developer team. Just check out the code and import into Eclipse again. IDE support files of Eclipse are created but will not be uploaded when you commit the code.



Monday, February 3, 2014

Setting TrueType fonts location for BIRT PDF report

When using TrueType fonts for PDF in BIRT report engine, you may see that some fonts like barcode or fonts for international languages are not appear correctly in PDF format report.

BIRT report engine is responsible for rendering exported format like PDF. It has configuration file for setting location of PDF fonts depend on you are running report in Eclipse BIRT designer or your java application.

If your report is run in BIRT designer, report engine will read configuration from fontsConfig.xml file under

     /eclipse_install_dir/plugins/org.eclipse.birt.report.engine.fonts_x.x.x.x

Open the file and look for <font-paths> section. Make sure you add your TrueType font location in the list.

For example TrueType fonts for thai language in Ubuntu linux are located in tlwg sub folder.

     <path path="/usr/share/fonts/truetype/tlwg"/>

But if your report is run in your java application that use BIRT report runtime engine in the form of libraries (jar files). The file fontsConfig.xml is packaged in

     org.eclipse.birt.runtime_4.3.1.xxxxxx.jar

Unfortunately, this file is signed and modifying the content of this file cause security exception in runtime. How I can fix this problem is to create symbolic link to the fonts (used in report) in the directory listed in original fontsConfig.xml

Case study
I use Ubuntu 12.04-TLS  and I want to use my Thai fonts in BIRT report with PDF format. I found that thai fonts are in

     /usr/share/fonts/truetype/tlwg

but it is not exists in fontsConfig.xml (in birt runtime jar file) . After checking the list of path in fontsConfig.xml, I've found the similar one.

     /usr/share/fonts/truetype/

The solution is creating symbolic link in this directory to target fonts. Assume wanted fonts is Norasi.ttf is in /usr/share/fonts/truetype/tlwg/.

     # cd /usr/share/fonts/truetype/
     # ln -s /usr/share/fonts/truetype/tlwg/Norasi.ttf    Norasi.ttf

After creating symbolic link, report engine should see this font and render report correctly.