Skip to content

Commit

Permalink
Merge pull request #5365 from nulano/fribidi-notes
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Mar 30, 2021
2 parents 9e5ecd6 + 00cc32e commit e08474a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
31 changes: 21 additions & 10 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ Windows Installation

We provide Pillow binaries for Windows compiled for the matrix of
supported Pythons in both 32 and 64-bit versions in the wheel format.
These binaries have all of the optional libraries included except
for raqm, libimagequant, and libxcb::
These binaries include support for all optional libraries except
libimagequant and libxcb. Raqm support requires
FriBiDi to be installed separately::

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
Expand All @@ -71,8 +72,8 @@ macOS Installation

We provide binaries for macOS for each of the supported Python
versions in the wheel format. These include support for all optional
libraries except libimagequant and libxcb. Raqm support requires
libraqm, fribidi, and harfbuzz to be installed separately::
libraries except libimagequant. Raqm support requires
FriBiDi to be installed separately::

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
Expand All @@ -83,7 +84,7 @@ Linux Installation
We provide binaries for Linux for each of the supported Python
versions in the manylinux wheel format. These include support for all
optional libraries except libimagequant. Raqm support requires
libraqm, fribidi, and harfbuzz to be installed separately::
FriBiDi to be installed separately::

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
Expand Down Expand Up @@ -191,11 +192,15 @@ Many of Pillow's features require external libraries:
* libraqm depends on the following libraries: FreeType, HarfBuzz,
FriBiDi, make sure that you install them before installing libraqm
if not available as package in your system.
* setting text direction or font features is not supported without
libraqm.
* libraqm is dynamically loaded in Pillow 5.0.0 and above, so support
is available if all the libraries are installed.
* Windows support: Raqm is not included in prebuilt wheels
* Setting text direction or font features is not supported without libraqm.
* Pillow wheels since version 8.2.0 include a modified version of libraqm that
loads libfribidi at runtime if it is installed.
On Windows this requires compiling FriBiDi and installing ``fribidi.dll``
into a directory listed in the `Dynamic-Link Library Search Order (Microsoft Docs)
<https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#search-order-for-desktop-applications>`_
(``fribidi-0.dll`` or ``libfribidi-0.dll`` are also detected).
See `Build Options`_ to see how to build this version.
* Previous versions of Pillow (5.0.0 to 8.1.2) linked libraqm dynamically at runtime.

* **libxcb** provides X11 screengrab support.

Expand Down Expand Up @@ -244,6 +249,12 @@ Build Options
an exception if the libraries are not found. Webpmux (WebP metadata)
relies on WebP support. Tcl and Tk also must be used together.

* Build flags: ``--vendor-raqm --vendor-fribidi``
These flags are used to compile a modified version of libraqm and
a shim that dynamically loads libfribidi at runtime. These are
used to compile the standard Pillow wheels. Compiling libraqm requires
a C99-compliant compiler.

* Build flag: ``--disable-platform-guessing``. Skips all of the
platform dependent guessing of include and library directories for
automated build systems that configure the proper paths in the
Expand Down
18 changes: 18 additions & 0 deletions docs/releasenotes/8.2.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@ TODO
Other Changes
=============

Libraqm and FriBiDi linking
^^^^^^^^^^^^^^^^^^^^^^^^^^^

The way the libraqm dependency for complex text scripts is linked has been changed:

Source builds will now link against the system version of libraqm at build time
rather than at runtime by default.

Binary wheels now include a statically linked modified version of libraqm that
links against FriBiDi at runtime instead. This change is intended to address
issues with the previous implementation on some platforms. These are created
by building Pillow with the new build flags ``--vendor-raqm --vendor-fribidi``.

Windows users will now need to install ``fribidi.dll`` (or ``fribidi-0.dll``) only,
``libraqm.dll`` is no longer used.

See :doc:`installation documentation<../installation>` for more information.

PyQt6
^^^^^

Expand Down
3 changes: 3 additions & 0 deletions src/thirdparty/fribidi-shim/fribidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ int load_fribidi(void) {
error = error || (func == 0);

p_fribidi = LoadLibrary("fribidi");
if (!p_fribidi) {
p_fribidi = LoadLibrary("fribidi-0");
}
/* MSYS2 */
if (!p_fribidi) {
p_fribidi = LoadLibrary("libfribidi-0");
Expand Down
2 changes: 1 addition & 1 deletion winbuild/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ and install Pillow in develop mode (instead of ``python3 -m pip install --editab
Testing Pillow
--------------

Some binary dependencies (e.g. ``libraqm.dll``) will be stored in the
Some binary dependencies (e.g. ``fribidi.dll``) will be stored in the
``winbuild\build\bin`` directory; this directory should be added to ``PATH``
before running tests.

Expand Down

0 comments on commit e08474a

Please sign in to comment.