-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Freetype library name on windows and Mac OS X #47
Comments
But ctype is supposed to resolve that more or less automatically, no ? |
I think the 6 came from when freetype got adopted by the Xfree86/Xorg folks - every major library version was 6. From X11 R6. I think ctypes deals with the dll and possibly even the dylib part, but not the rest. SharpFont (c# binding of freetype, mostly windows centric) distributes 'freetype6.dll', mingw compiled freetype is named "libfreetype-6.dll'. |
freetype from homebrew (OSX) is named without the 6 indeed. But we can change the default to the one with the 6 and fall back to the one without if not found. |
It's a bit annoying that you get different file names depending on the build system you use... would it make sense to instead look for |
For the embedded library of course it doesn’t matter the filename nor the extension, as we load it with its relative path and that is hard-coded and known in advance. |
@madig You mean testing all combinations? Because I'm not sure ctypes offer any useful search patterns. |
One could go though all combinations and feed them to ctypes. But maybe the pre-built binaries make that superfluous. |
But if people install without pre-built binaires, this is still a problem. |
Yes, but maybe people won't do that as often with bundled binaries :) Something for another PR. |
Yes. @HinTak Do you think it still worth investigating? |
Don't we want to look for libfreetype.dylib at least? We can probably forget about the libfreetype.6.dylib variant for the time being.
|
I apologize if I am missing some existing way to do this, but would allowing the library name and path to be specified, by environment variables or some such be a possible solution to @HinTak's question? Something like (in raw.py): filename = os.getenv("FREETYPEPY_FT_LIBPATH")
if not filename:
... current logic to find lib/set value of filename which is eventually passed to ctypes.CDLL() ... It seems to me that something like this could be useful to anyone wishing to use freetype-py with a custom FreeType library that is not necessarily system-installed, not in the pre-set search locations, or uses a different filename from what freetype-py expects. |
Location is a different thing - freetype-py itself (or rather, the underlying ctype package) already let you change location of look-up by the corresponding OS mechanisms: on Linux/mac os x, via LD_LIBRARY_PATH, and for windows, just PATH , I think. This issue is about variation in the file naming and extensions: dll vs so vs dylib, and the 6 and another space or dash before and after. |
I should clarify: I was thinking |
@josh95117 The idea would be worth to be investigated. But I'm afraid people will set if and forget they've set it at some point. If we go in this direction, we would need a specific error message saying the filename provided by the env variable was not found. But in the end, we only have to test a moderate number of standard combinations so maybe this the What do you think? |
@rougier yes, I understand the concern about setting the environment variable and then forgetting about it. I guess it wouldn't be too hard to put a check for file existence in there. But as I think more about this, I wonder if this is really a good way to solve the problem. As @HinTak mentions, the "-6", ".6" naming variations are common with different build systems. It seems like an unnecessary burden to require an environment variable for those scenarios (assuming the library eventually ends up in a standard location). It might be better to try to improve the library-finding logic to accommodate those names. I'll try to do some work on this and do a PR with some actual implementations for people to critique, not just hypotheticals :-) |
My idea was to use the env variable (whatever the name) to test for a specific places. As the library is, there is no simple way to use another freetype but the one found. |
OK...I spent a little time studying |
Am a bit surprised that
freetype-py
looks only forfreetype.dll
orlibfreetype.so.6
. It is usuallyfreetype6.dll
built from upstream 's visual studio project, andlibfreetype.6.dylib
in Mac OS X's convention.The text was updated successfully, but these errors were encountered: