How-to rebuild the libgdiplus library

Sometimes it can be incorrect to display Unicode texts when saved in images or in PDF when running FastReport Open Source on Linux. 

One of the most common problems is the error of hyphenation in a sentence and, as a result, the wrong interval between words.

For example, when using the Thai language in Windows, we see this text:

Thai language in Linux

When running the same report in Linux Ubuntu you can see that the string is formatted incorrectly:

Thai language in Linux

There may also be problems with word wrap. Another example with the Thai language in the Windows operating system:

Another example with the Thai language in the Windows operating system


The same text in the Linux operating system Ubuntu does not look correct:

The same text in the Linux operating system Ubuntu does not look correct

Similar errors may occur in other languages.

Fortunately, there is a solution to the problem described above - building the libgdiplus library from sources with the with-pango key.

Before you begin, it is strongly recommended to back up the /usr/lib/libgdiplus*.* files, as they will be overwritten with new files in the process. In this case you can return the system to its original state if the desired result is not obtained.

First, we need to install the required dependencies:

$ sudo apt-get install libgif-dev autoconf libtool automake build-essential gettext libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev

Then we need to make a clone of the libgdiplus from the GitHub repository:

$ git clone https://github.com/mono/libgdiplus.git

After that we go to the libgdiplus directory and run the build commands:

$ ./autogen.sh --with-pango --prefix=/usr
$ make

If the build was successful and there are no errors, you can install the compiled library:

$ sudo make install

The files will be copied into the /usr/lib folder.

Now you can run the application with reports and make sure that it works correctly.

Good luck and less problems with cross-platform applications!


Author: Alexander Tsyganenko




Comments

Popular posts

FastReport Designer Community Edition

How to use FastReport Open Source in ASP.NET Core Web API application