Reloading a font from disk

Hello! I’ve been working on a version control plugin which checks font files into git on save. Now I’m working on the other half of the problem: a script which navigates the repository history. I want to be able to double-click on a revision, and check out that version of the font.

The problem is that even if I do git checkout, (changing the file on disk) I can’t see how to get Glyphs to reload the new version of the font to reflect the changes.

Is there a notification I can post or something to get Glyphs to (ideally) reload the font, or (less ideally) close the current font and open a specified font?

I think this Methode is the best option.
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSDocument_Class/#//apple_ref/occ/instm/NSDocument/revertToContentsOfURL:ofType:error:
You get the document instance from Font.parent (or Font.patent() I’m one the phone right now)

Thanks, that’s perfect! It all works nicely. Now your fonts can travel back and forward in time…

If anyone would like to try it out, the code is at https://github.com/simoncozens/GlyphsGit

1 Like

Hi Simon, I report @monokano’s feedback. To be honest I haven’t used it, so my explanation may not be clear, but here it goes:

  1. It’s a bit odd that when you double-click a past version, the file itself is indeed replaced, but the glyph view isn’t refreshed and you need to close the file.
  2. To refresh the history you need to close the history window. Maybe it’s better to auto-refresh or have a refresh button, and also clear history button?
  3. History is tied to file name, so it loses track when you rename the file. It might help if there is on option to show the file name.
  4. Change log does not accept Japanese.