mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-12 09:41:47 +02:00
font-patcher: Split code into more functions
[why] The patch() function also does the font generation. This makes it impossible to generate two fonts from one patch run. (Will be needed in next commit). The name setup could be done later. [note] This is no functional change, just reordering. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
35d3cfeff5
commit
3c3e2a49a7
1 changed files with 9 additions and 2 deletions
11
font-patcher
11
font-patcher
|
@ -180,7 +180,7 @@ class font_patcher:
|
|||
self.sourceFont = fontforge.open(self.args.font, 1) # 1 = ("fstypepermitted",))
|
||||
except Exception:
|
||||
sys.exit(projectName + ": Can not open font, try to open with fontforge interactively to get more information")
|
||||
self.setup_font_names()
|
||||
self.setup_version()
|
||||
self.remove_ligatures()
|
||||
make_sure_path_exists(self.args.outputdir)
|
||||
self.check_position_conflicts()
|
||||
|
@ -242,7 +242,6 @@ class font_patcher:
|
|||
|
||||
if symfont:
|
||||
symfont.close()
|
||||
print("\nDone with Patch Sets, generating font...")
|
||||
|
||||
# The grave accent and fontforge:
|
||||
# If the type is 'auto' fontforge changes it to 'mark' on export.
|
||||
|
@ -252,6 +251,8 @@ class font_patcher:
|
|||
if "grave" in self.sourceFont:
|
||||
self.sourceFont["grave"].glyphclass="baseglyph"
|
||||
|
||||
|
||||
def generate(self):
|
||||
# the `PfEd-comments` flag is required for Fontforge to save '.comment' and '.fontlog'.
|
||||
if self.sourceFont.fullname != None:
|
||||
outfile = self.args.outputdir + "/" + self.sourceFont.fullname + self.extension
|
||||
|
@ -614,6 +615,9 @@ class font_patcher:
|
|||
self.sourceFont.comment = projectInfo
|
||||
self.sourceFont.fontlog = projectInfo
|
||||
|
||||
|
||||
def setup_version(self):
|
||||
""" Add the Nerd Font version to the original version """
|
||||
# print("Version was {}".format(sourceFont.version))
|
||||
if self.sourceFont.version != None:
|
||||
self.sourceFont.version += ";" + projectName + " " + version
|
||||
|
@ -1225,6 +1229,9 @@ def main():
|
|||
check_fontforge_min_version()
|
||||
patcher = font_patcher()
|
||||
patcher.patch()
|
||||
print("\nDone with Patch Sets, generating font...\n")
|
||||
patcher.setup_font_names()
|
||||
patcher.generate()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in a new issue