Skip to content
This repository has been archived by the owner on Apr 15, 2021. It is now read-only.

KeyError: ‘symp’ with SF-Pro.ttf #4

Open
KevinGutowski opened this issue Jul 20, 2020 · 5 comments
Open

KeyError: ‘symp’ with SF-Pro.ttf #4

KevinGutowski opened this issue Jul 20, 2020 · 5 comments

Comments

@KevinGutowski
Copy link

Not sure if ya’ll have been able to get this to work with the latest version of SF Symbols (SF Symbols 2 Beta)?

AES Key: B885F69E398CBA7240DB496BE8C61488549F1F885D476B2E2CC114F13B172120
AES IV: EFB0D12EFAC59114C3E5B91270F0C046
Traceback (most recent call last):
  File "/Users/Kski/.local/share/virtualenvs/SFSymbolsMetadata-pActPVrY/lib/python3.8/site-packages/fontTools/ttLib/ttFont.py", line 372, in __getitem__
    return self.tables[tag]
KeyError: 'symp'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./Script/sfsymbolsconvert.py", line 39, in <module>
    convert()
  File "/Users/Kski/.local/share/virtualenvs/SFSymbolsMetadata-pActPVrY/lib/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/Kski/.local/share/virtualenvs/SFSymbolsMetadata-pActPVrY/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/Kski/.local/share/virtualenvs/SFSymbolsMetadata-pActPVrY/lib/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/Kski/.local/share/virtualenvs/SFSymbolsMetadata-pActPVrY/lib/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "./Script/sfsymbolsconvert.py", line 27, in convert
    symp = font[table_name].data
  File "/Users/Kski/.local/share/virtualenvs/SFSymbolsMetadata-pActPVrY/lib/python3.8/site-packages/fontTools/ttLib/ttFont.py", line 381, in __getitem__
    data = self.reader[tag]
  File "/Users/Kski/.local/share/virtualenvs/SFSymbolsMetadata-pActPVrY/lib/python3.8/site-packages/fontTools/ttLib/sfnt.py", line 103, in __getitem__
    entry = self.tables[Tag(tag)]
KeyError: ‘symp'
@KevinGutowski
Copy link
Author

CleanShot 2020-07-19 at 20 03 59

looks like the ‘symp’ isn’t there in the latest version of the font?

@auramagi
Copy link
Owner

auramagi commented Jul 20, 2020

The way the metadata is stored appears to have been changed in SF Symbols 2, so I'm not really sure how to proceed.
There is no longer a symp table inside the unified font file. Fallback font file in the SF Symbols app does have this table, but it now has some obfuscation algorithm applied before AES encryption.

It's way easier now to use the CoreGlyphs framework to extract data from the plists and asset catalog inside it.
Check inside /System/Library/CoreServices/CoreGlyphs.bundle/Contents/Resources.

@auramagi
Copy link
Owner

I was able to extract the table by piggybacking on SF Symbols app, but I don't think I have enough skills to reverse-engineer the obfuscation algorithm myself 😅
SFSymbolsFallback.csv.zip
There is some useful info there not found in the CoreGlyphs bundle — like categories and search metadata, but nothing for multicolor support, for example.

@KevinGutowski
Copy link
Author

Dang! Thanks for taking a look! Bummer that this stuff isn’t more easily available. I appreciate you taking a look though! The categories and the search metadata is super nice (and probably most key for what I’m looking to do) so I appreciate you sharing that.

@j-f1
Copy link

j-f1 commented Oct 14, 2020

I did a little bit of searching, and it seems that the SF Symbols app comes with SFSymbolsKit.framework. I was able to extract the Swift types from this binary (using dsdump), but I was unable to import it into Xcode. I tried including the Headers and Modules directories from an identically-named framework into which I had copied the generated Swift types (with changes made so the output compiles). However, this led to an error “error extracting version from module interface.” I think I’m missing some important component of the framework.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants