unifont.org >> LASi
2008-02-08 New Release Announcement: libLASi-1.1.0
The LASi development team is proud to announce the release of libLASi-1.1.0 which has significant improvements (a new build system based on CMake and some small code updates to make libLASi more robust) compared to prior releases.
The new CMake-based build system allows building libLASi on both Unix and Windows platforms and automatically detects freetype version so split releases to cater to different freetype versions are no longer necessary.
The robustness improvements mean that libLASi now renders an empty box rather than erroring out in those rare cases where glyph information returned by pango/cairo/fontconfig is not available or else is in a glyph form that is unusable by libLASi.
The file release area (including release notes, a detailed ChangeLog, the source tarball for version 1.1.0, and an md5 checksum for that tarball) is located at http://sourceforge.net/project/showfiles.php?group_id=187113.
Enjoy using libLASi to make some very nice looking PostScript results and your feedback is welcome.
-- Alan W. Irwin on behalf of the libLASi developers, 2008-02-08.
Introduction
libLASi is a library written by Larry Siden
that provides a C++ stream output interface
( with operator << ) for creating Postscript documents that can
contain characters from any of the scripts and symbol blocks supported
in Unicode
and by Owen Taylor's Pango layout engine.
The library accomodates right-to-left scripts such as Arabic and Hebrew as easily as
left-to-right scripts. Indic and Indic-derived Complex Text Layout (CTL)
scripts, such as Devanagari, Thai, Lao, and Tibetan are supported to the extent
provided by Pango and by the OpenType fonts installed on your system.
All of this is provided without need for any special configuration or layout calculation
on the programmer's part.
Although the capability to produce Unicode-based multilingual Postscript documents exists in large Open Source application framework libraries such as GTK+, QT, and KDE, libLASi was designed for projects which require the ability to produce Postscript independent of any one application framework.
libLASi is now a Sourceforge project -- Please visit http://sourceforge.net/projects/lasi to find out the latest development information.
Motivation
This document outlines the motivation and strategy employed in the development of LASi.
Download
libLASi-1.1.0 Latest Stable Release
Download the latest stable release, libLASi-1.1.0, from http://sourceforge.net/project/showfiles.php?group_id=187113.
Sourceforge SVN Repository
For the latest development version of the library, visit http://sourceforge.net/projects/lasi to learn more about accessing libLASi's SVN repository. To check out the latest code from the repository, you can use the following command line:
svn co https://lasi.svn.sourceforge.net/svnroot/lasi/trunk lasi
Font Resources
The example programs included with LASi contain Unicode text in various languages. To obtain Open Source and otherwise liberally-licensed fonts required for proper generation of the example Postscript output, please visit Unifont.org's Unicode Font Guide For Free/Libre Open Source Operating Systems.
Prerequisites and Dependencies
The code base in the Sourceforge SVN repository uses a CMake build system. You will need at least version 2.4.5 to build LASi from SVN.
LASi uses Owen Taylor's Pango text layout engine. Pango itself depends on the glib infrastructure library of the GTK+ toolkit and on the FreeType 2 font handling library.
Almost any modern Linux or similar free *nix operating system will already have the FreeType2 library installed. If you have the Gnome desktop or GTK+-based software like the Gimp installed on your system, then you may be able to use the glib and Pango libraries already present on your system.
If you decide to download glib and Pango, be sure to download "matched" libraries from the Gnome web site. For example, if you go to the download area for Gnome 2.8, you will find glib-2.4.6.tar.gz and pango-1.6.0.tar.gz. Glib-2.4.6 and pango-1.6.0 are "matched" for building a stable version of Gnome and should thus provide you good results when used with LASi.
General CMake Build Instructions for libLASi
As CMake is a new build system which many developers are not yet familiar with, we provide the following general CMake instructions to get you started:
1) Create an empty build directory and cd to it:
mkdir build_dir
cd build_dir
2) Configure libLASi using cmake or ccmake:
cmake -DCMAKE_INSTALL_PREFIX=/path/to/install/prefix \
-DCMAKE_VERBOSE_MAKEFILE=ON /path/to/lasi/source/code >& cmake.out
OR:
ccmake -DCMAKE_INSTALL_PREFIX=/path/to/install/prefix \
-DCMAKE_VERBOSE_MAKEFILE=ON /path/to/lasi/source/code
The CMAKE_INSTALL_PREFIX option lets the user specify the install prefix
and CMAKE_VERBOSE_MAKEFILE=ON insures the subsequent make commands give
verbose results. ccmake is a GUI frontend for cmake that gives you other
annotated options you can set.
3) Build and install libLASi:
make >& make.out
su -c "make install >& /tmp/make_install.out"
Note: 'su -c "<root command>"' is the
conventional way to execute a command requiring root privileges on Linux. On some other systems,
such as OS X, you might invoke "sudo" instead, while on other systems you might need
to start a root shell using the "su" command.
Platform Specific Notes
Recent Linux distributions will already have most, if not all, of the tools and libraries that you need to build LASi already installed. This will likely not be the case on other platforms. Therefore, if you plan to build LASi on a non-Linux platform, be prepared to spend some time downloading and installing required tools like CMake and DOxygen, as well as dependent libraries like GLib and Pango.
Linux
Development of LASi takes place primarily on Linux workstations with fairly recent distributions installed. As a result, most of the tool and library dependencies described in the preceding section will normally already be present on your machine. A possible exception is CMake : be sure to get at least version 2.4.5.
OS X
We have achieved the best success with the least frustration by building the required tools and libraries directly from source code. However, if you don't really like this idea, you might want to try http://trac.macosforge.org/projects/macports/wiki which provides a Gentoo-like build experience.
Due to numerous problems encountered with Fink, we cannot recommend Fink at this time.
Here then are build instructions for Apple OS X:
1) Get CMake: Download the latest Darwin Universal (Tiger only installer) .dmg from www.cmake.org. This will install cmake in /usr/bin.
2) Get SVN: Matthew E. Porter provides SVN .dmg installers for OS X that do not require Fink. Importantly, these binaries are compiled with SSL support, which is required for checking out LASi from the Sourceforge SVN repository. The URL is http://metissian.com/projects/macosx/subversion/. This binary will be installed in /usr/local/bin .
3) Get PKG-CONFIG: Build from source. http://pkgconfig.freedesktop.org/releases/pkg-config-0.20.tar.gz. If you install libraries using different prefixes, don't forget to "export PKG_CONFIG_PATH" as necessary so that pkg-config can find the installed libraries. For example:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
4) Get DOXYGEN: Build it from source. Available from http://www.stack.nl/~dimitri/doxygen/ . DOxygen is needed to create the LASi documentation. Installs in /usr/local/bin by default.
5) Get libxml2 from http://xmlsoft.org/ and build it from source. This library is required to compile fontconfig.
6) Get fontconfig from http://www.fontconfig.org/wiki/ and build it from source.
7) Get FREETYPE: Build Freetype from source. Available from http://freetype.sourceforge.net/ . Using the defaults, Freetype will be installed in /usr/local/lib and --importantly-- the freetype.pc file will be found by LASi's CMake build system.
8) Get CAIRO from http://xmlsoft.org/ and build it from source.
9) Get GLIB and PANGO from the Gnome project. At the time of this writing, the latest version was 2.16.13: http://ftp.gnome.org/pub/GNOME/platform/2.16/2.16.3/sources/ . Download the latest versions of glib and pango. Be sure to build and install glib first. These will be installed in /usr/local/lib by default.
10) Finally you should now be able to build LASi without any problems. :-)
Other *Nix Systems
On other, non-Linux *Nix systems be prepared to spend some time chasing down missing dependencies. The instructions for OS X above will give you a fair idea of what may be required.
You may find that your life is easier if you install a recent version of the GCC compiler suite along with GNU gmake.
You will almost certainly need to use the C++ standard library that comes with the GCC compiler suite (Even compilers like Intel's icpc compiler uses the GNU C++ standard library when linking projects on Linux). Other C++ libraries, such as on Sun Solaris, may not be sufficiently up-to-date.
Make utilities on some platforms, such as OpenBSD, do not have some of the capabilities of GNU gmake which are used frequently, so you will probably save yourself some trouble by using gmake.
After carefully satisfying all dependencies by installing packages from the ports tree or from source, we encountered no problems building libLASi on OpenBSD version 4.0 on i386.
Windows
These instructions from Werner Smekal should allow anybody to compile libLASi on Windows platforms with the MinGW and Visual C++ compiler:
1) Download the following from http://www.gimp.org/~tml/gimp/win32/downloads.html :
- glib-2.12.7.zip and glib-dev-2.12.7.zip
- pango-1.14.9.zip and pango-dev-1.14.9.zipy
- pkg-config-0.20-zip
- libiconv-1.9.1.bin.woe32.zip
- cairo-1.2.6.zip and cairo-dev-1.2.6.zip
- freetype-2.2.1.zip and freetype-dev-2.2.1.zip
- fontconfig-tml-2.3.2-20060825.zip and fontconfig-dev-2.3.2-tml-20060825.zip
- gettext-0.14.5.zip and gettext-dev-0.14.5.zip
Unzip all packages in a directory, e.g. C:\Dev\gtk .
2) Download from ftp://ftp.jclark.com/pub/xml/expat.zip:
- expat.zip
Unzip expat.zip and copy only the xmlparse.dll in the bin directory to
C:\Dev\gtk\bin. Rename xmlparse.dll to libexpat.dll.
3) Some additional things need to be ironed out:
-
Change last 3 lines of
gtk/lib/pkg-config/pangoft2.pcto (add freetype2 as requirement and delete absolute directories in Cflags):
Requires: pango,freetype2
Libs: -L${libdir} -lpangoft2-1.0
Cflags: -I${includedir}/pango-1.0
- The freetype import library for Visual C++ is missing and we need to create it (pexports is available here: http://www.emmestech.com/software/cygwin/pexports-0.43/download_pexports.html) -- for MinGW omit this step:
cd C:\Dev\gtk\lib
pexports ..\bin\freetype6.dll > freetype.def
lib /machine:i386 /def:freetype.def
4) Set environment variables for cmake (USER_ROOTDIR is the
development directory, e.g. C:\Dev\gtk):
rem setup glib, pango, cairo, freetype, pkg-config
set PKG_CONFIG_PATH=%USER_ROOTDIR%\gtk\lib\pkgconfig
set PATH=%USER_ROOTDIR%\gtk\bin;%PATH%
5) Build libLASi in a command line environment:
- Run the following commands (similar for Visual C++):
mkdir build (we assume the lasi directory is in the same folder as the build)
cd build
make -G "MinGW Makefiles" -DBUILD_SHARED=ON -DCMAKE_INSTALL_PREFIX=C:\Dev\gtk ../lasi
mingw32-make install (compiles and install into gtk directory)
If you have trouble building LASi ...
If you have trouble building LASi, the usual culprits are:
-
CMake or ccmake problems. You need version 2.4-patch 6 or newer. As of this writing (2007.03.07), most
distributions will only have an older version of CMake, if they have CMake at all. You will most likely have to
download and build the
latest version from a source code package.
It is always best to start with a clean LASi source tree, a separate (initially empty) build directory,
and be sure to specify "
-DCMAKE_INSTALL_PREFIX=<your installation path>" on the command line as recommended in the directions above. If you have trouble with the interactiveccmake, revert to usingcmakeinstead.cmakecaches results from the first run; Try "rm CMakeCache.txt" in order to start off again with a clean slate and no cached results. - pkg-config problems. Sometimes your system has all of the required libraries installed, but
the pkg-config utility doesn't have a clue where they are. Make sure you check
PKG_CONFIG_PATH. For example, if FreeType2 is installed in/usr/X11R6/liband Pango is installed in/opt/gnome/lib, then you might have to execute "export PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig:/opt/gnome/lib/pkgconfig" from your shell in order to get pkg-config and, by extension, the LASicmakebuild system to find these libraries. - Multiple installed versions of FreeType, Pango, or glib. This sort of issue is much harder to deal with.
Theoretically, it should not matter that you have multiple versions of FreeType2,
Pango or Glib installed. In the past we saw cases where the configure script detected one version of
a library
but at link time the linker linked against another version. With the new
cmake-based build system, most of these kinds of problems should be a thing of the past. Nevertheless, the easiest way to avoid problems is to avoid having multiple versions of the dependent libraries present on your machine. If that is not an option, and you have a good idea of what you are doing, you can play around with/etc/ld.so.confandldconfiguntil you get it to work.
API Documentation
Note: The DOxygen documentation generated when you build LASi will be more up-to-date than the documentation here. However as the API is already quite stable, the differences will be few:
Examples
Examples are provided in the examples subdirectory of the software distribution.
The makefiles included with the examples illustrate how to link a program against LASi.
Here is a simple example of what source code using LASi
looks like.
Original Author
Larry Siden lsiden@gmail.com is the original author of LASi.
Project Maintainers and Development Staff
Please visit http://sourceforge.net/projects/lasi/ for the most current information regarding project maintainers and development staff.
Credits
- Ed would like to sincerely thank Larry Siden for producing such an elegant and simple-to-use software interface.
- Ed would also like to thank Ritu Khanna for her interest and help in resolving bugs in the software and installation scripts.
- All of us would also like to thank Dr. Julia Richards of the Kellogg Eye Center at the University of Michigan Medical Center for providing us the opportunity and support to work on this project.
Colophon
My friend, Ed Trager, who first envisioned and motivated me to write LASi, suggested that I assign the name "Lasi" to this project, as "Lasi" is composed of the first two letters of my first name, Larry, followed by the first two letters of my last name, Siden. Since this immediately delighted by own sense of vanity, I had no trouble indulging Ed. Out of concern that the name "Lasi" might invite ridicule by jeolous programming rivals who would no doubt take every opportunity to mock it's connection to the beloved TV canine hero, I changed it's spelling to the post-modern, hi-tech moniker "LASi".