Why Glyphs 2 script does not work on glyphs 3

why Glyphs 2 script does not work on glyphs 3?
I have glyphs 2 script that convert very old wrong-mapped arabic fonts to unicode mapping.
I transfered the scripts to the glyphs 3 script folder and applied the script on a font >> no effect
i suspected the problem could be due to glyphs 3 dropped arabic presentation form unicode assignments which is used in script ID conversion.
so I opened the old font then added the parameter " Use Arabic Presentation Form Unicodes Use legacy Presentation Form Unicode values for Arabic glyphs"
then tried to run the script but no effect for the script. (not working)

I’am not familiar with coding, so I don’t know if the script itself should be first edited/corrected to work with glyphs 3.

help

Along with the introduction of Glyphs 3 there also happened the transition from Python 2 to 3. The programming language got some drastic changes, which where necessary to keep it a modern language. At the same time, Glyphs also needed to improve to newer font technologies and hence some of its APIs changed a bit.

Those 2 things together could be a bit daunting for someone checking in just now and not smoothly transitioned along the way. But it’s all fixable with some adjustments usually to the python code. First it needs to be changed so that it runs on Python 3, and then the Glyphs APIs need to be adjusted to the ones from Glyphs 3, if there are any which changed.

It is hard to tell without knowing the Python script, but here is even a tutorial: “Scripting: upgrading to Python 3” (@mekkablue: I think that could get a little update as no one should need to install Python via homebrew anymore just for Glyphs, or?)

1 Like

Do you get a error message in the macro window when you run the script?

1 Like

Thanks for explanation

Yes, I tried the code and get this error of syntax

File “Converter MyCorrectionEdit.py”, line 321
print “ATTENTION: %s already exists, trying to bump the extension …” % ( glyphName )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(…)?

I read the tutorial: “Scripting: upgrading to Python 3” as @Mark adviced then;

I tried to correct by putting parentheses after all print command instances (befor and after each quote " ")

Screenshot of ten parentheses added red-underlined

then. I tried the script > i get another SyntaxError: multiple exception types must be parenthesized

corrected exception, e to exception as e

i get code error

the parentheses need to embrace the entire thing. So for example change

print_("Renamed glyph: %s >>> %s") % (source, targetString)

with

print_("Renamed glyph: %s >>> %s" % (source, targetString))

Note how I moved the closing ) to the end


also change

print(""")

to either

print()

or

print("") # note 2 quotes, not three

but the empty print() is better, if you just want a new line to be printed

1 Like

There is a newer version of AXt Converter, it is called Encoding Converter now and lives in the mekkablue scripts.

1 Like

your code is awesome but it doesn’t assign arabic unicode to it, so arabic keyboard does not type what iam writing

i have in the past edited one of your old axt converter
here it is
glyphs3 AXt Converter My Correction Edit.py.zip (4.1 KB)

if unicode info inside old one could merge with yours that would be awesome
thanks

thanks for your help, it worked when your notes applied

1 Like