Closed georgeyjm closed 10 months ago
a GSGlyph.script is None by default, it's purpose is to allow one to override the default script definition for a specific glyph (via the CTRL+OPTION+I panel). The default script for a given glyph name is stored in the GlyphData.xml, and accessible from glyphsLib by looking up the glyph name with e.g. data = glyphsLib.glyphdata.get_glyph("A"); assert data.script == "latin"
get the script by a glyph's unicode value
you can try to query the glyph database directly using the unicode value (as hexadecimal string), e.g.:
>>> from glyphsLib.glyphdata import GLYPHDATA
>>> GLYPHDATA.unicodes.get("0061")
{'unicode': '0061',
'name': 'a',
'category': 'Letter',
'subCategory': 'Lowercase',
'script': 'latin',
'description': 'LATIN SMALL LETTER A'}
>>> GLYPHDATA.unicodes.get("0061")["script"]
'latin'
>>> GLYPHDATA.unicodes.get("104A3")["script"]
'osmanya'
a GSGlyph.script is None by default, it's purpose is to allow one to override the default script definition for a specific glyph (via the CTRL+OPTION+I panel). The default script for a given glyph name is stored in the GlyphData.xml, and accessible from glyphsLib by looking up the glyph name with e.g.
data = glyphsLib.glyphdata.get_glyph("A"); assert data.script == "latin"
Thanks a lot! I thought GSGlyph.script being defaulted to None meant it was not implemented yet. This is super helpful!
I am trying to get the script by a glyph's unicode value. It seems like this is not yet supported, and accessing the property
GSGlyph.script
always returnsNone
. But I'm not completely sure if this is indeed the case. If so, I will try to fill this part in.