-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add fontcExport.glyphsFileFormat plugin #146
Conversation
Hi, thanks for submitting this entry! On export, I get the following error in the Macro Panel:
macOS 14.4.1 (23E224) Print fontc version works and prints the following:
Clicking the export path does not work, even when the checkbox is checked, nothing happens when clicking on the path. I assume the How to update the embdedded fontc section in the readme is not for end users of the plugin, but just for people who want to develop/fork the plugin, right? Otherwise, any local changes would get discard by Glyphs’s update process. The entry in the package index looks good, but plugins often have a screenshot to make them stand out more. If you want, you can include a screenshot of the export dialog or just a simple graphic with a logo. Let me know if anything is unclear or you need help with anything. I did not look deeply into the plugin source, so there might be something I missed about the workflow. |
Yes those update instructions are for the maintainers of the plugin, not the font developer. The plugin embeds a specific version of fontc fronzen in time, the idea is the whole plugin needs updating if the users wants to update the embedded fontc executable. I think your python is somehow not set up properly, can you try to reinstall the glyphs python plugin? |
Maybe @schriftgestalt knows how to debug/fix this? |
Getting pip to work in Glyphs is a bit tricky. We had a discussion about this in with the https://github.com/justinpenner/TalkingLeaves/ plugin. So I would recommend to put the binary into the plugin directly, instead of relying on pip to download it. |
That might not be easy, as you will need different binaries for ARM and Intel. Maybe you can build a universal binary and serve both. Otherwise, you can offer separate ARM and Intel versions of the plugin, see the readme for details. |
The wheel is already universal2 so works for both architecture. |
And why does it work on my machine? I am also using the glyphs python plugin as far as I can tell |
Yes, we are working towards this, but sadly it’s not working yet.
It may very well be an issue on my side. @schriftgestalt, can you try if it works for you? |
The “fat” fontc binary weighs 37 MB, checking it in a git repo with all its future iterations as things get updated will make the repository bloat pretty soon |
Alternatively I can download the tar.gz archives with precompiled fontc from Github releases, check their checksums and unpack them inside the plugin without using pip or wheels, just using python stdlib, it’s just a bit more laborious |
Updating plugins by re-downloading the latest version as an alternative to Git, another thing on our list. But in this case, the plugin could ship without fontc and fetch the binary from some URL directly, placing it in the Application Support folder somewhere. |
|
I see now. Yes I do have Python 3.11 from python.org installed on my machine as well.
|
I think the issue is because the Glyphs Python plugin is created by naively copying a Python.framework from the /Library directory without actually making it relocatable.. Browsing around I found https://github.com/gregneagle/relocatable-python, maybe it could help |
actually it seems to work!
then I replaced the Python.framework inside the Glyphs Python plugin directory with the one I just made, and even when the official /Library/Frameworks/Python.framework is no longer there (I just renamed it to pretend it's not installed and trigger the dyld issue), calling pip from it works! otool -L now looks like this (notice the
@schriftgestalt I suggest you repackage the Glyphs Python plugin using the make_relocatable_python_framework.py script |
I used 3.11.6 because that's what the current Glyphs Python Plugin currently has, but you can safely go to 3.11.9 which is the latest 3.11 with a macos universal2 installer: https://www.python.org/downloads/macos/ released April 2024 |
You are a hero. Thanks for figuring that out. |
I pushed the changes. pip should work not. |
The plugin does start a download from pypi and then the save dialog is opened where I can pick a location to save the font file. Once I confirm the location, an error message is shown, indicating that something went wrong. This is the output in the Macro Panel:
This only happens when the document has no file (was not yet saved). Otherwise, it works. I think this is fine for now. If you want, you can save the current font to a temporary location and export that, if the document has no file. Otherwise, provide an error message explaining that the document first needs to be saved to a file. But this is an edge case, so I would merge this PR for now and you can address this in an update to the plugin. |
Note that users will first need to reinstall Python, if they have installed it already, or wait for Glyph’s package update process to install the latest Python from the Package Manager. Glyphs checks for updates on launch and periodically, and installs updates when quitting the app (so no loaded plugins/modules are modified while the app runs). |
hm It should only install the first time you do export after you click "Next...", not as soon as the dialog is opened.
ok that error simply means fontc couldn't parse the .glypsh file (it's still beta, pls file issue if you can thanks :)
i'm not sure what you mean "the docment has no file". Do you mean a new font that has never been saved? I actually just tried exporting one after having made sure I removed my local plugin symlink (I have also reinstalled the Glyphs Python plugin that Georg has just made relocatable), and it worked.
that's what we are already doing. We save the current font to a directory inside the Application Support/Glyphs 3/Temp folder, it's suffixed with -fontc (can you see that?)
I don't think that's necessary, as I said it should work (worked for me). Maybe your unsaved font contained some stuff that fontc still cannot parse for some reason.
gotcha Thank you both! |
I have shifted the discussion to an issue: googlefonts/fontc-export-plugin#2 |
I'm a complete noob so please be kind :)
I believe this is all is needed to add our https://github.com/googlefonts/fontc-export-plugin to the Glyphs.app Plugin Manager, please let me know if I need to modify or add anything thanks!