crengine-ng is cross-platform library designed to implement text viewers and e-book readers.
Supported document formats: fb2, fb3, epub (without DRM), rtf, doc, docx, odt, htm, Markdown, chm, pdb, mobi (without DRM), txt, trc, prc.
In fact, this is a fork of the CoolReader project.
The founder and developer of CoolReader is Vadim Lopatin. Other authors are listed in AUTHORS file.
Supported platforms: Windows, Linux, MacOS.
This repository is created from the official CoolReader repository by removing everything that does not belong to the "crengine" library using the "git-filter-repo" utility.
This project is in the experimental phase, the main goals are:
- Main goal is the same as CoolReader's crengine - support & development fast and portable library which allows to create e-book readers for different platform including handheld devices.
- Some minor improvements are possible.
- Refactoring legacy code to make it easier to work on codebase.
- Bugfixes.
- Support for modern systems.
crqt-ng - cross-platform desktop e-book reader (using the Qt framework).
crwx-ng - cross-platform desktop e-book reader (using wxWidgets).
LxReader - e-book reader for Android.
This library can use other libraries (links to licenses point to official websites whenever possible):
- FreeType - font rendering (any of your choice GPLv2 or FTL)
- HarfBuzz - text shaping, font kerning, ligatures (Old MIT)
- ZLib - compressing library (cache compression, zip-archives support) (ZLib)
- ZSTD - compressing library (cache compression) (BSD and GPLv2)
- libpng - PNG image format support (libpng)
- libjpeg - JPEG image format support (libjpeg)
- libwebp - WebP image format support (BSD-3-Clause)
- libjxl - JPEG XL image format support (BSD-3-Clause)
- FriBiDi - RTL writing support (LGPL-2.1)
- libunibreak - line breaking and word breaking algorithms (Zlib)
- utf8proc - for unicode string comparision (utf8proc (MIT-like) + Unicode data license)
- GoogleTest - for unit testing, optional (BSD-3-Clause)
-
Install dependencies (via package manager or compile from sources)
To install these libraries for Ubuntu you can use the following command:
$ sudo apt install zlib1g-dev libpng-dev libjpeg-dev libwebp-dev libjxl-dev libfreetype6-dev libfontconfig1-dev libharfbuzz-dev libfribidi-dev libunibreak-dev libutf8proc-dev libzstd-devYou may also need to install the main packages necessary for development:
$ sudo apt install build-essential git cmake curl pkg-configSome distributions do not contain the required versions of certain libraries, in which case you can build these libraries yourself from sources. The procedure for installing such libraries from sources is outside the scope of this document.
-
Build using cmake. cmake options:
- CRE_BUILD_SHARED - Building crengine-ng as a shared library; default ON
- CRE_BUILD_STATIC - Building crengine-ng as a static library; default ON
- ADD_DEBUG_EXTRA_OPTS - Add extra debug flags and technique (use sanitizer, etc); default OFF
- DOC_DATA_COMPRESSION_LEVEL - Document buffer cache compression; default 1; variants: 0, 1, 2, 3, 4, 5
- DOC_BUFFER_SIZE - Total RAM buffers size for document; default 0x400000
- MAX_IMAGE_SCALE_MUL - Maximum image scale multiplier; default 0; variants: 0, 1, 2
- GRAY_BACKBUFFER_BITS - Gray depth for gray backbuffer; default 4; variants: 1, 2, 3, 4, 8
- ENABLE_LARGEFILE_SUPPORT - Enable large files support; default ON
- USE_COLOR_BACKBUFFER - Use color backbuffer; default ON
- USE_LOCALE_DATA - Use built-in locale data; default ON
- LDOM_USE_OWN_MEM_MAN - Use own ldom memory manager; default ON
- USE_GIF - Allow GIF support via embedded decoder; default ON
- BUILD_TOOLS - Build some debug tools & utils; default OFF
- ENABLE_UNITTESTING - Enable building unit tests using googletest; default OFF
- OFFLINE_BUILD_MODE - Offline build mode; default OFF
- ENABLE_LTO - Enable Link Time Optimization; default OFF
To use bundled third party:
- USE_NANOSVG - Use nanosvg for svg image support; default ON
- USE_CHM - Enable chm support via built-in chmlib; default ON
- USE_ANTIWORD - Enable doc support via built-in antiword; default ON
- USE_SHASUM - Use sources from RFC6234 to calculate SHA sums (engine will create fingerprint for the document opened); default OFF
- USE_CMARK_GFM - Enable Markdown support via built-in cmark-gfm; default OFF
- USE_MD4C - Enable Markdown support via built-in MD4C; default ON
To use external dependencies:
- WITH_LIBPNG - Use libpng library for png image support; default AUTO; variants: AUTO, ON, OFF
- WITH_LIBJPEG - Use libjpeg library for jpeg image support; default AUTO; variants: AUTO, ON, OFF
- WITH_LIBWEBP - Use libwebp library for webp image support; default AUTO; variants: AUTO, ON, OFF
- WITH_LIBJXL - Use libjxl library for jpeg xl image support; default AUTO; variants: AUTO, ON, OFF
- WITH_FREETYPE - Use FreeType library for font rendering; default AUTO; variants: AUTO, ON, OFF
- WITH_HARFBUZZ - Use HarfBuzz library for text shaping; default AUTO; variants: AUTO, ON, OFF
- WITH_LIBUNIBREAK - Use libunibreak library; default AUTO; variants: AUTO, ON, OFF
- WITH_FRIBIDI - Use FriBiDi library for RTL text; default AUTO; variants: AUTO, ON, OFF
- WITH_ZSTD - Use zstd for cache compression; default AUTO; variants: AUTO, ON, OFF
- WITH_UTF8PROC - Use utf8proc for string comparison, etc; default AUTO; variants: AUTO, ON, OFF
- USE_FONTCONFIG - Use FontConfig to enumerate available fonts; default ON
For example, we are already in the top source directory, then:
$ mkdir ../crengine-ng-build
$ cd ../crengine-ng-build
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DCRE_BUILD_SHARED=ON -DCRE_BUILD_STATIC=OFF ../crengine-ng
$ make -j10 VERBOSE=1
$ make installNote about OFFLINE_BUILD_MODE: This mode only affects build of unit tests. This mode uses the GoogleTest library installed in the system. The GNU FreeFont fonts must first be copied to the "${CMAKE_BINARY_DIR}/crengine/tests/fonts" folder.
For example, in the build directory, you can run the following commands:
$ wget -c http://ftp.gnu.org/gnu/freefont/freefont-otf-20120503.tar.gz
$ tar -xvzf freefont-otf-20120503.tar.gz -C crengine/tests/fonts/ --strip-components=1 --wildcards '*.otf'When this mode is disabled, all these components are downloaded automatically using cmake.
See CONTRIBUTING.md file.
The list of contributors can be found in the AUTHORS file.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
The "thirdparty" directory contains some patched libraries with their own licenses (compatible with GPLv2):
- chmlib - LGPL-2.1+
- antiword - GPL-2.0+
- nanosvg - ZLib
- qimagescale - imlib2, LGPL-3, GPL-2.0+
- rfc6234-shas - BSD-3-Clause
- cmark-gfm - BSD-2-Clause
- MD4C - MIT/Expat
Other third party can be found in the sources and resources:
- xxhash - BSD-2-Clause
- fc-lang - FontConfig, MIT like
- libiconv (fragments) - LGPLv2+