Comments (11)
i'm not even sure that loading dynamic libraries via cytpes is supported with emscripten python..
googling around I found this pyodide/pyodide#728
from freetype-py.
since pyodide/pyodide#1656 was merged, ctypes is supposedly supported in pyodide.
Maybe you simply don't have the libfreetype.so installed, or your linker can't find it in the default library search paths (try setting LD_LIBRARY_PATH or DYLD_LIBRARY_PATH).
I also found pyodide/pyodide#2338 while searching for "synchronous loading of external files is not available" error.
I've never used emscripten python, maybe other maintainers know more.
from freetype-py.
from freetype-py.
I am on MacOs, but that shouldn't influence Pyodide, right? Thanks for pointing out the issue on Pyodide. Sorry, I am not that knowledgeable. I think my comment has nothing to do with this library, but rather with Pyodide.
This wrapper relies on the FreeType installed by the OS, like via brew, right? I guess the browser won't be able to access it anyway, even after the fix. Then I need to compile FreeType to .so
and put it somewhere so freetype/raw.py
can find it and then generate wheel out of this package, I believe 🙈
from freetype-py.
we do provide precompiled wheels for most platforms/py-versions already, they are published on the Python Packaging Index (PyPI), it's what gets normally installed when you do pip install freetype-py
from freetype-py.
ok you're on mac so you should find the library under the name "libfreetype.dylib".. but instead of "Darwin" you get "Emscripten" from platform.system()
so it falls back to the (implicit) "Linux" else
branch of the if
statement.
Not sure what's the best way to detect this situation.
from freetype-py.
how did you install freetype-py in pyodide? Using micropip.install
?
not sure, but maybe we need to build a custom Pyodide package where the freetype library itself is converted to webassembly?
https://pyodide.org/en/stable/development/new-packages.html#c-library-dependencies
from freetype-py.
from freetype-py.
pyodide is cpython compiled to webassembly, it runs in a special vm inside the browser, it doesn't have access to external libraries. We need to make a pyodide package as explained in the pyodide docs link I posted above. We're lucky in that there's already an emscripten port for the freetype library itself, so it's a matter of doing something similar to what they do for the pyodide package for "matplotlib" module (which also depends on the freetype library):
https://github.com/pyodide/pyodide/blob/38fae6e9cbcdd8e932a53bf1c763279dc55729d5/packages/matplotlib/meta.yaml#L24-L26
from freetype-py.
from freetype-py.
The emscripten port of freetype is really old though
yeah, 2.6 is quite old. Some user of the emscripten port reported success in building freetype with the emcmake
tool
I discovered that the latest FreeType builds fine using emcmake cmake with their latest CMakeLists.txt file, so I switched to using that in my workflow.
emscripten-ports/FreeType#4 (comment)
So it's technically feasible, only need someone to take the time to understand how to build a pyodide package and make a PR upstream to include in pyodide's own built-in packages.
from freetype-py.
Related Issues (20)
- [Question] How to decode Face.postscript_name? HOT 26
- About emoji from font file error HOT 9
- Documentation for get_first_char HOT 3
- FT_Exception: (cannot open resource) HOT 21
- Two-factor identification on PyPi HOT 5
- get_cbox() raise "invalid argument" error HOT 3
- Wrong horizontal character positioning in hello world examples HOT 9
- New release with pyinstaller fix HOT 5
- feature request: expose FreeType's COLRv1 API HOT 6
- Please publish .tar.gz sdist archives
- on exit, freetype/__init__.py", line 1233, in __del__ TypeError: 'NoneType' object is not callable HOT 10
- `segfault` with version `2.4.0` HOT 10
- possible memory leaks and issues during finalizer HOT 1
- `load_char` failed for custom fonts with right input HOT 28
- Pyinstaller cannot import module HOT 5
- AttributeError: module 'freetype' has no attribute 'Face' HOT 2
- Please provide non-bundled wheels HOT 7
- Remove the pyinstaller code if there is any more trouble
- Move freetype-py to Freetype organisation ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freetype-py.