Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

sfsymbols.ArgumentParserError error 5. #23

Open
lemons990 opened this issue Jul 2, 2020 · 11 comments
Open

sfsymbols.ArgumentParserError error 5. #23

lemons990 opened this issue Jul 2, 2020 · 11 comments

Comments

@lemons990
Copy link

% sfsymbols
The operation couldn’t be completed. (sfsymbols.ArgumentParserError error 5.)

System: MacOS Big Sur/11
Device: Macbook Air 2018
Version: Latest

@C0DECYCLE
Copy link

I have the issue also on macOS Catalina 10.15.4 and Xcode-12-Beta.

@glouel
Copy link

glouel commented Jul 11, 2020

Same here on Big Sur and Xcode 12 Beta 2, looks like there's something amiss with Xcode 12.

Edit : I tried building with Xcode 11.5 on Big Sur, same issue (unless I missed something)

@IntZer0
Copy link

IntZer0 commented Jul 12, 2020

just install this
https://developer.apple.com/design/downloads/SF-Symbols.dmg

@glouel
Copy link

glouel commented Jul 12, 2020

just install this
https://developer.apple.com/design/downloads/SF-Symbols.dmg

@IntZer0 thanks a lot for this, you got me on the right track !

So to all, the issue is actually the beta version of SF Symbols 2 that we likely had all installed (that one: https://developer.apple.com/design/downloads/SF-Symbols-2.dmg)

I'm pretty sure that when you install version 2, it uninstalls the first. I installed back the 1.1 version on top (it overrode the fonts, so the new symbols are gone and apparently so is the app launcher, not sure what happened here), but it works, so I guess there's something with the code and the fonts bundled with SFSymbols 2 ?

Also unless I'm mistaken, the fonts are supposed to be bundled this time with Big Sur (finally ! or is that just a symbol library and not the fonts ?) so there might be some interaction coming from here too.

I'm not 100% sure it's just the app fallback, because unless I messed up, I'm fairly sure I had tried specifying the font manually too and that failed also.

I also tried to recompile with a quick fix to use the SF Symbols beta bundle (it has a different bundle identifier, com.apple.SFSymbols-beta) here :

let maybeCFURLs = LSCopyApplicationURLsForBundleIdentifier("com.apple.SFSymbols" as CFString, nil)?.takeRetainedValue()

But that didn't change a thing, so the argument issue is probably elsewhere.

@glouel
Copy link

glouel commented Jul 12, 2020

So I had another look with SF Symbols 2 beta, with the code as is in the repo, we get the basic argument error thing but should really get "Unable to locate suitable SF Symbols font", it looks like the correct error while thrown is not surfaced correctly in the end (I'm not super familiar with how thrown errors are supposed to bubble up in Swift so not exactly sure how to fix that one sorry).

With the change I suggested above, we go past that, but quite frankly I'm neither familiar with fonts nor with the code so I'm not super clear why it hangs, @davedelong maybe you can have a look, here's what I found it may give you a head start:

  • For SF-Symbols beta, the bundle is called com.apple.SFSymbols-beta (so doing the change above does help finding the "correct" bundle)
  • There is still the SFSymbolsFallback.ttf in Resources, and that is located correctly
  • As far as I understand, the code fails somewhere here :

guard let base64String = String(data: data as Data, encoding: .utf8) else { return nil }

I tried tracking it but I have quite frankly no idea what its doing, the code goes through once correctly and fails the second time.

My best guess is that the new SF Symbols 2 fonts have something different, maybe it's linked to the color thing, although I'm not 100% clear on how they have implemented colors. In any case, specifying the font manually probably won't help as it's the font loading that fails with the SF Symbols 2 fonts.

(and answering one of my previous questions from above, I still don't know if they are currently bundled with big sur, but if you install SF Symbols 1, you can still reinstall SF Symbols 2 and it will overwrite the fonts with the new ones).

@bermudalocket
Copy link

Improved error output in PR #26.

@mflint
Copy link

mflint commented Sep 8, 2020

I think it's failing to convert the symp data into a UTF8 string... but I don't know why. Maybe the decryption is failing @davedelong?

https://github.com/davedelong/sfsymbols/blob/master/Sources/SFSymbolsCore/Font.swift#L85

Edit: there's some more discussion here, suggesting that the glyph data is obfuscated before the AES encryption.

@ben-p-commits
Copy link

Wow, that's wild. Swimming upstream, huh?

@vliegeois
Copy link

Any news to support SF Symbols version 2.1?

@luckman212
Copy link

luckman212 commented Dec 14, 2020

Anyone got any ideas for exporting a handful of symbols as PNG? I'm on macOS 11 + SFSymbols 2.1 so I'm hitting the sfsymbols.ArgumentParserError error 5. I've got about 40 symbols I want to export, so doing them by hand in Illustrator isn't sounding fun. I've seen people suggest using Figma but TBH I am not sure how to do that either.

@gubikmic
Copy link

@luckman212 and others who need a workaround today:
Download the SF Symbols v1.
During the installation, install to your home directory so the SF Symbols 2.1 in /Applications doesn't get overwritten.
(Alternatively you could probably rename the 2.1 before installing 1.0)
Now you can use:

sfsymbols --font-file ~/Applications/SF\ Symbols.app/Contents/Resources/SFSymbolsFallback.ttf

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

10 participants