Skip to content

Commit

Permalink
Use .glyphspackage
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledhosny committed Nov 30, 2023
1 parent 630bddd commit d914ea5
Show file tree
Hide file tree
Showing 528 changed files with 130,452 additions and 129,919 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/venv
/build
/.vscode
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ FM_OPTS2 = $(FM_OPTS) \
--master-dir="{tmp}" \
--instance-dir="{tmp}"

$(BUILDDIR)/$(NAME).glyphs: $(SOURCEDIR)/$(NAME).glyphs
$(BUILDDIR)/$(NAME).glyphspackage: $(SOURCEDIR)/$(NAME).glyphspackage
echo " PREPARE $(@F)"
mkdir -p $(BUILDDIR)
$(PY) $(SCRIPTDIR)/setversion.py $< $@ $(VERSION)

$(BUILDDIR)/$(NAME).designspace: $(BUILDDIR)/$(NAME).glyphs
$(BUILDDIR)/$(NAME).designspace: $(BUILDDIR)/$(NAME).glyphspackage
echo " UFO $(@F)"
mkdir -p $(BUILDDIR)
glyphs2ufo $< -m $(BUILDDIR) -n "$(PWD)"/$(INSTANCEDIR) \
Expand Down
18 changes: 14 additions & 4 deletions scripts/setversion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
from glyphsLib import GSFont
import shutil
import openstep_plist


def main():
Expand All @@ -10,9 +11,18 @@ def main():

args = parser.parse_args()

font = GSFont(args.file)
font.versionMajor, font.versionMinor = [int(x) for x in args.version.split(".")]
font.save(args.outfile)
shutil.copytree(args.file, args.outfile, dirs_exist_ok=True)

fontinfo = f"{args.outfile}/fontinfo.plist"
with open(fontinfo, "r") as f:
info = openstep_plist.load(f, use_numbers=True)

major, minor = args.version.split(".")
info["versionMajor"] = int(major)
info["versionMinor"] = int(minor)

with open(fontinfo, "wb") as f:
openstep_plist.dump(info, f)


if __name__ == "__main__":
Expand Down
Loading

0 comments on commit d914ea5

Please sign in to comment.