mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-10 08:30:49 +03:00
support FriBiDi<1.0
This commit is contained in:
parent
f2b2d53ca8
commit
b4a57d6fc5
46
src/thirdparty/fribidi-shim/fribidi.c
vendored
46
src/thirdparty/fribidi-shim/fribidi.c
vendored
|
@ -10,6 +10,20 @@
|
||||||
|
|
||||||
#include "fribidi.h"
|
#include "fribidi.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* ..._ex adds bracket_types param, ignore and call legacy function */
|
||||||
|
FriBidiLevel fribidi_get_par_embedding_levels_ex_compat(
|
||||||
|
const FriBidiCharType *bidi_types,
|
||||||
|
const FriBidiBracketType *bracket_types,
|
||||||
|
const FriBidiStrIndex len,
|
||||||
|
FriBidiParType *pbase_dir,
|
||||||
|
FriBidiLevel *embedding_levels)
|
||||||
|
{
|
||||||
|
return fribidi_get_par_embedding_levels(
|
||||||
|
bidi_types, len, pbase_dir, embedding_levels);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int load_fribidi(void) {
|
int load_fribidi(void) {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
|
@ -17,11 +31,22 @@ int load_fribidi(void) {
|
||||||
|
|
||||||
/* Microsoft needs a totally different system */
|
/* Microsoft needs a totally different system */
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
p_fribidi = dlopen("libfribidi.so.1", RTLD_LAZY);
|
#define LOAD_FUNCTION(func) \
|
||||||
|
func = (t_##func)dlsym(p_fribidi, #func); \
|
||||||
|
error = error || (func == 0);
|
||||||
|
|
||||||
|
p_fribidi = dlopen("libfribidi.so", RTLD_LAZY);
|
||||||
|
if (!p_fribidi) {
|
||||||
|
p_fribidi = dlopen("libfribidi.so.0", RTLD_LAZY);
|
||||||
|
}
|
||||||
if (!p_fribidi) {
|
if (!p_fribidi) {
|
||||||
p_fribidi = dlopen("libfribidi.dylib", RTLD_LAZY);
|
p_fribidi = dlopen("libfribidi.dylib", RTLD_LAZY);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
#define LOAD_FUNCTION(func) \
|
||||||
|
func = (t_##func)GetProcAddress(p_fribidi, #func); \
|
||||||
|
error = error || (func == 0);
|
||||||
|
|
||||||
p_fribidi = LoadLibrary("fribidi");
|
p_fribidi = LoadLibrary("fribidi");
|
||||||
/* MSYS2 */
|
/* MSYS2 */
|
||||||
if (!p_fribidi) {
|
if (!p_fribidi) {
|
||||||
|
@ -33,20 +58,17 @@ int load_fribidi(void) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
/* load ..._ex first to preserve error variable */
|
||||||
#define LOAD_FUNCTION(func) \
|
LOAD_FUNCTION(fribidi_get_par_embedding_levels_ex);
|
||||||
func = (t_##func)dlsym(p_fribidi, #func); \
|
if (error) {
|
||||||
error = error || (func == 0);
|
/* using FriBiDi 0.x, emulate ..._ex function */
|
||||||
#else
|
fribidi_get_par_embedding_levels_ex = &fribidi_get_par_embedding_levels_ex_compat;
|
||||||
#define LOAD_FUNCTION(func) \
|
error = 0;
|
||||||
func = (t_##func)GetProcAddress(p_fribidi, #func); \
|
}
|
||||||
error = error || (func == 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LOAD_FUNCTION(fribidi_get_bidi_types);
|
LOAD_FUNCTION(fribidi_get_bidi_types);
|
||||||
LOAD_FUNCTION(fribidi_get_bracket_types);
|
LOAD_FUNCTION(fribidi_get_bracket_types);
|
||||||
LOAD_FUNCTION(fribidi_get_par_embedding_levels_ex);
|
LOAD_FUNCTION(fribidi_get_par_embedding_levels);
|
||||||
// LOAD_FUNCTION(fribidi_get_par_embedding_levels);
|
|
||||||
LOAD_FUNCTION(fribidi_unicode_to_charset);
|
LOAD_FUNCTION(fribidi_unicode_to_charset);
|
||||||
LOAD_FUNCTION(fribidi_charset_to_unicode);
|
LOAD_FUNCTION(fribidi_charset_to_unicode);
|
||||||
|
|
||||||
|
|
6
src/thirdparty/fribidi-shim/fribidi.h
vendored
6
src/thirdparty/fribidi-shim/fribidi.h
vendored
|
@ -83,9 +83,9 @@ FRIBIDI_FUNC(FriBidiLevel, fribidi_get_par_embedding_levels_ex,
|
||||||
const FriBidiCharType *, const FriBidiBracketType *, const FriBidiStrIndex,
|
const FriBidiCharType *, const FriBidiBracketType *, const FriBidiStrIndex,
|
||||||
FriBidiParType *, FriBidiLevel *);
|
FriBidiParType *, FriBidiLevel *);
|
||||||
|
|
||||||
//FRIBIDI_FUNC(FriBidiLevel, fribidi_get_par_embedding_levels,
|
FRIBIDI_FUNC(FriBidiLevel, fribidi_get_par_embedding_levels,
|
||||||
// const FriBidiCharType *, const FriBidiStrIndex, FriBidiParType *,
|
const FriBidiCharType *, const FriBidiStrIndex, FriBidiParType *,
|
||||||
// FriBidiLevel *);
|
FriBidiLevel *);
|
||||||
|
|
||||||
FRIBIDI_FUNC(FriBidiStrIndex, fribidi_unicode_to_charset,
|
FRIBIDI_FUNC(FriBidiStrIndex, fribidi_unicode_to_charset,
|
||||||
FriBidiCharSet, const FriBidiChar *, FriBidiStrIndex, char *);
|
FriBidiCharSet, const FriBidiChar *, FriBidiStrIndex, char *);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user