| 1 |
from babelfont.convertors.glyphs.glyphs3 import GlyphsThree |
| 2 |
import os |
| 3 |
import openstep_plist |
| 4 |
import glob |
| 5 |
|
| 6 |
|
| 7 |
class GlyphsPackage(GlyphsThree): |
| 8 |
suffix = ".glyphspackage" |
| 9 |
|
| 10 |
@classmethod |
| 11 |
def can_save(cls, convertor, **kwargs): |
| 12 |
return False |
| 13 |
|
| 14 |
@classmethod |
| 15 |
def can_load(cls, other, **kwargs): |
| 16 |
return other.filename.endswith(cls.suffix) |
| 17 |
|
| 18 |
def _load(self): |
| 19 |
infofile = os.path.join(self.filename, "fontinfo.plist") |
| 20 |
# orderfile = os.path.join(self.filename, "order.plist") |
| 21 |
# glyphorder = openstep_plist.load(open(orderfile, "r")) |
| 22 |
self.scratch["plist"] = openstep_plist.load( |
| 23 |
open(infofile, "r"), use_numbers=True |
| 24 |
) |
| 25 |
self.scratch["plist"]["glyphs"] = [] |
| 26 |
for glyphfile in glob.glob(os.path.join(self.filename, "glyphs", "*")): |
| 27 |
self.scratch["plist"]["glyphs"].append( |
| 28 |
openstep_plist.load(open(glyphfile, "r"), use_numbers=True) |
| 29 |
) |
| 30 |
|
| 31 |
return super()._load() |