File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ ITER_RAQM_API(DEFINE_API)
20
20
bool bad_color_glyph_spacing{};
21
21
decltype (hb::version_string) hb::version_string{};
22
22
23
- void load_raqm () {
23
+ void load_raqm ()
24
+ {
24
25
if (!raqm::_handle) {
25
26
char const * filename =
26
27
#if defined __linux__
@@ -32,7 +33,19 @@ void load_raqm() {
32
33
#endif
33
34
raqm::_handle = os::dlopen (filename);
34
35
if (!raqm::_handle) {
35
- os::throw_dlerror ();
36
+ #if defined __APPLE__
37
+ // Homebrew doesn't add itself to the library loader path, but we can
38
+ // detect that case: if FreeType comes from Homebrew (this typically
39
+ // depends on how cairo/pycairo were installed), then also try to load
40
+ // raqm from Homebrew.
41
+ auto ft_path = os::dladdr_fname (FT_Library_Version);
42
+ if (ft_path.find (" /opt/homebrew/" ) == 0 ) {
43
+ raqm::_handle = os::dlopen (" /opt/homebrew/lib/libraqm.dylib" );
44
+ }
45
+ #endif
46
+ if (!raqm::_handle) {
47
+ os::throw_dlerror ();
48
+ }
36
49
}
37
50
#define LOAD_API (name ) \
38
51
if (!(raqm::name = os::dlsym (raqm::_handle, " raqm_" #name))) { \
@@ -58,7 +71,8 @@ void load_raqm() {
58
71
}
59
72
}
60
73
61
- void unload_raqm () {
74
+ void unload_raqm ()
75
+ {
62
76
if (raqm::_handle) {
63
77
auto const & error = os::dlclose (raqm::_handle);
64
78
raqm::_handle = nullptr ;
@@ -68,7 +82,8 @@ void unload_raqm() {
68
82
}
69
83
}
70
84
71
- bool has_raqm () {
85
+ bool has_raqm ()
86
+ {
72
87
return raqm::_handle;
73
88
}
74
89
You can’t perform that action at this time.
0 commit comments