GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing github.com — WIP: New FreeType wrappers by mdboom · Pull Request #5414 · matplotlib/matplotlib Conversation
|
|
Awesome to see work on the text-stuff! Thanks for all the and sorry if this sounds too critical. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
ctypes and cffi both create a major security hole since one can basically open any library and call any address in it, so they are not available in restricted execution environments such as Google App Engine. With the whole world going to containers, I suppose that will become less of an issue over time, but in the meantime, we can't really decrease the number of platforms that matplotlib can run in.
I actually tried and failed with Cython initially for these wrappers. The very careful memory management required for freetype and the stuff like the FT_OpenArgs with its C callbacks etc. really is far more cumbersome in Cython than in direct C. Plus, Cython requires copying all of the information in the FreeType headers over which is a real pain when trying to support multiple versions of FreeType. For example, FreeType explicitly says to not rely on the numeric values of error codes -- but in Cython we would have to copy those numbers over and then keep them in sync with each revision of FreeType. The FreeType API also provides a lot of things through direct access in structs. Again, as those structures change, a Cython wrapper would potentially have to account for changes in those structs over time. With C, a simple recompile will do. Above all that, I find Cython really hard to deal with when things go wrong. Trying to run gdb or valgrind over that stuff is a nightmare. Of course, all of this comes from a bias of being very comfortable with C.
I haven't wrapped any of FreeType's cache stuff. It certainly could be added in this scheme. It doesn't look super useful in a Python context since it's so easy to implement cache-like behavior, and it's reference counted etc. However, it might be the case that FreeType's cache code has less overhead etc. I think I would start by seeing just how much time is spent re-doing work to get a theoretical "best case" for using caching before devoting the considerable effort to use this stuff. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Will this also obsolete #3912? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This will provide an avenue for handling TTC files in the correct and general way. Probably will do that as a follow-on to this PR, however. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I've punted on checkbox #1 in the original topic. FreeType can only manage the metrics in an AFM file if you have an associated PFB file -- which we don't ship or need to ship. I think the status quo (using |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
...due to the removal of FT2Font
There was an error while loading. Please reload this page.
|
For the record FreeType is already using a unicode charmap by default (http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/src/base/ftobjs.c#n1370); since FreeType 2.8.1 such a charmap will be automatically generated if the font doesn't include it (https://sourceforge.net/projects/freetype/files/freetype2/2.8.1/). So the second point will become moot once we switch the vendored FT version to >=2.8.1. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing in lieu of #9763 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Actually there's (at least) still one thing that this PR does which #9763 doesn't, which is to replace ttconv (the font subsetter for pdf/ps output). That's actually a task fairly independent from wrapping freetype (which is what #9763 focuses on). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Opened issue about ttconv and closing this again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.