Skip to content
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

Make GlyphsBackend writable #75

Open
ollimeier opened this issue Jan 8, 2025 · 0 comments · May be fixed by #76
Open

Make GlyphsBackend writable #75

ollimeier opened this issue Jan 8, 2025 · 0 comments · May be fixed by #76
Assignees

Comments

@ollimeier
Copy link
Collaborator

See also: googlefonts/fontra#117

Notes from Just:
Regarding the writable glyphs backend:

  • it is in the fontra-glyphs repo (I assume you know that)
  • It currently implements the ReadableFontBackend protocol (defined in protocols.py)
  • It needs to implement all methods of WritableFontBackend (same module)
  • Start with stubs that do nothing
  • Then start sketching out putGlyph()
  • Have a look at _loadFiles, it reads the raw data. We mostly throw that away after parsing, but we should probably hold on to it so we can update it and write it back.

Compare with the fontra backend and the designspace backend, see how they implement writing glyphs.

So, loading .glyphs data goes in two steps:

  • parse file with openstep_plist.load() , this results in "raw" data structures
  • construct objects from the raw data structures into proper objects, lazily / on demand

For writing, we should keep the raw data around, and "patch" it up with our modified data, then write with openstep_plist.dump() (I think that's what it's called)

This strategy should give us minimal changes compared to the original data (this is an important goal).

@ollimeier ollimeier self-assigned this Jan 8, 2025
@ollimeier ollimeier changed the title Need to write a filesystem backend for .glyphs files Make GlyphsBackend writable Jan 8, 2025
@ollimeier ollimeier linked a pull request Jan 8, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant