When using the FastReport.NET (Core), FastReport Open Source and FastReport Mono libraries on Linux operating system, as well as when saving documents as images or PDF files, there is a possibility to experience the incorrect display of Unicode texts in the report preview.
One of the most common problems is a hyphenation error and, as a result, incorrect spacing between words. For example, when using Thai language on Windows OS, we see the following text:
When running the same report on Linux Ubuntu, the following line is formatted incorrectly:
There may also be problems with the word wrap. Let’s look at another example with Thai on Windows operating system:
The same text is displayed incorrectly in Linux Ubuntu operating system:
Such text display errors can be observed in other languages.
It is also possible that the following error will occur:
1 |
System.OutOfMemoryException: Not enough memory to complete operation [GDI+ status: OutOfMemory]
|
Fortunately, there is a solution – lingdiplus library self-assembly from source with Pango.
Before starting, it is highly recommended to make a backup copy of the /usr/lib/libgdiplus*.* files, as they will be overwritten with the new ones in the process of building the library. In this case, you can return the system to its original state if the desired result has not been achieved.
In the first step, we need to install the required dependencies using the command:
$ sudo apt-get install libgif-dev autoconf libtool automake build-essential gettext libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev libpango1.0-dev
Then we need to make a copy of the needed libgdiplus library from the GitHub repository:
$ git clone https://github.com/mono/libgdiplus.git
After that, go to the libgdiplus folder and execute the build commands:
$ ./autogen.sh --with-pango --prefix=/usr $ make
If the build was successful and there are no errors, then you can install the built library:
$ sudo make install
The files will replace the old ones in the /usr/lib folder.
Now you can run the program with reports and make sure it works correctly.
For example, you can see how FastReport Mono works under Linux Ubuntu 18.04:
All of the above is also true for web applications using the .NET Core and Mono frameworks.
I wish you the best of luck and less problems with cross-platform programs!