Skip to content

Commit

Permalink
Add FONTC_VERSION and script to update requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed May 15, 2024
1 parent 6c795bf commit b03dd0c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
1 change: 1 addition & 0 deletions FONTC_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.2a9
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@ It downloads a standalone fontc executable inside the plugin, which is removed w

![export dialog](exportDialog.png)

The "Command line options" accept whatever fontc accepts.
The "Command line options" accept whatever fontc accepts.

#### How to update the embdedded fontc

1. Check the latest fontc version available at https://github.com/googlefonts/fontc/releases/latest
1. Modify the `FONTC_VERSION` file accordingly
1. Run `./update-requirements.sh` to update the requirements.txt file embedded inside
the plugin
1. Bump _both_ `CFBundleShortVersionString` and `CFBundleVersion` in `fontcExport.glyphsFileFormat/Contents/Resources/Info.plist`, and stick to Glyphs.app's conventions whereby `CFBundleShortVersionString` looks like `MAJOR.MINOR` (e.g. `0.1`) and `CFBundleVersion` is a simple integer (e.g. `123`) for the build number.
1. Commit the changes and push
7 changes: 4 additions & 3 deletions fontcExport.glyphsFileFormat/Contents/Resources/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def setupRecentExportPathsButton(self):
menu.addItem_(item)

item = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
f"Update fontc", "updateFontc:", ""
f"Reinstall fontc", "reinstallFontc:", ""
)
item.setTarget_(self)
menu.addItem_(item)
Expand Down Expand Up @@ -214,7 +214,8 @@ def setUpFontc(self):
"--disable-pip-version-check",
"--target",
self.pluginResourcesDirPath(),
"fontc",
"-r",
os.path.join(self.pluginResourcesDirPath(), "requirements.txt"),
]
run_subprocess_in_macro_window(installCommand, check=True)

Expand Down Expand Up @@ -264,7 +265,7 @@ def currentFontcVersion(self):
# strip the 'fontc-' prefix and '.dist-info' suffix to get version string
return os.path.basename(distInfoPath)[6:-10]

def updateFontc_(self, sender):
def reinstallFontc_(self, sender):
fontcPath = self.fontcPath()
if os.path.exists(fontcPath):
print("Removed fontc; it will be re-downloaded on next export.")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--only-binary :all:

fontc==0.0.2a9 \
--hash=sha256:17e303e067fe548925e2c4499a8eff012cfa0a6965194b5309aee290ca506775 \
--hash=sha256:2e156d8c857962b4a062986184b53e9ed03fc192495c0cc34a7e319e4aea8d27 \
--hash=sha256:60c1b98394f0034ebe9ab54dc75396df90c6ea20386e9df07a26496ecc038ed1 \
--hash=sha256:a02e34087b2be3444eb5fa8e08549ebe78f65389d91b4f8ba16646f91efb4e4e \
--hash=sha256:a5bf5dd9c628f45da02aa2986430de8a8931d87cb505bfd4b0131c70ecf0e26e
10 changes: 10 additions & 0 deletions update-requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Download the requirements.txt file with pinned fontc version and SHA256 hashes
# as specified in the 'VERSION' file.

# Un-comment this and delete the fork's url when the upstream repo starts publishing releases
# FONTC_REPO_URL="https://github.com/googlefonts/fontc"
FONTC_REPO_URL="https://github.com/anthrotype/fontc"

curl -LJo fontcExport.glyphsFileFormat/Contents/Resources/requirements.txt $FONTC_REPO_URL/releases/download/fontc-v$(<FONTC_VERSION)/requirements.txt

0 comments on commit b03dd0c

Please sign in to comment.