Components to Excel I/O
I'm thinking: not a GUI tool but an I/O thing with several possibilities.
https://openpyxl.readthedocs.io/en/stable/ is a library for Excel files. But in fact, this could even start with a simple CSV
I can think of various representations of conponents, but I haven't quite seen one that I'm thinking about:
A sheet should have the setup:
| glyph | oldc | newc | m1.x | m2.x | m3.x |
|---|---|---|---|---|---|
| Aacute | A | A | 0 | 0 | 0 |
| Aacute | acute | acutecomb | 250 | 282 | 321 |
m1, m2 are masters of course
On export from FL, you could decide on which properties to output and in which order. There is a situation where you'd prefer m1.x, m1.y, m2.x, m2.y but in other cases it would be better to have m1.x, m2.x, m1.y, m2.y.
Or only output/adjust the x coords as shown in the above example.
The first functionality would be to output CSV from FL and then to read it back in (and rebuild the composites)
The sorting of rows is to be figured out. Sometimes you'll want to sort by glyph, sometimes by component.
Each row is actually a transformation. Which is why there is oldc and newc
- If newc is present and oldc is empty, newc is added to the glyph
- if newc is empty, oldc gets deleted
- if newc = oldc or there is only one column (newc), the data is only for adjustment
- if newc != oldc, oldc is replaced with newc
If a coordinate is empty, the coordinate of the main master (?) is used.
Once CSV I/O is done, Xslx (Excel) support could be added, and ultimately also a DeltaMachine-like big table. But I think the actual flexible CSV I/O would be paramount.
This CSV/spreadsheet format gives you "everything": adding, removing, replacing and adjusting. MM. If a column is not in the data that FL reads from csv/xlsx, that data is not changed (for new components, a default like 0 gets used)
The overall assumption is that if the column is for a font master, then all component operations are performed on all masters. So if a master does not include a component or even an appropriate glyph layer, it's added. Though maybe an empty cell might signify something.
If a column is for a font-less master (glyph layer), then it's not mandatory in all layers.
| glyph | oldc | newc | m1.x | m2.x | l3.x |
|---|---|---|---|---|---|
| Aacute | A | A | 0 | 0 | 0 |
| Aacute | acute | acutecomb | 250 | 282 | 321 |
| Agrave | A | A | 0 | 0 | |
| Agrave | gravecomb | 250 | 282 |
In this example, l3 is a font-less master (:wt=320 etc)
There probably should be some way to use some aliases for the master/layer names, or their real names. Aliases could be super short
In addition to .x & .y, more properties like interpolation source, slant, stretch etc. should be supported.
Generally, I think a similar tool/format could be adapted for anchors. I think this 2D representation is really great.
Unknown columns in xslx/csv should be ignored. This way people can make their own extra calculations and formulae in Excel/Numbers
I looked around and three Py modules are mentioned: pandas xlrd openpyxl
https://towardsdatascience.com/intro-to-reading-and-writing-spreadsheets-with-python-b635ae514ab8
Pandas is interesting, might take care of quite a few tasks.
- https://pandas.pydata.org/
- https://pandas.pydata.org/docs/user_guide/io.html
There is a "final version that supports Py2"
https://pypi.org/project/pandas/0.24.2/
https://pandas.pydata.org/pandas-docs/version/0.24.2/whatsnew/v0.24.2.html
They are now at v1.0.2 but they made a big jump. Pandas was in development for 12 years and last year it was v0.
And, if it's a lowhanging fruit (maybe), this could be extended with collaborative aspects via Google Sheets (just adding it here so we have it tracked)
https://github.com/burnash/gspread/blob/master/README.md
If we were to visualize: https://github.com/pyqtgraph/pyqtgraph
ref https://github.com/dmnfarrell/pandasqtapp